Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38c48654
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看板
提交
38c48654
编写于
8月 28, 2021
作者:
W
wpan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix join retry issue
上级
2e452fce
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
23 deletion
+71
-23
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-0
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+9
-2
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+40
-8
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+20
-13
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
38c48654
无法预览此类型文件
src/client/src/tscAsync.c
浏览文件 @
38c48654
...
...
@@ -44,6 +44,7 @@ void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* para
pSql
->
maxRetry
=
TSDB_MAX_REPLICA
;
pSql
->
fp
=
fp
;
pSql
->
fetchFp
=
fp
;
pSql
->
rootObj
=
pSql
;
registerSqlObj
(
pSql
);
...
...
src/client/src/tscServer.c
浏览文件 @
38c48654
...
...
@@ -577,7 +577,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
((
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
(
TSDB_QUERY_TYPE_STABLE_SUBQUERY
|
TSDB_QUERY_TYPE_SUBQUERY
|
TSDB_QUERY_TYPE_TAG_FILTER_QUERY
))
&&
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_PROJECTION_QUERY
))
||
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_NEST_SUBQUERY
))
||
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
&&
pQueryInfo
->
distinct
))
{
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_NEST_SUBQUERY
))
||
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
&&
pQueryInfo
->
distinct
)
||
(
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_QUERY
)))
{
// do nothing in case of super table subquery
}
else
{
pSql
->
retry
+=
1
;
...
...
@@ -2972,7 +2973,7 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
pNew
->
self
,
numOfTable
,
numOfVgroupList
,
numOfUdf
,
pNew
->
cmd
.
payloadLen
);
pNew
->
fp
=
fp
;
pNew
->
param
=
(
void
*
)
pSql
->
self
;
pNew
->
param
=
(
void
*
)
pSql
->
rootObj
->
self
;
tscDebug
(
"0x%"
PRIx64
" metaRid from 0x%"
PRIx64
" to 0x%"
PRIx64
,
pSql
->
self
,
pSql
->
metaRid
,
pNew
->
self
);
...
...
@@ -3118,6 +3119,12 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
pCmd
->
pTableMetaMap
=
tscCleanupTableMetaMap
(
pCmd
->
pTableMetaMap
);
pCmd
->
pTableMetaMap
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
SSqlCmd
*
pCmd2
=
&
pSql
->
rootObj
->
cmd
;
pCmd2
->
pTableMetaMap
=
tscCleanupTableMetaMap
(
pCmd2
->
pTableMetaMap
);
pCmd2
->
pTableMetaMap
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
pSql
->
rootObj
->
retryReason
=
pSql
->
retryReason
;
SArray
*
pNameList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SArray
*
vgroupList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
38c48654
...
...
@@ -1728,6 +1728,37 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
// tscFieldInfoUpdateOffset(pQueryInfo);
}
bool
tscReparseSql
(
SSqlObj
*
sql
,
int32_t
code
){
if
(
!
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
&&
sql
->
retry
<
sql
->
maxRetry
))
{
return
true
;
}
sql
->
res
.
code
=
TSDB_CODE_SUCCESS
;
sql
->
retry
++
;
tscDebug
(
"0x%"
PRIx64
" retry parse sql and send query, prev error: %s, retry:%d"
,
sql
->
self
,
tstrerror
(
code
),
sql
->
retry
);
tscResetSqlCmd
(
&
sql
->
cmd
,
true
);
code
=
tsParseSql
(
sql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
return
false
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
sql
->
res
.
code
=
code
;
tscAsyncResultOnError
(
sql
);
return
false
;
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
sql
->
cmd
);
executeQuery
(
sql
,
pQueryInfo
);
return
false
;
}
void
tscJoinQueryCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
...
...
@@ -1747,6 +1778,10 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
...
...
@@ -1762,6 +1797,10 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
if
(
quitAllSubquery
(
pSql
,
pParentSql
,
pSupporter
))
{
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
...
...
@@ -2767,14 +2806,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
if
(
!
TSDB_QUERY_HAS_TYPE
(
pQueryInfo
->
type
,
TSDB_QUERY_TYPE_JOIN_SEC_STAGE
))
{
int32_t
code
=
pParentSql
->
res
.
code
;
SSqlObj
*
userSql
=
NULL
;
if
(
pParentSql
->
param
)
{
userSql
=
((
SRetrieveSupport
*
)
pParentSql
->
param
)
->
pParentSql
;
}
if
(
userSql
==
NULL
)
{
userSql
=
pParentSql
;
}
SSqlObj
*
userSql
=
pParentSql
->
rootObj
;
if
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
&&
userSql
->
retry
<
userSql
->
maxRetry
)
{
if
(
userSql
!=
pParentSql
)
{
...
...
src/client/src/tscUtil.c
浏览文件 @
38c48654
...
...
@@ -3538,7 +3538,8 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNew
->
pTscObj
=
pSql
->
pTscObj
;
pNew
->
signature
=
pNew
;
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
rootObj
=
pSql
->
rootObj
;
tsem_init
(
&
pNew
->
rspSem
,
0
,
0
);
SSqlCmd
*
pnCmd
=
&
pNew
->
cmd
;
...
...
@@ -3814,7 +3815,9 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
// todo refactor
tscDebug
(
"0x%"
PRIx64
" all subquery response received, retry"
,
pParentSql
->
self
);
if
(
code
&&
!
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
&&
pParentSql
->
retry
<
pParentSql
->
maxRetry
))
{
SSqlObj
*
rootObj
=
pParentSql
->
rootObj
;
if
(
code
&&
!
((
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
&&
rootObj
->
retry
<
rootObj
->
maxRetry
))
{
pParentSql
->
res
.
code
=
code
;
tscAsyncResultOnError
(
pParentSql
);
...
...
@@ -3824,29 +3827,32 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
tscFreeSubobj
(
pParentSql
);
tfree
(
pParentSql
->
pSubs
);
pParentSql
->
res
.
code
=
TSDB_CODE_SUCCESS
;
pParentSql
->
retry
++
;
tscFreeSubobj
(
rootObj
);
tfree
(
rootObj
->
pSubs
);
rootObj
->
res
.
code
=
TSDB_CODE_SUCCESS
;
rootObj
->
retry
++
;
tscDebug
(
"0x%"
PRIx64
" retry parse sql and send query, prev error: %s, retry:%d"
,
pParentSql
->
self
,
tstrerror
(
code
),
pParentSql
->
retry
);
tscDebug
(
"0x%"
PRIx64
" retry parse sql and send query, prev error: %s, retry:%d"
,
rootObj
->
self
,
tstrerror
(
code
),
rootObj
->
retry
);
tscResetSqlCmd
(
&
pParentSql
->
cmd
,
true
);
tscResetSqlCmd
(
&
rootObj
->
cmd
,
true
);
code
=
tsParseSql
(
pParentSql
,
true
);
code
=
tsParseSql
(
rootObj
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
return
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
pParentSql
->
res
.
code
=
code
;
tscAsyncResultOnError
(
pParentSql
);
rootObj
->
res
.
code
=
code
;
tscAsyncResultOnError
(
rootObj
);
return
;
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pParentSql
->
cmd
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
rootObj
->
cmd
);
executeQuery
(
pParentSql
,
pQueryInfo
);
executeQuery
(
rootObj
,
pQueryInfo
);
return
;
}
...
...
@@ -3898,7 +3904,8 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
fp
=
tscSubqueryCompleteCallback
;
pNew
->
fetchFp
=
tscSubqueryCompleteCallback
;
pNew
->
maxRetry
=
pSql
->
maxRetry
;
pNew
->
maxRetry
=
pSql
->
maxRetry
;
pNew
->
rootObj
=
pSql
->
rootObj
;
pNew
->
cmd
.
resColumnId
=
TSDB_RES_COL_ID
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录