Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
31d461ba
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
31d461ba
编写于
8月 30, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6442]<feature>: Support OpenTSDB telnet style data import format
上级
345da2ef
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
13 deletion
+15
-13
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+3
-3
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+7
-7
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/util/src/terror.c
src/util/src/terror.c
+4
-3
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
31d461ba
...
@@ -1677,7 +1677,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
...
@@ -1677,7 +1677,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
if
(
len
>=
2
)
{
if
(
len
>=
2
)
{
for
(
int
i
=
0
;
i
<
len
-
2
;
++
i
)
{
for
(
int
i
=
0
;
i
<
len
-
2
;
++
i
)
{
if
(
!
isdigit
(
value
[
i
]))
{
if
(
!
isdigit
(
value
[
i
]))
{
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_TIME_STAMP
;
}
}
}
}
}
}
...
@@ -1712,7 +1712,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
...
@@ -1712,7 +1712,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
break
;
break
;
}
}
default:
{
default:
{
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_TIME_STAMP
;
}
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1725,7 +1725,7 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
...
@@ -1725,7 +1725,7 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
int64_t
tsVal
;
int64_t
tsVal
;
if
(
!
isTimeStamp
(
value
,
len
,
&
type
))
{
if
(
!
isTimeStamp
(
value
,
len
,
&
type
))
{
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_TIME_STAMP
;
}
}
ret
=
getTimeStampValue
(
value
,
len
,
type
,
&
tsVal
);
ret
=
getTimeStampValue
(
value
,
len
,
type
,
&
tsVal
);
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
31d461ba
...
@@ -47,7 +47,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
...
@@ -47,7 +47,7 @@ static int32_t parseTelnetMetric(TAOS_SML_DATA_POINT *pSml, const char **index,
if
(
len
>
TSDB_TABLE_NAME_LEN
)
{
if
(
len
>
TSDB_TABLE_NAME_LEN
)
{
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 193 characters"
,
info
->
id
);
tscError
(
"OTD:0x%"
PRIx64
" Metric cannot exceeds 193 characters"
,
info
->
id
);
tfree
(
pSml
->
stableName
);
tfree
(
pSml
->
stableName
);
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_TABLE_ID_LENGTH
;
}
}
if
(
*
cur
==
' '
)
{
if
(
*
cur
==
' '
)
{
...
@@ -147,7 +147,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
...
@@ -147,7 +147,7 @@ static int32_t parseTelnetMetricValue(TAOS_SML_KV **pKVs, int *num_kvs, const ch
tscError
(
"OTD:0x%"
PRIx64
" Failed to convert metric value string(%s) to any type"
,
tscError
(
"OTD:0x%"
PRIx64
" Failed to convert metric value string(%s) to any type"
,
info
->
id
,
value
);
info
->
id
,
value
);
tfree
(
value
);
tfree
(
value
);
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_VALUE
;
}
}
tfree
(
value
);
tfree
(
value
);
...
@@ -172,7 +172,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
...
@@ -172,7 +172,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
while
(
*
cur
!=
'\0'
)
{
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_COL_NAME_LEN
)
{
if
(
len
>
TSDB_COL_NAME_LEN
)
{
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds 65 characters"
,
info
->
id
);
tscError
(
"OTD:0x%"
PRIx64
" Tag key cannot exceeds 65 characters"
,
info
->
id
);
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_COLUMN_LENGTH
;
}
}
if
(
*
cur
==
'='
)
{
if
(
*
cur
==
'='
)
{
break
;
break
;
...
@@ -188,7 +188,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
...
@@ -188,7 +188,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **index, SHashObj
key
[
len
]
=
'\0'
;
key
[
len
]
=
'\0'
;
if
(
checkDuplicateKey
(
key
,
pHash
,
info
))
{
if
(
checkDuplicateKey
(
key
,
pHash
,
info
))
{
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
DUP_TAG_NAMES
;
}
}
pKV
->
key
=
tcalloc
(
len
+
1
,
1
);
pKV
->
key
=
tcalloc
(
len
+
1
,
1
);
...
@@ -231,7 +231,7 @@ static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -231,7 +231,7 @@ static int32_t parseTelnetTagValue(TAOS_SML_KV *pKV, const char **index,
//free previous alocated key field
//free previous alocated key field
tfree
(
pKV
->
key
);
tfree
(
pKV
->
key
);
tfree
(
value
);
tfree
(
value
);
return
TSDB_CODE_TSC_
LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_
INVALID_VALUE
;
}
}
tfree
(
value
);
tfree
(
value
);
...
@@ -348,14 +348,14 @@ int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points, SArray*
...
@@ -348,14 +348,14 @@ int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points, SArray*
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"OTD:0x%"
PRIx64
" data point line parse failed. line %d : %s"
,
info
->
id
,
i
,
lines
[
i
]);
tscError
(
"OTD:0x%"
PRIx64
" data point line parse failed. line %d : %s"
,
info
->
id
,
i
,
lines
[
i
]);
destroySmlDataPoint
(
&
point
);
destroySmlDataPoint
(
&
point
);
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
code
;
}
else
{
}
else
{
tscDebug
(
"OTD:0x%"
PRIx64
" data point line parse success. line %d"
,
info
->
id
,
i
);
tscDebug
(
"OTD:0x%"
PRIx64
" data point line parse success. line %d"
,
info
->
id
,
i
);
}
}
taosArrayPush
(
points
,
&
point
);
taosArrayPush
(
points
,
&
point
);
}
}
return
0
;
return
TSDB_CODE_SUCCESS
;
}
}
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
)
{
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
)
{
...
...
src/inc/taoserror.h
浏览文件 @
31d461ba
...
@@ -106,6 +106,7 @@ int32_t* taosGetErrno();
...
@@ -106,6 +106,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_DUP_COL_NAMES TAOS_DEF_ERROR_CODE(0, 0x021D) //"duplicated column names")
#define TSDB_CODE_TSC_DUP_COL_NAMES TAOS_DEF_ERROR_CODE(0, 0x021D) //"duplicated column names")
#define TSDB_CODE_TSC_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021E) //"Invalid tag length")
#define TSDB_CODE_TSC_INVALID_TAG_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021E) //"Invalid tag length")
#define TSDB_CODE_TSC_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021F) //"Invalid column length")
#define TSDB_CODE_TSC_INVALID_COLUMN_LENGTH TAOS_DEF_ERROR_CODE(0, 0x021F) //"Invalid column length")
#define TSDB_CODE_TSC_DUP_TAG_NAMES TAOS_DEF_ERROR_CODE(0, 0x0220) //"duplicated tag names")
// mnode
// mnode
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed")
#define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) //"Message not processed")
...
...
src/util/src/terror.c
浏览文件 @
31d461ba
...
@@ -112,9 +112,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_EXCEED_SQL_LIMIT, "SQL statement too lon
...
@@ -112,9 +112,10 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_EXCEED_SQL_LIMIT, "SQL statement too lon
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_FILE_EMPTY
,
"File is empty"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_FILE_EMPTY
,
"File is empty"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
,
"Syntax error in Line"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
,
"Syntax error in Line"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NO_META_CACHED
,
"No table meta cached"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NO_META_CACHED
,
"No table meta cached"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
"duplicated column names"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
"duplicated column names"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_TAG_LENGTH
,
"Invalid tag length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_TAG_LENGTH
,
"Invalid tag length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
,
"Invalid column length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INVALID_COLUMN_LENGTH
,
"Invalid column length"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_DUP_TAG_NAMES
,
"duplicated tag names"
)
// mnode
// mnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MSG_NOT_PROCESSED
,
"Message not processed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录