Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c6913c62
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看板
未验证
提交
c6913c62
编写于
8月 30, 2021
作者:
D
dapan1121
提交者:
GitHub
8月 30, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7672 from taosdata/hotfix/TD-6276
[td-6276]fix join retry issue
上级
c7e1fbd0
0ef5bf60
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
97 addition
and
23 deletion
+97
-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/tscSql.c
src/client/src/tscSql.c
+2
-0
src/client/src/tscStream.c
src/client/src/tscStream.c
+1
-0
src/client/src/tscSub.c
src/client/src/tscSub.c
+1
-0
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+61
-8
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+21
-13
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
c6913c62
...
...
@@ -376,6 +376,7 @@ typedef struct SSqlObj {
SSubqueryState
subState
;
struct
SSqlObj
**
pSubs
;
struct
SSqlObj
*
rootObj
;
int64_t
metaRid
;
int64_t
svgroupRid
;
...
...
src/client/src/tscAsync.c
浏览文件 @
c6913c62
...
...
@@ -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
浏览文件 @
c6913c62
...
...
@@ -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
);
...
...
@@ -3120,6 +3121,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/tscSql.c
浏览文件 @
c6913c62
...
...
@@ -874,6 +874,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
pSql
->
pTscObj
=
taos
;
pSql
->
signature
=
pSql
;
pSql
->
rootObj
=
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
pCmd
->
resColumnId
=
TSDB_RES_COL_ID
;
...
...
@@ -982,6 +983,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
pSql
->
pTscObj
=
taos
;
pSql
->
signature
=
pSql
;
pSql
->
rootObj
=
pSql
;
int32_t
code
=
(
uint8_t
)
tscTransferTableNameList
(
pSql
,
str
,
length
,
plist
);
free
(
str
);
...
...
src/client/src/tscStream.c
浏览文件 @
c6913c62
...
...
@@ -679,6 +679,7 @@ TAOS_STREAM *taos_open_stream_withname(TAOS *taos, const char* dstTable, const c
pSql
->
signature
=
pSql
;
pSql
->
pTscObj
=
pObj
;
pSql
->
rootObj
=
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
src/client/src/tscSub.c
浏览文件 @
c6913c62
...
...
@@ -127,6 +127,7 @@ static SSub* tscCreateSubscription(STscObj* pObj, const char* topic, const char*
pSql
->
signature
=
pSql
;
pSql
->
pTscObj
=
pObj
;
pSql
->
pSubscription
=
pSub
;
pSql
->
rootObj
=
pSql
;
pSub
->
pSql
=
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
c6913c62
...
...
@@ -860,6 +860,37 @@ static bool checkForDuplicateTagVal(SSchema* pColSchema, SJoinSupporter* p1, SSq
return
true
;
}
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
;
}
static
void
setTidTagType
(
SJoinSupporter
*
p
,
uint8_t
type
)
{
for
(
int32_t
i
=
0
;
i
<
p
->
num
;
++
i
)
{
STidTags
*
tag
=
(
STidTags
*
)
varDataVal
(
p
->
pIdTagList
+
i
*
p
->
tagSize
);
...
...
@@ -1102,6 +1133,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
...
...
@@ -1119,6 +1154,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
}
...
...
@@ -1256,6 +1295,10 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
...
...
@@ -1272,6 +1315,10 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
}
...
...
@@ -1402,6 +1449,10 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
}
...
...
@@ -1728,6 +1779,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
// tscFieldInfoUpdateOffset(pQueryInfo);
}
void
tscJoinQueryCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
...
...
@@ -1747,6 +1799,10 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
...
...
@@ -1763,6 +1819,10 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
return
;
}
if
(
!
tscReparseSql
(
pParentSql
->
rootObj
,
pParentSql
->
res
.
code
))
{
return
;
}
tscAsyncResultOnError
(
pParentSql
);
return
;
...
...
@@ -2767,14 +2827,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
浏览文件 @
c6913c62
...
...
@@ -3458,6 +3458,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, __async_cb_func_t fp, void* param, in
pNew
->
pTscObj
=
pSql
->
pTscObj
;
pNew
->
signature
=
pNew
;
pNew
->
rootObj
=
pSql
->
rootObj
;
SSqlCmd
*
pCmd
=
&
pNew
->
cmd
;
pCmd
->
command
=
cmd
;
...
...
@@ -3539,6 +3540,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNew
->
pTscObj
=
pSql
->
pTscObj
;
pNew
->
signature
=
pNew
;
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
rootObj
=
pSql
->
rootObj
;
tsem_init
(
&
pNew
->
rspSem
,
0
,
0
);
SSqlCmd
*
pnCmd
=
&
pNew
->
cmd
;
...
...
@@ -3814,7 +3816,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 +3828,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
;
}
...
...
@@ -3899,6 +3906,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
pNew
->
fp
=
tscSubqueryCompleteCallback
;
pNew
->
fetchFp
=
tscSubqueryCompleteCallback
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录