Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
438a76c8
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看板
提交
438a76c8
编写于
5月 09, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor:add time cost info for schemaless
上级
3ca0d758
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
49 addition
and
5 deletion
+49
-5
source/client/src/clientSml.c
source/client/src/clientSml.c
+49
-5
未找到文件。
source/client/src/clientSml.c
浏览文件 @
438a76c8
...
...
@@ -97,6 +97,21 @@ typedef struct {
char
*
buf
;
}
SSmlMsgBuf
;
typedef
struct
{
int32_t
code
;
int32_t
lineNum
;
int32_t
numOfSTables
;
int32_t
numOfCTables
;
int32_t
numOfCreateSTables
;
int64_t
parseTime
;
int64_t
schemaTime
;
int64_t
insertBindTime
;
int64_t
insertRpcTime
;
int64_t
endTime
;
}
SSmlCostInfo
;
typedef
struct
{
uint64_t
id
;
...
...
@@ -114,6 +129,7 @@ typedef struct {
SRequestObj
*
pRequest
;
SQuery
*
pQuery
;
SSmlCostInfo
cost
;
int32_t
affectedRows
;
SSmlMsgBuf
msgBuf
;
SHashObj
*
dumplicateKey
;
// for dumplicate key
...
...
@@ -444,6 +460,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
uError
(
"SML:0x%"
PRIx64
" catalogGetSTableMeta failed. super table name %s"
,
info
->
id
,
schemaAction
.
createSTable
.
sTableName
);
return
code
;
}
info
->
cost
.
numOfCreateSTables
++
;
}
else
if
(
code
==
TSDB_CODE_SUCCESS
)
{
}
else
{
uError
(
"SML:0x%"
PRIx64
" load table meta error: %s"
,
info
->
id
,
tstrerror
(
code
));
...
...
@@ -1547,7 +1564,7 @@ static int32_t smlParseLine(SSmlHandle* info, const char* sql) {
tinfo
->
sTableName
=
elements
.
measure
;
tinfo
->
sTableNameLen
=
elements
.
measureLen
;
smlBuildChildTableName
(
tinfo
);
uDebug
(
"SML:0x%"
PRIx64
" child table name: %s"
,
info
->
id
,
tinfo
->
childTableName
);
//
uDebug("SML:0x%"PRIx64" child table name: %s", info->id, tinfo->childTableName);
SSmlSTableMeta
**
tableMeta
=
taosHashGet
(
info
->
superTables
,
elements
.
measure
,
elements
.
measureLen
);
if
(
tableMeta
){
// update meta
...
...
@@ -1699,12 +1716,33 @@ static int32_t smlInsertData(SSmlHandle* info) {
}
smlBuildOutput
(
info
->
exec
,
info
->
pVgHash
);
info
->
cost
.
insertRpcTime
=
taosGetTimestampUs
();
launchQueryImpl
(
info
->
pRequest
,
info
->
pQuery
,
TSDB_CODE_SUCCESS
,
true
);
info
->
affectedRows
=
taos_affected_rows
(
info
->
pRequest
);
return
info
->
pRequest
->
code
;
}
int32_t
numOfSTables
;
int32_t
numOfCTables
;
int32_t
numOfCreateSTables
;
int64_t
parseTime
;
int64_t
schemaTime
;
int64_t
insertBindTime
;
int64_t
insertRpcTime
;
int64_t
endTime
;
static
void
printStatisticInfo
(
SSmlHandle
*
info
){
uError
(
"SML:0x%"
PRIx64
" smlInsertLines result, code:%d,lineNum:%d,stable num:%d,ctable num:%d,create stable num:%d \
parse cost:%lld,schema cost:%lld,bind cost:%lld,rpc cost:%lld,total cost:%lld"
,
info
->
id
,
info
->
cost
.
code
,
info
->
cost
.
lineNum
,
info
->
cost
.
numOfSTables
,
info
->
cost
.
numOfCTables
,
info
->
cost
.
numOfCreateSTables
,
info
->
cost
.
schemaTime
-
info
->
cost
.
parseTime
,
info
->
cost
.
insertBindTime
-
info
->
cost
.
schemaTime
,
info
->
cost
.
insertRpcTime
-
info
->
cost
.
insertBindTime
,
info
->
cost
.
endTime
-
info
->
cost
.
insertRpcTime
,
info
->
cost
.
endTime
-
info
->
cost
.
parseTime
);
}
static
int
smlInsertLines
(
SSmlHandle
*
info
,
char
*
lines
[],
int
numLines
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -1714,6 +1752,7 @@ static int smlInsertLines(SSmlHandle *info, char* lines[], int numLines) {
goto
cleanup
;
}
info
->
cost
.
parseTime
=
taosGetTimestampUs
();
for
(
int32_t
i
=
0
;
i
<
numLines
;
++
i
)
{
code
=
smlParseLine
(
info
,
lines
[
i
]);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1721,24 +1760,29 @@ static int smlInsertLines(SSmlHandle *info, char* lines[], int numLines) {
goto
cleanup
;
}
}
uDebug
(
"SML:0x%"
PRIx64
" smlInsertLines parse success. tables %d"
,
info
->
id
,
taosHashGetSize
(
info
->
childTables
));
uDebug
(
"SML:0x%"
PRIx64
" smlInsertLines parse success. super tables %d"
,
info
->
id
,
taosHashGetSize
(
info
->
superTables
));
info
->
cost
.
lineNum
=
numLines
;
info
->
cost
.
numOfSTables
=
taosHashGetSize
(
info
->
superTables
);
info
->
cost
.
numOfCTables
=
taosHashGetSize
(
info
->
childTables
);
info
->
cost
.
schemaTime
=
taosGetTimestampUs
();
code
=
smlModifyDBSchemas
(
info
);
if
(
code
!=
0
)
{
uError
(
"SML:0x%"
PRIx64
" smlModifyDBSchemas error : %s"
,
info
->
id
,
tstrerror
(
code
));
goto
cleanup
;
}
info
->
cost
.
insertBindTime
=
taosGetTimestampUs
();
code
=
smlInsertData
(
info
);
if
(
code
!=
0
)
{
uError
(
"SML:0x%"
PRIx64
" smlInsertData error : %s"
,
info
->
id
,
tstrerror
(
code
));
goto
cleanup
;
}
uDebug
(
"SML:0x%"
PRIx64
" smlInsertLines finish inserting %d lines."
,
info
->
id
,
numLines
);
info
->
cost
.
endTime
=
taosGetTimestampUs
();
cleanup:
info
->
cost
.
code
=
code
;
printStatisticInfo
(
info
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录