Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
020fa3dd
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
020fa3dd
编写于
5月 08, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
performance issue
上级
49948f26
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
17 addition
and
3 deletion
+17
-3
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+14
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+3
-1
未找到文件。
src/client/src/tscPrepare.c
浏览文件 @
020fa3dd
...
...
@@ -50,6 +50,7 @@ typedef struct SMultiTbStmt {
uint32_t
tbNum
;
SStrToken
tbname
;
SHashObj
*
pTableHash
;
SHashObj
*
pTableBlockHashList
;
// data block for each table
}
SMultiTbStmt
;
typedef
struct
STscStmt
{
...
...
@@ -975,6 +976,7 @@ static void insertBatchClean(STscStmt* pStmt) {
tfree
(
pCmd
->
pTableNameList
);
/*
STableDataBlocks** p = taosHashIterate(pCmd->pTableBlockHashList, NULL);
STableDataBlocks* pOneTableBlock = *p;
...
...
@@ -993,10 +995,12 @@ static void insertBatchClean(STscStmt* pStmt) {
pOneTableBlock = *p;
}
*/
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
pCmd
->
numOfTables
=
0
;
taosHashEmpty
(
pCmd
->
pTableBlockHashList
);
tscFreeSqlResult
(
pSql
);
tscFreeSubobj
(
pSql
);
tfree
(
pSql
->
pSubs
);
...
...
@@ -1136,6 +1140,10 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
if
(
pStmt
->
mtb
.
pTableHash
==
NULL
)
{
pStmt
->
mtb
.
pTableHash
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
false
);
}
if
(
pStmt
->
mtb
.
pTableBlockHashList
==
NULL
)
{
pStmt
->
mtb
.
pTableBlockHashList
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1183,7 +1191,7 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
if
(
uid
!=
NULL
)
{
pStmt
->
mtb
.
currentUid
=
*
uid
;
STableDataBlocks
**
t1
=
(
STableDataBlocks
**
)
taosHashGet
(
p
Cmd
->
pTableBlockHashList
,
(
const
char
*
)
&
pStmt
->
mtb
.
currentUid
,
sizeof
(
pStmt
->
mtb
.
currentUid
));
STableDataBlocks
**
t1
=
(
STableDataBlocks
**
)
taosHashGet
(
p
Stmt
->
mtb
.
pTableBlockHashList
,
(
const
char
*
)
&
pStmt
->
mtb
.
currentUid
,
sizeof
(
pStmt
->
mtb
.
currentUid
));
if
(
t1
==
NULL
)
{
tscError
(
"no table data block in hash list, uid:%"
PRId64
,
pStmt
->
mtb
.
currentUid
);
return
TSDB_CODE_TSC_APP_ERROR
;
...
...
@@ -1192,6 +1200,8 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
SSubmitBlk
*
pBlk
=
(
SSubmitBlk
*
)
(
*
t1
)
->
pData
;
pCmd
->
batchSize
=
pBlk
->
numOfRows
;
taosHashPut
(
pCmd
->
pTableBlockHashList
,
(
void
*
)
&
pStmt
->
mtb
.
currentUid
,
sizeof
(
pStmt
->
mtb
.
currentUid
),
(
void
*
)
t1
,
POINTER_BYTES
);
tscDebug
(
"table:%s is already prepared, uid:%"
PRIu64
,
name
,
pStmt
->
mtb
.
currentUid
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1237,6 +1247,8 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
pStmt
->
mtb
.
currentUid
=
pTableMeta
->
id
.
uid
;
pStmt
->
mtb
.
tbNum
++
;
taosHashPut
(
pStmt
->
mtb
.
pTableBlockHashList
,
(
void
*
)
&
pStmt
->
mtb
.
currentUid
,
sizeof
(
pStmt
->
mtb
.
currentUid
),
(
void
*
)
&
pBlock
,
POINTER_BYTES
);
taosHashPut
(
pStmt
->
mtb
.
pTableHash
,
name
,
strlen
(
name
),
(
char
*
)
&
pTableMeta
->
id
.
uid
,
sizeof
(
pTableMeta
->
id
.
uid
));
tscDebug
(
"table:%s is prepared, uid:%"
PRIu64
,
name
,
pStmt
->
mtb
.
currentUid
);
...
...
src/client/src/tscUtil.c
浏览文件 @
020fa3dd
...
...
@@ -1316,8 +1316,10 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) {
// the length does not include the SSubmitBlk structure
pBlocks
->
dataLen
=
htonl
(
finalLen
);
dataBuf
->
numOfTables
+=
1
;
pBlocks
->
numOfRows
=
0
;
}
else
{
tsc
Warn
(
"table %s data block is empty"
,
pOneTableBlock
->
tableName
.
tname
);
tsc
Debug
(
"table %s data block is empty"
,
pOneTableBlock
->
tableName
.
tname
);
}
p
=
taosHashIterate
(
pCmd
->
pTableBlockHashList
,
p
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录