Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
杠杠峰
TDengine
提交
8f9a7727
TDengine
项目概览
杠杠峰
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8f9a7727
编写于
9月 26, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10491]<fix>: Unified schemaless table name length(<=192) and column name
length(<=64) boundaries.
上级
ccb2750c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
17 deletion
+25
-17
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+1
-1
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+10
-6
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+14
-10
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
8f9a7727
...
...
@@ -63,7 +63,7 @@ bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info);
bool
isValidInteger
(
char
*
str
);
bool
isValidFloat
(
char
*
str
);
int32_t
isValidChildTableName
(
const
char
*
pTbName
,
int16_t
len
);
int32_t
isValidChildTableName
(
const
char
*
pTbName
,
int16_t
len
,
SSmlLinesInfo
*
info
);
bool
convertSmlValueType
(
TAOS_SML_KV
*
pVal
,
char
*
value
,
uint16_t
len
,
SSmlLinesInfo
*
info
);
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
8f9a7727
...
...
@@ -1811,8 +1811,8 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_COL_NAME_LEN
)
{
tscError
(
"SML:0x%"
PRIx64
" Key field cannot exceeds 6
5
characters"
,
info
->
id
);
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
tscError
(
"SML:0x%"
PRIx64
" Key field cannot exceeds 6
4
characters"
,
info
->
id
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
//unescaped '=' identifies a tag key
...
...
@@ -1898,8 +1898,8 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
)
{
tscError
(
"SML:0x%"
PRIx64
" Measurement field cannot exceeds 19
3
characters"
,
info
->
id
);
if
(
len
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"SML:0x%"
PRIx64
" Measurement field cannot exceeds 19
2
characters"
,
info
->
id
);
free
(
pSml
->
stableName
);
pSml
->
stableName
=
NULL
;
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
...
...
@@ -1929,7 +1929,11 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
}
//Table name can only contain digits(0-9),alphebet(a-z),underscore(_)
int32_t
isValidChildTableName
(
const
char
*
pTbName
,
int16_t
len
)
{
int32_t
isValidChildTableName
(
const
char
*
pTbName
,
int16_t
len
,
SSmlLinesInfo
*
info
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"SML:0x%"
PRIx64
" child table name cannot exceeds 192 characters"
,
info
->
id
);
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
}
const
char
*
cur
=
pTbName
;
for
(
int
i
=
0
;
i
<
len
;
++
i
)
{
if
(
!
isdigit
(
cur
[
i
])
&&
!
isalpha
(
cur
[
i
])
&&
(
cur
[
i
]
!=
'_'
))
{
...
...
@@ -1975,7 +1979,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
}
if
(
!
isField
&&
(
strcasecmp
(
pkv
->
key
,
"ID"
)
==
0
)
&&
pkv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
);
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
,
info
);
if
(
ret
)
{
goto
error
;
}
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
8f9a7727
...
...
@@ -37,7 +37,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
const
char
*
cur
=
*
index
;
uint16_t
len
=
0
;
pSml
->
stableName
=
tcalloc
(
TSDB_TABLE_NAME_LEN
+
1
,
1
);
// +1 to avoid 1772 line over write
pSml
->
stableName
=
tcalloc
(
TSDB_TABLE_NAME_LEN
,
1
);
if
(
pSml
->
stableName
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
...
...
@@ -48,8 +48,8 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 19
3
characters"
,
info
->
id
);
if
(
len
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 19
2
characters"
,
info
->
id
);
tfree
(
pSml
->
stableName
);
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
}
...
...
@@ -171,7 +171,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
static
int32_t
parseTelnetTagKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
char
key
[
TSDB_COL_NAME_LEN
+
1
];
// +1 to avoid key[len] over write
char
key
[
TSDB_COL_NAME_LEN
];
uint16_t
len
=
0
;
//key field cannot start with digit
...
...
@@ -180,8 +180,8 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_COL_NAME_LEN
)
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds 6
5
characters"
,
info
->
id
);
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds 6
4
characters"
,
info
->
id
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
if
(
*
cur
==
' '
)
{
...
...
@@ -276,7 +276,7 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs,
return
ret
;
}
if
((
strcasecmp
(
pkv
->
key
,
"ID"
)
==
0
)
&&
pkv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
);
ret
=
isValidChildTableName
(
pkv
->
value
,
pkv
->
length
,
info
);
if
(
ret
)
{
return
ret
;
}
...
...
@@ -446,8 +446,8 @@ static int32_t parseMetricFromJSON(cJSON *root, TAOS_SML_DATA_POINT* pSml, SSmlL
}
size_t
stableLen
=
strlen
(
metric
->
valuestring
);
if
(
stableLen
>
TSDB_TABLE_NAME_LEN
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 19
3
characters in JSON"
,
info
->
id
);
if
(
stableLen
>
TSDB_TABLE_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 19
2
characters in JSON"
,
info
->
id
);
return
TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH
;
}
...
...
@@ -843,7 +843,7 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
cJSON
*
id
=
cJSON_GetObjectItem
(
tags
,
"ID"
);
if
(
id
!=
NULL
)
{
size_t
idLen
=
strlen
(
id
->
valuestring
);
ret
=
isValidChildTableName
(
id
->
valuestring
,
(
int16_t
)
idLen
);
ret
=
isValidChildTableName
(
id
->
valuestring
,
(
int16_t
)
idLen
,
info
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
...
...
@@ -880,6 +880,10 @@ static int32_t parseTagsFromJSON(cJSON *root, TAOS_SML_KV **pKVs, int *num_kvs,
}
//key
size_t
keyLen
=
strlen
(
tag
->
string
);
if
(
keyLen
>
TSDB_COL_NAME_LEN
-
1
)
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds 64 characters in JSON"
,
info
->
id
);
return
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
;
}
pkv
->
key
=
tcalloc
(
keyLen
+
1
,
sizeof
(
char
));
strncpy
(
pkv
->
key
,
tag
->
string
,
keyLen
);
//value
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录