Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
18bbbb31
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
18bbbb31
编写于
6月 10, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
td-459: TSDB_TABLE_ID_LEN
上级
33819c0b
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
48 addition
and
46 deletion
+48
-46
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+6
-6
src/client/src/tscServer.c
src/client/src/tscServer.c
+2
-2
src/connector/python/linux/python2/taos/cinterface.py
src/connector/python/linux/python2/taos/cinterface.py
+3
-3
src/connector/python/windows/python2/taos/cinterface.py
src/connector/python/windows/python2/taos/cinterface.py
+3
-3
src/connector/python/windows/python3/taos/cinterface.py
src/connector/python/windows/python3/taos/cinterface.py
+3
-3
src/inc/taosdef.h
src/inc/taosdef.h
+6
-5
src/inc/taosmsg.h
src/inc/taosmsg.h
+13
-13
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+6
-6
src/plugins/http/src/httpAuth.c
src/plugins/http/src/httpAuth.c
+5
-4
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+1
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
18bbbb31
...
...
@@ -1056,12 +1056,12 @@ int32_t setObjFullName(char* fullName, const char* account, SSQLToken* pDB, SSQL
totalLen
+=
1
;
/* here we only check the table name length limitation */
if
(
tableName
->
n
>
TSDB_TABLE_NAME_LEN
)
{
if
(
tableName
->
n
>
=
TSDB_TABLE_NAME_LEN
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
else
{
// pDB == NULL, the db prefix name is specified in tableName
/* the length limitation includes tablename + dbname + sep */
if
(
tableName
->
n
>
(
TSDB_TABLE_NAME_LEN
-
1
)
+
(
TSDB_DB_NAME_LEN
-
1
)
+
sizeof
(
TS_PATH_DELIMITER
)
)
{
if
(
tableName
->
n
>
=
TSDB_TABLE_NAME_LEN
+
TSDB_DB_NAME_LEN
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
...
...
@@ -1078,7 +1078,7 @@ int32_t setObjFullName(char* fullName, const char* account, SSQLToken* pDB, SSQL
fullName
[
totalLen
]
=
0
;
}
return
(
totalLen
<
=
TSDB_TABLE_ID_LEN
)
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_TSC_INVALID_SQL
;
return
(
totalLen
<
TSDB_TABLE_ID_LEN
)
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_TSC_INVALID_SQL
;
}
static
void
extractColumnNameFromString
(
tSQLExprItem
*
pItem
)
{
...
...
@@ -2052,7 +2052,7 @@ int32_t getTableIndexImpl(SSQLToken* pTableToken, SQueryInfo* pQueryInfo, SColum
}
pIndex
->
tableIndex
=
COLUMN_INDEX_INITIAL_VAL
;
char
tableName
[
TSDB_TABLE_ID_LEN
+
1
]
=
{
0
};
char
tableName
[
TSDB_TABLE_ID_LEN
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
i
);
...
...
@@ -3616,7 +3616,7 @@ static int32_t setTableCondForSTableQuery(SQueryInfo* pQueryInfo, const char* ac
taosStringBuilderAppendStringLen
(
&
sb1
,
TBNAME_LIST_SEP
,
1
);
}
char
idBuf
[
TSDB_TABLE_ID_LEN
+
1
]
=
{
0
};
char
idBuf
[
TSDB_TABLE_ID_LEN
]
=
{
0
};
int32_t
xlen
=
strlen
(
segments
[
i
]);
SSQLToken
t
=
{.
z
=
segments
[
i
],
.
n
=
xlen
,
.
type
=
TK_STRING
};
...
...
@@ -5603,7 +5603,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
}
// get meter meta from mnode
strncpy
(
pCreateTable
->
usingInfo
.
tagdata
.
name
,
pStableMeterMetaInfo
->
name
,
TSDB_TABLE_ID_LEN
);
tstrncpy
(
pCreateTable
->
usingInfo
.
tagdata
.
name
,
pStableMeterMetaInfo
->
name
,
sizeof
(
pCreateTable
->
usingInfo
.
tagdata
.
name
)
);
tVariantList
*
pList
=
pInfo
->
pCreateTableInfo
->
usingInfo
.
pTagVals
;
int32_t
code
=
tscGetTableMeta
(
pSql
,
pStableMeterMetaInfo
);
...
...
src/client/src/tscServer.c
浏览文件 @
18bbbb31
...
...
@@ -1705,8 +1705,8 @@ int tscBuildSTableVgroupMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
i
);
strncpy
(
pMsg
,
pTableMetaInfo
->
name
,
TSDB_TABLE_ID_LEN
);
pMsg
+=
TSDB_TABLE_ID_LEN
;
tstrncpy
(
pMsg
,
pTableMetaInfo
->
name
,
sizeof
(
pTableMetaInfo
->
name
)
);
pMsg
+=
sizeof
(
pTableMetaInfo
->
name
)
;
}
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_STABLE_VGROUP
;
...
...
src/connector/python/linux/python2/taos/cinterface.py
浏览文件 @
18bbbb31
...
...
@@ -130,9 +130,9 @@ _CONVERT_FUNC = {
# Corresponding TAOS_FIELD structure in C
class
TaosField
(
ctypes
.
Structure
):
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
4
),
(
'
bytes'
,
ctypes
.
c_short
),
(
'
type'
,
ctypes
.
c_char
)]
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
5
),
(
'
type'
,
ctypes
.
c_char
),
(
'
bytes'
,
ctypes
.
c_short
)]
# C interface class
class
CTaosInterface
(
object
):
...
...
src/connector/python/windows/python2/taos/cinterface.py
浏览文件 @
18bbbb31
...
...
@@ -130,9 +130,9 @@ _CONVERT_FUNC = {
# Corresponding TAOS_FIELD structure in C
class
TaosField
(
ctypes
.
Structure
):
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
4
),
(
'
bytes'
,
ctypes
.
c_short
),
(
'
type'
,
ctypes
.
c_char
)]
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
5
),
(
'
type'
,
ctypes
.
c_char
),
(
'
bytes'
,
ctypes
.
c_short
)]
# C interface class
class
CTaosInterface
(
object
):
...
...
src/connector/python/windows/python3/taos/cinterface.py
浏览文件 @
18bbbb31
...
...
@@ -130,9 +130,9 @@ _CONVERT_FUNC = {
# Corresponding TAOS_FIELD structure in C
class
TaosField
(
ctypes
.
Structure
):
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
4
),
(
'
bytes'
,
ctypes
.
c_short
),
(
'
type'
,
ctypes
.
c_char
)]
_fields_
=
[(
'name'
,
ctypes
.
c_char
*
6
5
),
(
'
type'
,
ctypes
.
c_char
),
(
'
bytes'
,
ctypes
.
c_short
)]
# C interface class
class
CTaosInterface
(
object
):
...
...
src/inc/taosdef.h
浏览文件 @
18bbbb31
...
...
@@ -186,14 +186,14 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_BINARY_OP_MULTIPLY 14
#define TSDB_BINARY_OP_DIVIDE 15
#define TSDB_BINARY_OP_REMAINDER 16
#define TSDB_USERID_LEN 9
#define TS_PATH_DELIMITER_LEN 1
#define TSDB_METER_ID_LEN_MARGIN 8
#define TSDB_TABLE_ID_LEN (TSDB_DB_NAME_LEN+TSDB_TABLE_NAME_LEN+2*TS_PATH_DELIMITER_LEN+TSDB_USERID_LEN+TSDB_METER_ID_LEN_MARGIN) //TSDB_DB_NAME_LEN+TSDB_TABLE_NAME_LEN+2*strlen(TS_PATH_DELIMITER)+strlen(USERID)
#define TSDB_UNI_LEN 24
#define TSDB_USER_LEN TSDB_UNI_LEN
#define TSDB_ACCT_LEN TSDB_UNI_LEN
// ACCOUNT is a 32 bit positive integer
// this is the length of its string representation
// including the terminator zero
#define TSDB_ACCT_LEN 11
#define TSDB_PASSWORD_LEN TSDB_UNI_LEN
#define TSDB_MAX_COLUMNS 1024
...
...
@@ -202,13 +202,14 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_NODE_NAME_LEN 64
#define TSDB_TABLE_NAME_LEN 193
#define TSDB_DB_NAME_LEN 33
#define TSDB_TABLE_ID_LEN (TSDB_ACCT_LEN + TSDB_DB_NAME_LEN + TSDB_TABLE_NAME_LEN)
#define TSDB_COL_NAME_LEN 65
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
#define TSDB_MAX_SQL_SHOW_LEN 256
#define TSDB_MAX_ALLOWED_SQL_LEN (8*1024*1024U) // sql length should be less than 8mb
#define TSDB_MAX_BYTES_PER_ROW
TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_BYTES_PER_ROW
(TSDB_MAX_COLUMNS * 64)
#define TSDB_MAX_TAGS_LEN 65536
#define TSDB_MAX_TAGS 128
...
...
src/inc/taosmsg.h
浏览文件 @
18bbbb31
...
...
@@ -243,13 +243,13 @@ typedef struct {
uint64_t
uid
;
uint64_t
superTableUid
;
uint64_t
createdTime
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
superTableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
char
superTableId
[
TSDB_TABLE_ID_LEN
];
char
data
[];
}
SMDCreateTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
int8_t
igExists
;
int8_t
getMeta
;
...
...
@@ -262,12 +262,12 @@ typedef struct {
}
SCMCreateTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
int8_t
igNotExists
;
}
SCMDropTableMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
int16_t
type
;
/* operation type */
int16_t
numOfCols
;
/* number of schema */
...
...
@@ -292,7 +292,7 @@ typedef struct {
typedef
struct
{
char
clientVersion
[
TSDB_VERSION_LEN
];
char
msgVersion
[
TSDB_VERSION_LEN
];
char
db
[
TSDB_TABLE_ID_LEN
+
1
];
char
db
[
TSDB_TABLE_ID_LEN
];
}
SCMConnectMsg
;
typedef
struct
{
...
...
@@ -342,14 +342,14 @@ typedef struct {
int32_t
vgId
;
int32_t
sid
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
}
SMDDropTableMsg
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
}
SMDDropSTableMsg
;
typedef
struct
{
...
...
@@ -521,7 +521,7 @@ typedef struct {
}
SCMCreateDbMsg
,
SCMAlterDbMsg
;
typedef
struct
{
char
db
[
TSDB_TABLE_ID_LEN
+
1
];
char
db
[
TSDB_TABLE_ID_LEN
];
uint8_t
ignoreNotExists
;
}
SCMDropDbMsg
,
SCMUseDbMsg
;
...
...
@@ -612,7 +612,7 @@ typedef struct {
}
SMDCreateVnodeMsg
;
typedef
struct
{
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
int16_t
createFlag
;
char
tags
[];
}
SCMTableInfoMsg
;
...
...
@@ -639,7 +639,7 @@ typedef struct {
typedef
struct
STableMetaMsg
{
int32_t
contLen
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
// table id
char
tableId
[
TSDB_TABLE_ID_LEN
];
// table id
uint8_t
numOfTags
;
uint8_t
precision
;
uint8_t
tableType
;
...
...
@@ -660,7 +660,7 @@ typedef struct SMultiTableMeta {
typedef
struct
{
int32_t
dataLen
;
char
name
[
TSDB_TABLE_ID_LEN
+
1
];
char
name
[
TSDB_TABLE_ID_LEN
];
char
data
[
TSDB_MAX_TAGS_LEN
];
}
STagData
;
...
...
@@ -746,7 +746,7 @@ typedef struct {
uint64_t
uid
;
uint64_t
stime
;
// stream starting time
int32_t
status
;
char
tableId
[
TSDB_TABLE_ID_LEN
+
1
];
char
tableId
[
TSDB_TABLE_ID_LEN
];
}
SMDAlterStreamMsg
;
typedef
struct
{
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
18bbbb31
...
...
@@ -201,7 +201,7 @@ static int32_t mnodeChildTableActionEncode(SSdbOper *pOper) {
assert
(
pTable
!=
NULL
&&
pOper
->
rowData
!=
NULL
);
int32_t
len
=
strlen
(
pTable
->
info
.
tableId
);
if
(
len
>
TSDB_TABLE_ID_LEN
)
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
if
(
len
>
=
TSDB_TABLE_ID_LEN
)
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
memcpy
(
pOper
->
rowData
,
pTable
->
info
.
tableId
,
len
);
memset
(
pOper
->
rowData
+
len
,
0
,
1
);
...
...
@@ -232,7 +232,7 @@ static int32_t mnodeChildTableActionDecode(SSdbOper *pOper) {
if
(
pTable
==
NULL
)
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
int32_t
len
=
strlen
(
pOper
->
rowData
);
if
(
len
>
TSDB_TABLE_ID_LEN
)
{
if
(
len
>
=
TSDB_TABLE_ID_LEN
)
{
free
(
pTable
);
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
}
...
...
@@ -453,7 +453,7 @@ static int32_t mnodeSuperTableActionEncode(SSdbOper *pOper) {
assert
(
pOper
->
pObj
!=
NULL
&&
pOper
->
rowData
!=
NULL
);
int32_t
len
=
strlen
(
pStable
->
info
.
tableId
);
if
(
len
>
TSDB_TABLE_ID_LEN
)
len
=
TSDB_CODE_MND_INVALID_TABLE_ID
;
if
(
len
>
=
TSDB_TABLE_ID_LEN
)
len
=
TSDB_CODE_MND_INVALID_TABLE_ID
;
memcpy
(
pOper
->
rowData
,
pStable
->
info
.
tableId
,
len
);
memset
(
pOper
->
rowData
+
len
,
0
,
1
);
...
...
@@ -477,7 +477,7 @@ static int32_t mnodeSuperTableActionDecode(SSdbOper *pOper) {
if
(
pStable
==
NULL
)
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
int32_t
len
=
strlen
(
pOper
->
rowData
);
if
(
len
>
TSDB_TABLE_ID_LEN
){
if
(
len
>
=
TSDB_TABLE_ID_LEN
){
free
(
pStable
);
return
TSDB_CODE_MND_INVALID_TABLE_ID
;
}
...
...
@@ -1249,7 +1249,7 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
pMeta
->
numOfColumns
=
htons
((
int16_t
)
pTable
->
numOfColumns
);
pMeta
->
tableType
=
pTable
->
info
.
type
;
pMeta
->
contLen
=
sizeof
(
STableMetaMsg
)
+
mnodeSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
);
strncpy
(
pMeta
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_ID_LEN
);
tstrncpy
(
pMeta
->
tableId
,
pTable
->
info
.
tableId
,
sizeof
(
pMeta
->
tableId
)
);
pMeta
->
contLen
=
htons
(
pMeta
->
contLen
);
...
...
@@ -2032,7 +2032,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
pMultiMeta
->
numOfTables
=
0
;
for
(
int32_t
t
=
0
;
t
<
pInfo
->
numOfTables
;
++
t
)
{
char
*
tableId
=
(
char
*
)(
pInfo
->
tableIds
+
t
*
TSDB_TABLE_ID_LEN
+
1
);
char
*
tableId
=
(
char
*
)(
pInfo
->
tableIds
+
t
*
TSDB_TABLE_ID_LEN
);
SChildTableObj
*
pTable
=
mnodeGetChildTable
(
tableId
);
if
(
pTable
==
NULL
)
continue
;
...
...
src/plugins/http/src/httpAuth.c
浏览文件 @
18bbbb31
...
...
@@ -100,14 +100,15 @@ bool httpParseTaosdAuthToken(HttpContext *pContext, char *token, int len) {
}
bool
httpGenTaosdAuthToken
(
HttpContext
*
pContext
,
char
*
token
,
int
maxLen
)
{
char
buffer
[
TSDB_USER_LEN
+
TSDB_PASSWORD_LEN
]
=
{
0
};
strncpy
(
buffer
,
pContext
->
user
,
sizeof
(
pContext
->
user
));
strncpy
(
buffer
+
TSDB_USER_LEN
,
pContext
->
pass
,
sizeof
(
pContext
->
pass
));
char
buffer
[
sizeof
(
pContext
->
user
)
+
sizeof
(
pContext
->
pass
)
]
=
{
0
};
t
strncpy
(
buffer
,
pContext
->
user
,
sizeof
(
pContext
->
user
));
tstrncpy
(
buffer
+
sizeof
(
pContext
->
user
)
,
pContext
->
pass
,
sizeof
(
pContext
->
pass
));
char
*
encrypt
=
taosDesEncode
(
KEY_DES_4
,
buffer
,
TSDB_USER_LEN
+
TSDB_PASSWORD_LEN
);
char
*
base64
=
base64_encode
((
const
unsigned
char
*
)
encrypt
,
TSDB_USER_LEN
+
TSDB_PASSWORD_LEN
);
strncpy
(
token
,
base64
,
(
size_t
)
strlen
(
base64
));
size_t
len
=
strlen
(
base64
);
tstrncpy
(
token
,
base64
,
len
+
1
);
free
(
encrypt
);
free
(
base64
);
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
18bbbb31
...
...
@@ -183,7 +183,7 @@ static void dnodeBuildMonitorSql(char *sql, int32_t cmd) {
snprintf
(
sql
,
SQL_LENGTH
,
"create table if not exists %s.slowquery(ts timestamp, username "
"binary(%d), created_time timestamp, time bigint, sql binary(%d))"
,
tsMonitorDbName
,
TSDB_TABLE_ID_LEN
,
TSDB_SLOW_QUERY_SQL_LEN
);
tsMonitorDbName
,
TSDB_TABLE_ID_LEN
-
1
,
TSDB_SLOW_QUERY_SQL_LEN
);
}
else
if
(
cmd
==
MONITOR_CMD_CREATE_TB_LOG
)
{
snprintf
(
sql
,
SQL_LENGTH
,
"create table if not exists %s.log(ts timestamp, level tinyint, "
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录