Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
47b492b3
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看板
提交
47b492b3
编写于
12月 12, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avoid race
上级
21f84693
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
18 deletion
+31
-18
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+31
-18
未找到文件。
src/client/src/tscSubquery.c
浏览文件 @
47b492b3
...
...
@@ -2180,43 +2180,56 @@ static void doFreeInsertSupporter(SSqlObj* pSqlObj) {
tfree
(
pSql
->
param
);
}
}
static
bool
doCheckAllSubObj
(
SSqlObj
*
pSqlObj
,
int
*
numOfRows
,
int8_t
*
buildSchema
)
{
assert
(
pSqlObj
!=
NULL
&&
pSqlObj
->
subState
.
numOfSub
>
0
);
bool
res
=
true
;
for
(
int32_t
i
=
0
;
i
<
pSqlObj
->
subState
.
numOfSub
;
++
i
)
{
SSqlObj
*
pSql
=
pSqlObj
->
pSubs
[
i
];
if
(
taos_errno
(
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
res
=
false
;
if
(
pSql
->
cmd
.
submitSchema
)
{
*
buildSchema
=
1
;
}
}
else
{
*
numOfRows
+=
pSql
->
res
.
numOfRows
;
}
}
return
res
;
}
static
void
multiVnodeInsertFinalize
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
)
{
SInsertSupporter
*
pSupporter
=
(
SInsertSupporter
*
)
param
;
SSqlObj
*
pParentObj
=
pSupporter
->
pSql
;
SSqlObj
*
pSubObj
=
(
SSqlObj
*
)
tres
;
// record the total inserted rows
if
(
numOfRows
>
0
)
{
pParentObj
->
res
.
numOfRows
+=
numOfRows
;
}
if
(
taos_errno
(
tres
)
!=
TSDB_CODE_SUCCESS
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
assert
(
pSql
!=
NULL
&&
pSql
->
res
.
code
==
numOfRows
);
pParentObj
->
res
.
code
=
pSql
->
res
.
code
;
// set the flag in the parent sqlObj
if
(
pSql
->
cmd
.
submitSchema
)
{
pParentObj
->
cmd
.
submitSchema
=
1
;
}
pSubObj
->
res
.
numOfRows
=
numOfRows
;
}
if
(
atomic_sub_fetch_32
(
&
pParentObj
->
subState
.
numOfRemain
,
1
)
>
0
)
{
return
;
}
if
(
0
!=
atomic_load_32
(
&
pParentObj
->
subState
.
numOfRemain
))
{
tscError
(
"%p impossible"
,
pParentObj
);
}
int
totalRows
=
0
;
int8_t
submitSchema
=
0
;
bool
res
=
doCheckAllSubObj
(
pParentObj
,
&
totalRows
,
&
submitSchema
);
// restore user defined fp
pParentObj
->
fp
=
pParentObj
->
fetchFp
;
pParentObj
->
cmd
.
submitSchema
=
submitSchema
;
pParentObj
->
res
.
numOfRows
=
totalRows
;
int32_t
numOfSub
=
pParentObj
->
subState
.
numOfSub
;
if
(
pParentObj
->
res
.
code
==
TSDB_CODE_SUCCESS
)
{
if
(
res
==
true
)
{
tscDebug
(
"%p Async insertion completed, total inserted:%d"
,
pParentObj
,
pParentObj
->
res
.
numOfRows
);
doFreeInsertSupporter
(
pParentObj
);
// todo remove this parameter in async callback function definition.
// all data has been sent to vnode, call user function
int32_t
v
=
(
pParentObj
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
?
pParentObj
->
res
.
code
:
(
int32_t
)
pParentObj
->
res
.
numOfRows
;
//int32_t v = (pParentObj->res.code != TSDB_CODE_SUCCESS) ? pParentObj->res.code : (int32_t)pParentObj->res.numOfRows;
int32_t
v
=
totalRows
;
(
*
pParentObj
->
fp
)(
pParentObj
->
param
,
pParentObj
,
v
);
}
else
{
if
(
!
needRetryInsert
(
pParentObj
,
numOfSub
))
{
...
...
@@ -2242,7 +2255,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
}
tscError
(
"%p Async insertion completed, total inserted:%d rows, numOfFailed:%d, numOfTotal:%d"
,
pParentObj
,
pParentObj
->
res
.
numOf
Rows
,
numOfFailed
,
numOfSub
);
total
Rows
,
numOfFailed
,
numOfSub
);
tscDebug
(
"%p cleanup %d tableMeta in cache"
,
pParentObj
,
pParentObj
->
cmd
.
numOfTables
);
for
(
int32_t
i
=
0
;
i
<
pParentObj
->
cmd
.
numOfTables
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录