Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
ff7aec3b
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff7aec3b
编写于
7月 20, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve log & memory allocation check
上级
3b86cd12
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
2 deletion
+27
-2
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+27
-2
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
ff7aec3b
...
...
@@ -540,7 +540,8 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) {
return
0
;
}
static
int32_t
getChildTableName
(
TAOS_SML_DATA_POINT
*
point
,
char
*
tableName
,
int
*
tableNameLen
)
{
static
int32_t
getSmlMd5ChildTableName
(
TAOS_SML_DATA_POINT
*
point
,
char
*
tableName
,
int
*
tableNameLen
)
{
tscDebug
(
"taos_sml_insert get child table name through md5"
);
qsort
(
point
->
tags
,
point
->
tagNum
,
sizeof
(
TAOS_SML_KV
),
compareSmlColKv
);
SStringBuilder
sb
;
memset
(
&
sb
,
0
,
sizeof
(
sb
));
...
...
@@ -694,7 +695,7 @@ static int32_t arrangePointsByChildTableName(TAOS_SML_DATA_POINT* points, int nu
if
(
!
point
->
childTableName
)
{
char
childTableName
[
TSDB_TABLE_NAME_LEN
];
int32_t
tableNameLen
=
TSDB_TABLE_NAME_LEN
;
getChildTableName
(
point
,
childTableName
,
&
tableNameLen
);
get
SmlMd5
ChildTableName
(
point
,
childTableName
,
&
tableNameLen
);
point
->
childTableName
=
calloc
(
1
,
tableNameLen
+
1
);
strncpy
(
point
->
childTableName
,
childTableName
,
tableNameLen
);
point
->
childTableName
[
tableNameLen
]
=
'\0'
;
...
...
@@ -774,6 +775,10 @@ static int32_t insertPoints(TAOS* taos, TAOS_SML_DATA_POINT* points, int32_t num
point
=
taosArrayGetP
(
cTablePoints
,
i
);
TAOS_BIND
*
colBinds
=
calloc
(
numCols
,
sizeof
(
TAOS_BIND
));
if
(
colBinds
==
NULL
)
{
tscError
(
"taos_sml_insert insert points, failed to allocated memory for TAOS_BIND, "
"num of rows: %zu, num of cols: %zu"
,
rows
,
numCols
);
}
for
(
int
j
=
0
;
j
<
numCols
;
++
j
)
{
TAOS_BIND
*
bind
=
colBinds
+
j
;
bind
->
is_null
=
&
isNullColBind
;
...
...
@@ -1815,8 +1820,27 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
)
{
int32_t
code
=
0
;
if
(
numLines
<=
0
)
{
tscError
(
"taos_insert_lines numLines should be greater than zero. numLines: %d"
,
numLines
);
code
=
TSDB_CODE_TSC_APP_ERROR
;
return
code
;
}
for
(
int
i
=
0
;
i
<
numLines
;
++
i
)
{
if
(
lines
[
i
]
==
NULL
)
{
tscError
(
"taos_insert_lines line %d is NULL"
,
i
);
code
=
TSDB_CODE_TSC_APP_ERROR
;
return
code
;
}
}
SArray
*
lpPoints
=
taosArrayInit
(
numLines
,
sizeof
(
TAOS_SML_DATA_POINT
));
if
(
lpPoints
==
NULL
)
{
tscError
(
"taos_insert_lines failed to allocate memory"
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
tscDebug
(
"taos_insert_lines begin inserting %d lines, first line: %s"
,
numLines
,
lines
[
0
]);
code
=
tscParseLines
(
lines
,
numLines
,
lpPoints
,
NULL
);
size_t
numPoints
=
taosArrayGetSize
(
lpPoints
);
...
...
@@ -1831,6 +1855,7 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines) {
}
cleanup:
tscDebug
(
"taos_insert_lines finish inserting %d lines. code: %d"
,
numLines
,
code
);
for
(
int
i
=
0
;
i
<
numPoints
;
++
i
)
{
destroySmlDataPoint
(
points
+
i
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录