Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
985d0003
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
985d0003
编写于
4月 27, 2023
作者:
H
Haojun Liao
提交者:
GitHub
4月 27, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21090 from taosdata/fix/TD-23881
fix:[TD-23881] check the max row's length in schemaless
上级
e1bd65ec
206c6270
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
2 deletion
+74
-2
source/client/src/clientSml.c
source/client/src/clientSml.c
+44
-1
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+1
-1
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+29
-0
未找到文件。
source/client/src/clientSml.c
浏览文件 @
985d0003
...
...
@@ -649,6 +649,17 @@ static int32_t smlBuildFieldsList(SSmlHandle *info, SSchema *schemaField, SHashO
field
->
bytes
=
getBytes
(
kv
->
type
,
kv
->
length
);
}
}
int32_t
maxLen
=
isTag
?
TSDB_MAX_TAGS_LEN
:
TSDB_MAX_BYTES_PER_ROW
;
int32_t
len
=
0
;
for
(
int
j
=
0
;
j
<
taosArrayGetSize
(
results
);
++
j
)
{
SField
*
field
=
taosArrayGet
(
results
,
j
);
len
+=
field
->
bytes
;
}
if
(
len
>
maxLen
){
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -781,11 +792,15 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
code
=
smlBuildFieldsList
(
info
,
NULL
,
NULL
,
sTableData
->
tags
,
pTags
,
0
,
true
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlBuildFieldsList tag1 failed. %s"
,
info
->
id
,
pName
.
tname
);
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
code
=
smlBuildFieldsList
(
info
,
NULL
,
NULL
,
sTableData
->
cols
,
pColumns
,
0
,
false
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlBuildFieldsList col1 failed. %s"
,
info
->
id
,
pName
.
tname
);
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
code
=
smlSendMetaMsg
(
info
,
&
pName
,
pColumns
,
pTags
,
NULL
,
SCHEMA_ACTION_CREATE_STABLE
);
...
...
@@ -837,6 +852,23 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
pTableMeta
->
tableInfo
.
numOfColumns
,
true
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlBuildFieldsList tag2 failed. %s"
,
info
->
id
,
pName
.
tname
);
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
if
(
taosArrayGetSize
(
pTags
)
+
pTableMeta
->
tableInfo
.
numOfColumns
>
TSDB_MAX_COLUMNS
)
{
uError
(
"SML:0x%"
PRIx64
" too many columns than 4096"
,
info
->
id
);
code
=
TSDB_CODE_PAR_TOO_MANY_COLUMNS
;
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
if
(
taosArrayGetSize
(
pTags
)
>
TSDB_MAX_TAGS
)
{
uError
(
"SML:0x%"
PRIx64
" too many tags than 128"
,
info
->
id
);
code
=
TSDB_CODE_PAR_INVALID_TAGS_NUM
;
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
...
...
@@ -891,6 +923,16 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
pTableMeta
->
tableInfo
.
numOfColumns
,
false
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlBuildFieldsList col2 failed. %s"
,
info
->
id
,
pName
.
tname
);
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
if
(
taosArrayGetSize
(
pColumns
)
+
pTableMeta
->
tableInfo
.
numOfTags
>
TSDB_MAX_COLUMNS
)
{
uError
(
"SML:0x%"
PRIx64
" too many columns than 4096"
,
info
->
id
);
code
=
TSDB_CODE_PAR_TOO_MANY_COLUMNS
;
taosArrayDestroy
(
pColumns
);
taosArrayDestroy
(
pTags
);
goto
end
;
}
...
...
@@ -1514,7 +1556,8 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL
do
{
code
=
smlModifyDBSchemas
(
info
);
if
(
code
==
0
||
code
==
TSDB_CODE_SML_INVALID_DATA
)
break
;
if
(
code
==
0
||
code
==
TSDB_CODE_SML_INVALID_DATA
||
code
==
TSDB_CODE_PAR_TOO_MANY_COLUMNS
||
code
==
TSDB_CODE_PAR_INVALID_TAGS_NUM
)
break
;
taosMsleep
(
100
);
uInfo
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas retry code:%s, times:%d"
,
info
->
id
,
tstrerror
(
code
),
retryNum
);
}
while
(
retryNum
++
<
taosHashGetSize
(
info
->
superTables
)
*
MAX_RETRY_TIMES
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
985d0003
...
...
@@ -575,7 +575,7 @@ static int32_t smlConvertJSONString(SSmlKv *pVal, char *typeStr, cJSON *value) {
uError
(
"OTD:invalid type(%s) for JSON String"
,
typeStr
);
return
TSDB_CODE_TSC_INVALID_JSON_TYPE
;
}
pVal
->
length
=
(
int16_t
)
strlen
(
value
->
valuestring
);
pVal
->
length
=
strlen
(
value
->
valuestring
);
if
(
pVal
->
type
==
TSDB_DATA_TYPE_BINARY
&&
pVal
->
length
>
TSDB_MAX_BINARY_LEN
-
VARSTR_HEADER_SIZE
)
{
return
TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN
;
...
...
utils/test/c/sml_test.c
浏览文件 @
985d0003
...
...
@@ -1132,6 +1132,33 @@ int sml_td22900_Test() {
return
code
;
}
int
sml_td23881_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"CREATE DATABASE IF NOT EXISTS line_23881 PRECISION 'ns'"
);
taos_free_result
(
pRes
);
char
tmp
[
16375
]
=
{
0
};
memset
(
tmp
,
'a'
,
16374
);
char
sql
[
102400
]
=
{
0
};
sprintf
(
sql
,
"lujixfvqor,t0=t c0=f,c1=
\"
%s
\"
,c2=
\"
%s
\"
,c3=
\"
%s
\"
,c4=
\"
wthvqxcsrlps
\"
1626006833639000000"
,
tmp
,
tmp
,
tmp
);
pRes
=
taos_query
(
taos
,
"use line_23881"
);
taos_free_result
(
pRes
);
int
totalRows
=
0
;
pRes
=
taos_schemaless_insert_raw
(
taos
,
sql
,
strlen
(
sql
),
&
totalRows
,
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
int
code
=
taos_errno
(
pRes
);
taos_free_result
(
pRes
);
taos_close
(
taos
);
return
code
;
}
int
sml_ttl_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
...
...
@@ -1301,6 +1328,8 @@ int main(int argc, char *argv[]) {
}
int
ret
=
0
;
ret
=
sml_td23881_Test
();
ASSERT
(
ret
);
ret
=
sml_escape_Test
();
ASSERT
(
!
ret
);
ret
=
sml_ts3116_Test
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录