Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
5e8969d6
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看板
提交
5e8969d6
编写于
6月 04, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
td-459: TSDB_TABLE_NAME_LEN
上级
b2996fe1
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
49 addition
and
51 deletion
+49
-51
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+4
-4
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-3
src/common/src/tname.c
src/common/src/tname.c
+1
-2
src/inc/taosdef.h
src/inc/taosdef.h
+2
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+14
-14
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+2
-2
src/plugins/http/src/tgHandle.c
src/plugins/http/src/tgHandle.c
+3
-3
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-5
src/query/src/qast.c
src/query/src/qast.c
+2
-2
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+2
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+1
-1
src/util/src/tutil.c
src/util/src/tutil.c
+4
-4
tests/pytest/table/boundary.py
tests/pytest/table/boundary.py
+4
-4
tests/pytest/table/tablename-boundary.py
tests/pytest/table/tablename-boundary.py
+1
-3
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
5e8969d6
...
...
@@ -348,7 +348,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
pToken
->
n
>
TSDB_TABLE_NAME_LEN
)
{
if
(
pToken
->
n
>
=
TSDB_TABLE_NAME_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -1401,7 +1401,7 @@ int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pI
}
if
(
index
.
columnIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
SSchema
colSchema
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
};
SSchema
colSchema
=
{.
type
=
TSDB_DATA_TYPE_BINARY
,
.
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
};
strcpy
(
colSchema
.
name
,
TSQL_TBNAME_L
);
tscAddSpecialColumnForSelect
(
pQueryInfo
,
startPos
,
TSDB_FUNC_TAGPRJ
,
&
index
,
&
colSchema
,
true
);
...
...
@@ -2229,7 +2229,7 @@ int32_t setShowInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
}
if
(
pCmd
->
payloadLen
>
TSDB_TABLE_NAME_LEN
)
{
if
(
pCmd
->
payloadLen
>
=
TSDB_TABLE_NAME_LEN
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
...
...
@@ -5232,7 +5232,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
int16_t
colIndex
=
pColIndex
->
colIndex
;
if
(
colIndex
==
TSDB_TBNAME_COLUMN_INDEX
)
{
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
// todo extract method
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
// todo extract method
name
=
TSQL_TBNAME_L
;
}
else
{
if
(
TSDB_COL_IS_TAG
(
pColIndex
->
flag
))
{
...
...
src/client/src/tscServer.c
浏览文件 @
5e8969d6
...
...
@@ -1430,9 +1430,9 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
char
*
db
;
// ugly code to move the space
db
=
strstr
(
pObj
->
db
,
TS_PATH_DELIMITER
);
db
=
(
db
==
NULL
)
?
pObj
->
db
:
db
+
1
;
strcpy
(
pConnect
->
db
,
db
);
strcpy
(
pConnect
->
clientVersion
,
version
);
strcpy
(
pConnect
->
msgVersion
,
""
);
tstrncpy
(
pConnect
->
db
,
db
,
sizeof
(
pConnect
->
db
)
);
tstrncpy
(
pConnect
->
clientVersion
,
version
,
sizeof
(
pConnect
->
clientVersion
)
);
tstrncpy
(
pConnect
->
msgVersion
,
""
,
sizeof
(
pConnect
->
msgVersion
)
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/common/src/tname.c
浏览文件 @
5e8969d6
...
...
@@ -28,8 +28,7 @@ void extractTableName(const char* tableId, char* name) {
size_t
s1
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
size_t
s2
=
strcspn
(
&
tableId
[
s1
+
1
],
&
TS_PATH_DELIMITER
[
0
]);
strncpy
(
name
,
&
tableId
[
s1
+
s2
+
2
],
TSDB_TABLE_NAME_LEN
);
name
[
TSDB_TABLE_NAME_LEN
]
=
0
;
tstrncpy
(
name
,
&
tableId
[
s1
+
s2
+
2
],
TSDB_TABLE_NAME_LEN
);
}
char
*
extractDBName
(
const
char
*
tableId
,
char
*
name
)
{
...
...
src/inc/taosdef.h
浏览文件 @
5e8969d6
...
...
@@ -189,7 +189,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_USERID_LEN 9
#define TS_PATH_DELIMITER_LEN 1
#define TSDB_METER_ID_LEN_MARGIN
10
#define TSDB_METER_ID_LEN_MARGIN
9
#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
...
...
@@ -200,7 +200,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns
#define TSDB_NODE_NAME_LEN 64
#define TSDB_TABLE_NAME_LEN 19
2
#define TSDB_TABLE_NAME_LEN 19
3
#define TSDB_DB_NAME_LEN 32
#define TSDB_COL_NAME_LEN 64
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
5e8969d6
...
...
@@ -1078,7 +1078,7 @@ static int32_t mnodeGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow,
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -1138,7 +1138,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
prefixLen
=
strlen
(
prefix
);
SPatternCompareInfo
info
=
PATTERN_COMPARE_INFO_INITIALIZER
;
char
stableName
[
TSDB_TABLE_NAME_LEN
+
1
]
=
{
0
};
char
stableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
mnodeGetNextSuperTable
(
pShow
->
pIter
,
&
pTable
);
...
...
@@ -1151,7 +1151,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
memset
(
stableName
,
0
,
tListLen
(
stableName
));
mnodeExtractTableName
(
pTable
->
info
.
tableId
,
stableName
);
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
stableName
,
TSDB_TABLE_NAME_LEN
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
stableName
,
sizeof
(
stableName
)
-
1
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
mnodeDecTableRef
(
pTable
);
continue
;
}
...
...
@@ -2079,7 +2079,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"table_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -2097,7 +2097,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -2141,12 +2141,12 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
continue
;
}
char
tableName
[
TSDB_TABLE_NAME_LEN
+
1
]
=
{
0
};
char
tableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
// pattern compare for table name
mnodeExtractTableName
(
pTable
->
info
.
tableId
,
tableName
);
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
tableName
,
TSDB_TABLE_NAME_LEN
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
tableName
,
sizeof
(
tableName
)
-
1
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
mnodeDecTableRef
(
pTable
);
continue
;
}
...
...
@@ -2155,7 +2155,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
char
*
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
TSDB_TABLE_NAME_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -2173,10 +2173,10 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
memset
(
tableName
,
0
,
tListLen
(
tableName
));
memset
(
tableName
,
0
,
sizeof
(
tableName
));
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
mnodeExtractTableName
(
pTable
->
superTable
->
info
.
tableId
,
tableName
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
TSDB_TABLE_NAME_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
}
cols
++
;
...
...
@@ -2268,7 +2268,7 @@ static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, vo
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pShow
->
bytes
[
cols
]
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"table_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -2331,12 +2331,12 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
continue
;
}
char
tableName
[
TSDB_TABLE_NAME_LEN
+
1
]
=
{
0
};
char
tableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
// pattern compare for table name
mnodeExtractTableName
(
pTable
->
info
.
tableId
,
tableName
);
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
tableName
,
TSDB_TABLE_NAME_LEN
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
if
(
pShow
->
payloadLen
>
0
&&
patternMatch
(
pShow
->
payload
,
tableName
,
sizeof
(
tableName
)
-
1
,
&
info
)
!=
TSDB_PATTERN_MATCH
)
{
mnodeDecTableRef
(
pTable
);
continue
;
}
...
...
@@ -2345,7 +2345,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
char
*
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
TSDB_TABLE_NAME_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
5e8969d6
...
...
@@ -307,7 +307,7 @@ void httpTrimTableName(char *name) {
for
(
int
i
=
0
;
name
[
i
]
!=
0
;
i
++
)
{
if
(
name
[
i
]
==
' '
||
name
[
i
]
==
':'
||
name
[
i
]
==
'.'
||
name
[
i
]
==
'-'
||
name
[
i
]
==
'/'
||
name
[
i
]
==
'\''
)
name
[
i
]
=
'_'
;
if
(
i
==
TSDB_TABLE_NAME_LEN
+
1
)
{
if
(
i
==
TSDB_TABLE_NAME_LEN
)
{
name
[
i
]
=
0
;
break
;
}
...
...
@@ -323,7 +323,7 @@ int httpShrinkTableName(HttpContext *pContext, int pos, char *name) {
len
++
;
}
if
(
len
<
TSDB_TABLE_NAME_LEN
)
{
if
(
len
<
TSDB_TABLE_NAME_LEN
-
1
)
{
return
pos
;
}
...
...
src/plugins/http/src/tgHandle.c
浏览文件 @
5e8969d6
...
...
@@ -209,7 +209,7 @@ void tgParseSchemaMetric(cJSON *metric) {
goto
ParseEnd
;
}
int
nameLen
=
(
int
)
strlen
(
field
->
valuestring
);
if
(
nameLen
==
0
||
nameLen
>
TSDB_TABLE_NAME_LEN
)
{
if
(
nameLen
==
0
||
nameLen
>
=
TSDB_TABLE_NAME_LEN
)
{
parsedOk
=
false
;
goto
ParseEnd
;
}
...
...
@@ -409,7 +409,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
httpSendErrorResp
(
pContext
,
HTTP_TG_METRIC_NAME_NULL
);
return
false
;
}
if
(
nameLen
>=
TSDB_TABLE_NAME_LEN
-
7
)
{
if
(
nameLen
>=
TSDB_TABLE_NAME_LEN
-
8
)
{
httpSendErrorResp
(
pContext
,
HTTP_TG_METRIC_NAME_LONG
);
return
false
;
}
...
...
@@ -498,7 +498,7 @@ bool tgProcessSingleMetric(HttpContext *pContext, cJSON *metric, char *db) {
return
false
;
}
if
(
strlen
(
host
->
valuestring
)
>=
TSDB_TABLE_NAME_LEN
)
{
if
(
strlen
(
host
->
valuestring
)
>=
TSDB_TABLE_NAME_LEN
-
1
)
{
httpSendErrorResp
(
pContext
,
HTTP_TG_TABLE_SIZE
);
return
false
;
}
...
...
src/query/src/qExecutor.c
浏览文件 @
5e8969d6
...
...
@@ -1368,7 +1368,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
int32_t
index
=
pSqlFuncMsg
->
colInfo
.
colIndex
;
if
(
TSDB_COL_IS_TAG
(
pIndex
->
flag
))
{
if
(
pIndex
->
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
// todo refactor
pCtx
->
inputBytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pCtx
->
inputBytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pCtx
->
inputType
=
TSDB_DATA_TYPE_BINARY
;
}
else
{
pCtx
->
inputBytes
=
pQuery
->
tagColList
[
index
].
bytes
;
...
...
@@ -5148,8 +5148,8 @@ static int32_t createQFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo *
bytes
=
tDataTypeDesc
[
type
].
nSize
;
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
&&
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TAGPRJ
)
{
// parse the normal column
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
}
else
{
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
}
else
{
int32_t
j
=
getColumnIndexInSource
(
pQueryMsg
,
&
pExprs
[
i
].
base
,
pTagCols
);
assert
(
j
<
pQueryMsg
->
numOfCols
||
j
<
pQueryMsg
->
numOfTags
||
j
==
TSDB_TBNAME_COLUMN_INDEX
);
...
...
@@ -6037,8 +6037,9 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutput
;
++
j
)
{
if
(
pExprInfo
[
j
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
char
*
data
=
tsdbGetTableName
(
pQInfo
->
tsdb
,
&
item
->
id
);
char
*
dst
=
pQuery
->
sdata
[
j
]
->
data
+
count
*
(
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
);
data
=
tsdbGetTableName
(
pQInfo
->
tsdb
,
&
item
->
id
,
&
bytes
);
char
*
dst
=
pQuery
->
sdata
[
j
]
->
data
+
i
*
((
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
);
memcpy
(
dst
,
data
,
varDataTLen
(
data
));
}
else
{
// todo refactor
int16_t
type
=
pExprInfo
[
j
].
type
;
...
...
src/query/src/qast.c
浏览文件 @
5e8969d6
...
...
@@ -138,7 +138,7 @@ static tExprNode *tExprNodeCreate(SSchema *pSchema, int32_t numOfCols, SSQLToken
memcpy
(
pNode
->
pSchema
,
&
pSchema
[
i
],
sizeof
(
SSchema
));
}
else
{
pNode
->
pSchema
->
type
=
TSDB_DATA_TYPE_BINARY
;
pNode
->
pSchema
->
bytes
=
TSDB_TABLE_NAME_LEN
;
pNode
->
pSchema
->
bytes
=
TSDB_TABLE_NAME_LEN
-
1
;
strcpy
(
pNode
->
pSchema
->
name
,
TSQL_TBNAME_L
);
pNode
->
pSchema
->
colId
=
-
1
;
}
...
...
@@ -1127,7 +1127,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
left
->
pSchema
=
pSchema
;
pSchema
->
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
->
bytes
=
TSDB_TABLE_NAME_LEN
;
pSchema
->
bytes
=
TSDB_TABLE_NAME_LEN
-
1
;
strcpy
(
pSchema
->
name
,
TSQL_TBNAME_L
);
pSchema
->
colId
=
-
1
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
5e8969d6
...
...
@@ -334,7 +334,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
pTable
->
schema
[
0
]
=
tdDupSchema
(
pCfg
->
schema
);
pTable
->
tagSchema
=
tdDupSchema
(
pCfg
->
tagSchema
);
tsize
=
strnlen
(
pCfg
->
sname
,
TSDB_TABLE_NAME_LEN
);
tsize
=
strnlen
(
pCfg
->
sname
,
TSDB_TABLE_NAME_LEN
-
1
);
pTable
->
name
=
calloc
(
1
,
tsize
+
VARSTR_HEADER_SIZE
+
1
);
if
(
pTable
->
name
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
...
...
@@ -355,7 +355,7 @@ static STable *tsdbNewTable(STableCfg *pCfg, bool isSuper) {
pTable
->
tableId
.
tid
=
pCfg
->
tableId
.
tid
;
pTable
->
lastKey
=
TSKEY_INITIAL_VAL
;
tsize
=
strnlen
(
pCfg
->
name
,
TSDB_TABLE_NAME_LEN
);
tsize
=
strnlen
(
pCfg
->
name
,
TSDB_TABLE_NAME_LEN
-
1
);
pTable
->
name
=
calloc
(
1
,
tsize
+
VARSTR_HEADER_SIZE
+
1
);
if
(
pTable
->
name
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
5e8969d6
...
...
@@ -2011,7 +2011,7 @@ int32_t tableGroupComparFn(const void *p1, const void *p2, const void *param) {
f1
=
(
char
*
)
pTable1
->
name
;
f2
=
(
char
*
)
pTable2
->
name
;
type
=
TSDB_DATA_TYPE_BINARY
;
bytes
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
}
else
{
STColumn
*
pCol
=
schemaColAt
(
pTableGroupSupp
->
pTagSchema
,
colIndex
);
bytes
=
pCol
->
bytes
;
...
...
src/util/src/tutil.c
浏览文件 @
5e8969d6
...
...
@@ -582,13 +582,13 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
}
int
taosCheckVersion
(
char
*
input_client_version
,
char
*
input_server_version
,
int
comparedSegments
)
{
char
client_version
[
64
]
=
{
0
};
char
server_version
[
64
]
=
{
0
};
char
client_version
[
TSDB_VERSION_LEN
]
=
{
0
};
char
server_version
[
TSDB_VERSION_LEN
]
=
{
0
};
int
clientVersionNumber
[
4
]
=
{
0
};
int
serverVersionNumber
[
4
]
=
{
0
};
strcpy
(
client_version
,
input_client_version
);
strcpy
(
server_version
,
input_server_version
);
tstrncpy
(
client_version
,
input_client_version
,
sizeof
(
client_version
)
);
tstrncpy
(
server_version
,
input_server_version
,
sizeof
(
server_version
)
);
if
(
!
taosGetVersionNumber
(
client_version
,
clientVersionNumber
))
{
uError
(
"invalid client version:%s"
,
client_version
);
...
...
tests/pytest/table/boundary.py
浏览文件 @
5e8969d6
...
...
@@ -96,14 +96,14 @@ class TDTestCase:
tdLog
.
notice
(
"table name max length is %d"
%
maxTableNameLen
)
# create a super table with name exceed max length
sname
=
self
.
generateString
(
maxTableNameLen
+
1
)
sname
=
self
.
generateString
(
maxTableNameLen
)
tdLog
.
info
(
"create a super table with length %d"
%
len
(
sname
))
tdSql
.
error
(
"create table %s (ts timestamp, value int) tags(id int)"
%
sname
)
# create a super table with name of max length
sname
=
self
.
generateString
(
maxTableNameLen
)
sname
=
self
.
generateString
(
maxTableNameLen
-
1
)
tdLog
.
info
(
"create a super table with length %d"
%
len
(
sname
))
tdSql
.
execute
(
"create table %s (ts timestamp, value int) tags(id int)"
%
...
...
@@ -113,12 +113,12 @@ class TDTestCase:
tdSql
.
checkRows
(
1
)
# create a child table with name exceed max length
name
=
self
.
generateString
(
maxTableNameLen
+
1
)
name
=
self
.
generateString
(
maxTableNameLen
)
tdLog
.
info
(
"create a child table with length %d"
%
len
(
name
))
tdSql
.
error
(
"create table %s using %s tags(0)"
%
(
name
,
sname
))
# create a child table with name of max length
name
=
self
.
generateString
(
maxTableNameLen
)
name
=
self
.
generateString
(
maxTableNameLen
-
1
)
tdLog
.
info
(
"create a child table with length %d"
%
len
(
name
))
tdSql
.
execute
(
"create table %s using %s tags(0)"
%
(
name
,
sname
))
tdSql
.
query
(
'show tables'
)
...
...
tests/pytest/table/tablename-boundary.py
浏览文件 @
5e8969d6
...
...
@@ -18,9 +18,7 @@ class TDTestCase:
tdSql
.
prepare
()
getTableNameLen
=
"grep -w '#define TSDB_TABLE_NAME_LEN' ../../src/inc/taosdef.h|awk '{print $3}'"
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
tableNameMaxLen
=
int
(
subprocess
.
check_output
(
getTableNameLen
,
shell
=
True
))
-
1
tdLog
.
info
(
"table name max length is %d"
%
tableNameMaxLen
)
chars
=
string
.
ascii_uppercase
+
string
.
ascii_lowercase
tb_name
=
''
.
join
(
random
.
choices
(
chars
,
k
=
tableNameMaxLen
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录