Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9c1813dc
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看板
提交
9c1813dc
编写于
8月 30, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6442]<feature>: Support OpenTSDB telnet style data import format
上级
ea7ca9b2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
13 deletion
+21
-13
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+0
-2
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+17
-11
src/inc/taos.h
src/inc/taos.h
+2
-0
tests/examples/c/CMakeLists.txt
tests/examples/c/CMakeLists.txt
+2
-0
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
9c1813dc
...
...
@@ -53,13 +53,11 @@ typedef struct {
}
SSmlLinesInfo
;
int
tscSmlInsert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
,
SSmlLinesInfo
*
info
);
int
taos_sml_insert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
);
bool
checkDuplicateKey
(
char
*
key
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
);
int32_t
isValidChildTableName
(
const
char
*
pTbName
,
int16_t
len
);
bool
convertSmlValueType
(
TAOS_SML_KV
*
pVal
,
char
*
value
,
uint16_t
len
,
SSmlLinesInfo
*
info
);
int32_t
convertSmlTimeStamp
(
TAOS_SML_KV
*
pVal
,
char
*
value
,
uint16_t
len
,
SSmlLinesInfo
*
info
);
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
9c1813dc
...
...
@@ -11,8 +11,8 @@
#include "tscLog.h"
#include "tscParseLine.h"
//=========================================================================
/
/ telnet style API parser
/
* telnet style API parser */
static
uint64_t
HandleId
=
0
;
uint64_t
genUID
()
{
...
...
@@ -221,6 +221,7 @@ static bool parseTelnetTagValue(TAOS_SML_KV *pKV, const char **index,
}
free
(
value
);
*
index
=
(
*
cur
==
'\0'
)
?
cur
:
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -266,19 +267,16 @@ static int32_t parseTelnetTagKvs(TAOS_SML_KV **pKVs, int *num_kvs,
}
//reallocate addtional memory for more kvs
TAOS_SML_KV
*
more_kvs
=
NULL
;
if
((
*
num_kvs
+
1
)
>
capacity
)
{
TAOS_SML_KV
*
more_kvs
=
NULL
;
capacity
*=
3
;
capacity
/=
2
;
more_kvs
=
realloc
(
*
pKVs
,
capacity
*
sizeof
(
TAOS_SML_KV
));
}
else
{
more_kvs
=
*
pKVs
;
if
(
!
more_kvs
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
*
pKVs
=
more_kvs
;
}
if
(
!
more_kvs
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
*
pKVs
=
more_kvs
;
//move pKV points to next TAOS_SML_KV block
pkv
=
*
pKVs
+
*
num_kvs
;
}
...
...
@@ -316,7 +314,7 @@ int32_t tscParseTelnetLine(const char* line, TAOS_SML_DATA_POINT* smlData, SSmlL
//Parse tagKVs
SHashObj
*
keyHashTable
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
false
);
ret
=
parseTelnetTagKvs
(
&
smlData
->
fields
,
&
smlData
->
field
Num
,
&
index
,
smlData
->
childTableName
,
keyHashTable
,
info
);
ret
=
parseTelnetTagKvs
(
&
smlData
->
tags
,
&
smlData
->
tag
Num
,
&
index
,
smlData
->
childTableName
,
keyHashTable
,
info
);
if
(
ret
)
{
tscError
(
"SML:0x%"
PRIx64
" Unable to parse tags"
,
info
->
id
);
taosHashCleanup
(
keyHashTable
);
...
...
@@ -401,3 +399,11 @@ cleanup:
free
(
info
);
return
code
;
}
int
taos_telnet_insert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
)
{
SSmlLinesInfo
*
info
=
calloc
(
1
,
sizeof
(
SSmlLinesInfo
));
info
->
id
=
genUID
();
int
code
=
tscSmlInsert
(
taos
,
points
,
numPoint
,
info
);
free
(
info
);
return
code
;
}
src/inc/taos.h
浏览文件 @
9c1813dc
...
...
@@ -172,6 +172,8 @@ DLL_EXPORT int taos_load_table_info(TAOS *taos, const char* tableNameList);
DLL_EXPORT
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
DLL_EXPORT
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
#ifdef __cplusplus
}
#endif
...
...
tests/examples/c/CMakeLists.txt
浏览文件 @
9c1813dc
...
...
@@ -11,6 +11,8 @@ IF (TD_LINUX)
TARGET_LINK_LIBRARIES
(
subscribe taos_static trpc tutil pthread
)
ADD_EXECUTABLE
(
epoll epoll.c
)
TARGET_LINK_LIBRARIES
(
epoll taos_static trpc tutil pthread lua
)
ADD_EXECUTABLE
(
opentsdb opentsdb.c
)
TARGET_LINK_LIBRARIES
(
opentsdb taos_static trpc tutil pthread lua
)
ENDIF
()
IF
(
TD_DARWIN
)
INCLUDE_DIRECTORIES
(
.
${
TD_COMMUNITY_DIR
}
/src/inc
${
TD_COMMUNITY_DIR
}
/src/client/inc
${
TD_COMMUNITY_DIR
}
/inc
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录