Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e54e12ef
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e54e12ef
编写于
3月 04, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:give error if col is same in schemless & fix json parse error in TD-22903
上级
50955b2e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
66 addition
and
6 deletion
+66
-6
source/client/src/clientSml.c
source/client/src/clientSml.c
+2
-0
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+1
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-0
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+1
-1
utils/test/c/sml_test.c
utils/test/c/sml_test.c
+61
-4
未找到文件。
source/client/src/clientSml.c
浏览文件 @
e54e12ef
...
...
@@ -1141,6 +1141,7 @@ static int32_t smlPushCols(SArray *colsArray, SArray *cols) {
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
cols
);
i
++
)
{
SSmlKv
*
kv
=
(
SSmlKv
*
)
taosArrayGet
(
cols
,
i
);
taosHashPut
(
kvHash
,
kv
->
key
,
kv
->
keyLen
,
&
kv
,
POINTER_BYTES
);
if
(
terrno
==
TSDB_CODE_DUP_KEY
){
return
terrno
;}
}
taosArrayPush
(
colsArray
,
&
kvHash
);
...
...
@@ -1204,6 +1205,7 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
SSmlSTableMeta
*
meta
=
smlBuildSTableMeta
(
info
->
dataFormat
);
smlInsertMeta
(
meta
->
tagHash
,
meta
->
tags
,
tinfo
->
tags
);
if
(
terrno
==
TSDB_CODE_DUP_KEY
){
return
terrno
;}
smlInsertMeta
(
meta
->
colHash
,
meta
->
cols
,
elements
->
colArray
);
taosHashPut
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
&
meta
,
POINTER_BYTES
);
}
...
...
source/client/src/clientSmlJson.c
浏览文件 @
e54e12ef
...
...
@@ -1214,7 +1214,7 @@ static int32_t smlParseJSONString(SSmlHandle *info, char **start, SSmlLineInfo *
return
TSDB_CODE_INVALID_TIMESTAMP
;
}
else
if
(
elements
->
timestamp
[
0
]
==
'{'
)
{
char
tmp
=
elements
->
timestamp
[
elements
->
timestampLen
];
elements
->
cols
[
elements
->
timestampLen
]
=
'\0'
;
elements
->
timestamp
[
elements
->
timestampLen
]
=
'\0'
;
cJSON
*
tsJson
=
cJSON_Parse
(
elements
->
timestamp
);
ts
=
smlParseTSFromJSON
(
info
,
tsJson
);
if
(
unlikely
(
ts
<
0
))
{
...
...
source/common/src/tglobal.c
浏览文件 @
e54e12ef
...
...
@@ -1246,6 +1246,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
taosSetAllDebugFlag
(
cfgGetItem
(
pCfg
,
"debugFlag"
)
->
i32
,
false
);
if
(
taosMulModeMkDir
(
tsLogDir
,
0777
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to create dir:%s since %s"
,
tsLogDir
,
terrstr
());
cfgCleanup
(
pCfg
);
return
-
1
;
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
e54e12ef
...
...
@@ -292,7 +292,7 @@ void vnodeProposeWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs)
code
=
vnodePreProcessWriteMsg
(
pVnode
,
pMsg
);
if
(
code
!=
0
)
{
vGError
(
"vgId:%d, msg:%p failed to pre-process since %s"
,
vgId
,
pMsg
,
t
errstr
(
));
vGError
(
"vgId:%d, msg:%p failed to pre-process since %s"
,
vgId
,
pMsg
,
t
strerror
(
code
));
if
(
terrno
!=
0
)
code
=
terrno
;
vnodeHandleProposeError
(
pVnode
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
utils/test/c/sml_test.c
浏览文件 @
e54e12ef
...
...
@@ -137,6 +137,8 @@ int smlProcess_json1_Test() {
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
taosMemoryFree
(
sql1
[
i
]);
}
ASSERT
(
code
==
0
);
const
char
*
sql2
[]
=
{
"[{
\"
metric
\"
:
\"
sys.cpu.nice
\"
,
\"
timestamp
\"
:1662344041,
\"
value
\"
:13,
\"
tags
\"
:{
\"
host
\"
:
\"
web01
\"
,
\"
dc
\"
:
\"
lga
\"
}"
...
...
@@ -164,6 +166,34 @@ int smlProcess_json1_Test() {
taosMemoryFree
(
sql3
[
i
]);
}
ASSERT
(
code
==
0
);
// TD-22903
const
char
*
sql4
[]
=
{
"[{
\"
metric
\"
:
\"
test_us
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833639,
\"
type
\"
:
\"
ms
\"
},
\"
value
\"
: true,
\"
tags
\"
: {
\"
t0
\"
: true}}, {
\"
metric
\"
:
\"
test_us
\"
,
\"
timestamp
\"
: {
\"
value
\"
: 1626006833638,
\"
type
\"
:
\"
ms
\"
},
\"
value
\"
: false,
\"
tags
\"
: {
\"
t0
\"
: true}}]"
};
char
*
sql5
[
1
]
=
{
0
};
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
sql5
[
i
]
=
taosMemoryCalloc
(
1
,
1024
);
strncpy
(
sql5
[
i
],
sql4
[
i
],
1023
);
}
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql5
,
sizeof
(
sql5
)
/
sizeof
(
sql5
[
0
]),
TSDB_SML_JSON_PROTOCOL
,
TSDB_SML_TIMESTAMP_NANO_SECONDS
);
code
=
taos_errno
(
pRes
);
if
(
code
!=
0
)
{
printf
(
"%s result:%s
\n
"
,
__FUNCTION__
,
taos_errstr
(
pRes
));
}
else
{
printf
(
"%s result:success
\n
"
,
__FUNCTION__
);
}
taos_free_result
(
pRes
);
for
(
int
i
=
0
;
i
<
1
;
i
++
)
{
taosMemoryFree
(
sql5
[
i
]);
}
ASSERT
(
code
==
0
);
taos_close
(
taos
);
return
code
;
...
...
@@ -927,6 +957,31 @@ int sml_ts2164_Test() {
return
code
;
}
int
sml_td22900_Test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"CREATE DATABASE IF NOT EXISTS line_test BUFFER 384 MINROWS 1000 PAGES 256 PRECISION 'ns'"
);
taos_free_result
(
pRes
);
const
char
*
sql
[]
=
{
"qddkgilwfu,id=qddkgilwfu_42383_49198,t0=t,t1=127i8 c4=9223372036854775807i64,c6=11.12345f32,c6=22.123456789f64 1626006833639"
};
pRes
=
taos_query
(
taos
,
"use line_test"
);
taos_free_result
(
pRes
);
pRes
=
taos_schemaless_insert
(
taos
,
(
char
**
)
sql
,
sizeof
(
sql
)
/
sizeof
(
sql
[
0
]),
TSDB_SML_LINE_PROTOCOL
,
TSDB_SML_TIMESTAMP_MILLI_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
);
...
...
@@ -1096,16 +1151,18 @@ int main(int argc, char *argv[]) {
}
int
ret
=
0
;
ret
=
sml_ts2385_Test
();
// this test case need config sml table name using ./sml_test config_file
ASSERT
(
!
ret
);
//
ret = sml_ts2385_Test(); // this test case need config sml table name using ./sml_test config_file
//
ASSERT(!ret);
// for(int i = 0; i < sizeof(str)/sizeof(str[0]); i++){
// printf("str:%s \t %d\n", str[i], smlCalTypeSum(str[i], strlen(str[i])));
// }
// int ret = 0;
ret
=
sml_ttl_Test
();
ASSERT
(
!
ret
);
//
ret = sml_ttl_Test();
//
ASSERT(!ret);
ret
=
sml_ts2164_Test
();
ASSERT
(
!
ret
);
ret
=
sml_td22900_Test
();
ASSERT
(
ret
);
ret
=
smlProcess_influx_Test
();
ASSERT
(
!
ret
);
ret
=
smlProcess_telnet_Test
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录