Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
23b677dc
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看板
提交
23b677dc
编写于
9月 15, 2022
作者:
B
Benguang Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: refactor doInitSubState to doReInitSubState with old pSubs reset properly
上级
7546cd7c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
30 deletion
+16
-30
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/src/tscDelete.c
src/client/src/tscDelete.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+4
-7
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-21
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
23b677dc
...
@@ -350,7 +350,7 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex, SSqlC
...
@@ -350,7 +350,7 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex, SSqlC
int16_t
tscGetJoinTagColIdByUid
(
STagCond
*
pTagCond
,
uint64_t
uid
);
int16_t
tscGetJoinTagColIdByUid
(
STagCond
*
pTagCond
,
uint64_t
uid
);
int16_t
tscGetTagColIndexById
(
STableMeta
*
pTableMeta
,
int16_t
colId
);
int16_t
tscGetTagColIndexById
(
STableMeta
*
pTableMeta
,
int16_t
colId
);
int32_t
doInitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
);
int32_t
do
Re
InitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
);
void
tscPrintSelNodeList
(
SSqlObj
*
pSql
,
int32_t
subClauseIndex
);
void
tscPrintSelNodeList
(
SSqlObj
*
pSql
,
int32_t
subClauseIndex
);
...
...
src/client/src/tscDelete.c
浏览文件 @
23b677dc
...
@@ -202,7 +202,7 @@ int32_t executeDelete(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
...
@@ -202,7 +202,7 @@ int32_t executeDelete(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
ret
=
doInitSubState
(
pSql
,
numOfSub
);
ret
=
do
Re
InitSubState
(
pSql
,
numOfSub
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
return
ret
;
return
ret
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
23b677dc
...
@@ -2175,20 +2175,19 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
...
@@ -2175,20 +2175,19 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
assert
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_SUBQUERY
)
==
0
);
assert
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_SUBQUERY
)
==
0
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
pSql
->
subState
.
numOfSub
=
pQueryInfo
->
numOfTables
;
pthread_mutex_lock
(
&
pSql
->
subState
.
mutex
);
pSql
->
subState
.
numOfSub
=
pQueryInfo
->
numOfTables
;
if
(
pSql
->
subState
.
states
==
NULL
)
{
if
(
pSql
->
subState
.
states
==
NULL
)
{
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
*
pSql
->
subState
.
states
));
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
*
pSql
->
subState
.
states
));
if
(
pSql
->
subState
.
states
==
NULL
)
{
if
(
pSql
->
subState
.
states
==
NULL
)
{
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
goto
_error
;
}
}
pthread_mutex_init
(
&
pSql
->
subState
.
mutex
,
NULL
);
}
}
memset
(
pSql
->
subState
.
states
,
0
,
sizeof
(
*
pSql
->
subState
.
states
)
*
pSql
->
subState
.
numOfSub
);
memset
(
pSql
->
subState
.
states
,
0
,
sizeof
(
*
pSql
->
subState
.
states
)
*
pSql
->
subState
.
numOfSub
);
tscDebug
(
"0x%"
PRIx64
" reset all sub states to 0, start subquery, total:%d"
,
pSql
->
self
,
pQueryInfo
->
numOfTables
);
tscDebug
(
"0x%"
PRIx64
" reset all sub states to 0, start subquery, total:%d"
,
pSql
->
self
,
pQueryInfo
->
numOfTables
);
pthread_mutex_unlock
(
&
pSql
->
subState
.
mutex
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
SJoinSupporter
*
pSupporter
=
tscCreateJoinSupporter
(
pSql
,
i
);
SJoinSupporter
*
pSupporter
=
tscCreateJoinSupporter
(
pSql
,
i
);
...
@@ -2760,8 +2759,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -2760,8 +2759,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
int32_t
numOfSub
=
(
pTableMetaInfo
->
pVgroupTables
==
NULL
)
?
pTableMetaInfo
->
vgroupList
->
numOfVgroups
int32_t
numOfSub
=
(
pTableMetaInfo
->
pVgroupTables
==
NULL
)
?
pTableMetaInfo
->
vgroupList
->
numOfVgroups
:
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
:
(
int32_t
)
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
int32_t
ret
=
doReInitSubState
(
pSql
,
numOfSub
);
int32_t
ret
=
doInitSubState
(
pSql
,
numOfSub
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
return
ret
;
return
ret
;
...
@@ -3611,7 +3609,6 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
...
@@ -3611,7 +3609,6 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
tscDebug
(
"0x%"
PRIx64
" sub:%p launch sub insert, orderOfSub:%d"
,
pSql
->
self
,
pSub
,
j
);
tscDebug
(
"0x%"
PRIx64
" sub:%p launch sub insert, orderOfSub:%d"
,
pSql
->
self
,
pSub
,
j
);
tscBuildAndSendRequest
(
pSub
,
NULL
);
tscBuildAndSendRequest
(
pSub
,
NULL
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
_error:
_error:
...
...
src/client/src/tscUtil.c
浏览文件 @
23b677dc
...
@@ -4207,30 +4207,19 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
...
@@ -4207,30 +4207,19 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
taos_fetch_rows_a
(
tres
,
tscSubqueryRetrieveCallback
,
param
);
taos_fetch_rows_a
(
tres
,
tscSubqueryRetrieveCallback
,
param
);
}
}
int32_t
doInitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
)
{
int32_t
doReInitSubState
(
SSqlObj
*
pSql
,
int32_t
numOfSubqueries
)
{
//bug fix. Above doInitSubState level, the loop invocation with the same SSqlObj will be fail.
tscFreeSubobj
(
pSql
);
//assert(pSql->subState.numOfSub == 0 && pSql->pSubs == NULL && pSql->subState.states == NULL);
if
(
pSql
->
pSubs
)
{
pthread_mutex_lock
(
&
pSql
->
subState
.
mutex
);
free
(
pSql
->
pSubs
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
pSql
->
pSubs
=
NULL
;
}
if
(
pSql
->
subState
.
states
)
{
free
(
pSql
->
subState
.
states
);
pSql
->
subState
.
states
=
NULL
;
}
pSql
->
subState
.
numOfSub
=
numOfSubqueries
;
pSql
->
subState
.
numOfSub
=
numOfSubqueries
;
pSql
->
pSubs
=
calloc
(
pSql
->
subState
.
numOfSub
,
POINTER_BYTES
);
pSql
->
pSubs
=
calloc
(
pSql
->
subState
.
numOfSub
,
POINTER_BYTES
);
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
int8_t
));
pSql
->
subState
.
states
=
calloc
(
pSql
->
subState
.
numOfSub
,
sizeof
(
int8_t
));
if
(
pSql
->
pSubs
==
NULL
||
pSql
->
subState
.
states
==
NULL
)
{
int32_t
code
=
pthread_mutex_init
(
&
pSql
->
subState
.
mutex
,
NULL
);
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
if
(
pSql
->
pSubs
==
NULL
||
pSql
->
subState
.
states
==
NULL
||
code
!=
0
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
}
pthread_mutex_unlock
(
&
pSql
->
subState
.
mutex
);
return
TSDB_CODE_SUCCESS
;
return
code
;
}
}
// do execute the query according to the query execution plan
// do execute the query according to the query execution plan
...
@@ -4255,7 +4244,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
...
@@ -4255,7 +4244,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
// upstream may be freed before retry
// upstream may be freed before retry
if
(
pQueryInfo
->
pUpstream
&&
taosArrayGetSize
(
pQueryInfo
->
pUpstream
)
>
0
)
{
// nest query. do execute it firstly
if
(
pQueryInfo
->
pUpstream
&&
taosArrayGetSize
(
pQueryInfo
->
pUpstream
)
>
0
)
{
// nest query. do execute it firstly
code
=
doInitSubState
(
pSql
,
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
pUpstream
));
code
=
do
Re
InitSubState
(
pSql
,
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
pUpstream
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录