Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59b8cfbc
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看板
提交
59b8cfbc
编写于
6月 12, 2023
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add sub_query in systable and kill subquery
上级
170182fe
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
78 addition
and
12 deletion
+78
-12
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+62
-0
source/client/src/clientHb.c
source/client/src/clientHb.c
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+1
-0
source/client/src/clientMain.c
source/client/src/clientMain.c
+3
-12
source/common/src/systable.c
source/common/src/systable.c
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+3
-0
source/libs/executor/src/exchangeoperator.c
source/libs/executor/src/exchangeoperator.c
+2
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
59b8cfbc
...
...
@@ -2488,6 +2488,7 @@ typedef struct {
int64_t
stime
;
// timestamp precision ms
int64_t
reqRid
;
bool
stableQuery
;
bool
isSubQuery
;
char
fqdn
[
TSDB_FQDN_LEN
];
int32_t
subPlanNum
;
SArray
*
subDesc
;
// SArray<SQuerySubDesc>
...
...
source/client/inc/clientInt.h
浏览文件 @
59b8cfbc
...
...
@@ -256,6 +256,7 @@ typedef struct SRequestObj {
bool
validateOnly
;
// todo refactor
bool
killed
;
bool
inRetry
;
bool
isSubReq
;
uint32_t
prevCode
;
// previous error code: todo refactor, add update flag for catalog
uint32_t
retry
;
int64_t
allocatorRefId
;
...
...
@@ -398,6 +399,7 @@ void restartAsyncQuery(SRequestObj *pRequest, int32_t code);
int32_t
buildPreviousRequest
(
SRequestObj
*
pRequest
,
const
char
*
sql
,
SRequestObj
**
pNewRequest
);
int32_t
prepareAndParseSqlSyntax
(
SSqlCallbackWrapper
**
ppWrapper
,
SRequestObj
*
pRequest
,
bool
updateMetaForce
);
void
returnToUser
(
SRequestObj
*
pRequest
);
void
stopAllQueries
(
SRequestObj
*
pRequest
);
#ifdef __cplusplus
}
...
...
source/client/src/clientEnv.c
浏览文件 @
59b8cfbc
...
...
@@ -363,6 +363,11 @@ void destroySubRequests(SRequestObj *pRequest) {
int32_t
reqIdx
=
-
1
;
SRequestObj
*
pReqList
[
16
]
=
{
NULL
};
uint64_t
tmpRefId
=
0
;
if
(
pRequest
->
relation
.
userRefId
&&
pRequest
->
relation
.
userRefId
!=
pRequest
->
self
)
{
return
;
}
SRequestObj
*
pTmp
=
pRequest
;
while
(
pTmp
->
relation
.
prevRefId
)
{
tmpRefId
=
pTmp
->
relation
.
prevRefId
;
...
...
@@ -454,6 +459,63 @@ void destroyRequest(SRequestObj *pRequest) {
removeRequest
(
pRequest
->
self
);
}
void
taosStopQueryImpl
(
SRequestObj
*
pRequest
)
{
pRequest
->
killed
=
true
;
// It is not a query, no need to stop.
if
(
NULL
==
pRequest
->
pQuery
||
QUERY_EXEC_MODE_SCHEDULE
!=
pRequest
->
pQuery
->
execMode
)
{
tscDebug
(
"request 0x%"
PRIx64
" no need to be killed since not query"
,
pRequest
->
requestId
);
return
;
}
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
TSDB_CODE_TSC_QUERY_KILLED
);
tscDebug
(
"request %"
PRIx64
" killed"
,
pRequest
->
requestId
);
}
void
stopAllQueries
(
SRequestObj
*
pRequest
)
{
int32_t
reqIdx
=
-
1
;
SRequestObj
*
pReqList
[
16
]
=
{
NULL
};
uint64_t
tmpRefId
=
0
;
if
(
pRequest
->
relation
.
userRefId
&&
pRequest
->
relation
.
userRefId
!=
pRequest
->
self
)
{
return
;
}
SRequestObj
*
pTmp
=
pRequest
;
while
(
pTmp
->
relation
.
prevRefId
)
{
tmpRefId
=
pTmp
->
relation
.
prevRefId
;
pTmp
=
acquireRequest
(
tmpRefId
);
if
(
pTmp
)
{
pReqList
[
++
reqIdx
]
=
pTmp
;
releaseRequest
(
tmpRefId
);
}
else
{
tscError
(
"0x%"
PRIx64
", prev req ref 0x%"
PRIx64
" is not there, reqId:0x%"
PRIx64
,
pTmp
->
self
,
tmpRefId
,
pTmp
->
requestId
);
break
;
}
}
for
(
int32_t
i
=
reqIdx
;
i
>=
0
;
i
--
)
{
taosStopQueryImpl
(
pReqList
[
i
]);
}
taosStopQueryImpl
(
pRequest
);
tmpRefId
=
pRequest
->
relation
.
nextRefId
;
while
(
tmpRefId
)
{
pTmp
=
acquireRequest
(
tmpRefId
);
if
(
pTmp
)
{
tmpRefId
=
pTmp
->
relation
.
nextRefId
;
taosStopQueryImpl
(
pTmp
);
releaseRequest
(
pTmp
->
self
);
}
else
{
tscError
(
"0x%"
PRIx64
" is not there"
,
tmpRefId
);
break
;
}
}
}
void
crashReportThreadFuncUnexpectedStopped
(
void
)
{
atomic_store_32
(
&
clientStop
,
-
1
);
}
static
void
*
tscCrashReportThreadFp
(
void
*
param
)
{
...
...
source/client/src/clientHb.c
浏览文件 @
59b8cfbc
...
...
@@ -464,6 +464,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc
.
useconds
=
now
-
pRequest
->
metric
.
start
;
desc
.
reqRid
=
pRequest
->
self
;
desc
.
stableQuery
=
pRequest
->
stableQuery
;
desc
.
isSubQuery
=
pRequest
->
isSubReq
;
taosGetFqdn
(
desc
.
fqdn
);
desc
.
subPlanNum
=
pRequest
->
body
.
subplanNum
;
...
...
source/client/src/clientImpl.c
浏览文件 @
59b8cfbc
...
...
@@ -243,6 +243,7 @@ int32_t buildPreviousRequest(SRequestObj *pRequest, const char* sql, SRequestObj
pRequest
->
relation
.
prevRefId
=
(
*
pNewRequest
)
->
self
;
(
*
pNewRequest
)
->
relation
.
nextRefId
=
pRequest
->
self
;
(
*
pNewRequest
)
->
relation
.
userRefId
=
pRequest
->
self
;
(
*
pNewRequest
)
->
isSubReq
=
true
;
}
return
code
;
}
...
...
source/client/src/clientMain.c
浏览文件 @
59b8cfbc
...
...
@@ -563,22 +563,13 @@ int taos_select_db(TAOS *taos, const char *db) {
return
code
;
}
void
taos_stop_query
(
TAOS_RES
*
res
)
{
if
(
res
==
NULL
||
TD_RES_TMQ
(
res
)
||
TD_RES_TMQ_META
(
res
)
||
TD_RES_TMQ_METADATA
(
res
))
{
return
;
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
pRequest
->
killed
=
true
;
// It is not a query, no need to stop.
if
(
NULL
==
pRequest
->
pQuery
||
QUERY_EXEC_MODE_SCHEDULE
!=
pRequest
->
pQuery
->
execMode
)
{
tscDebug
(
"request 0x%"
PRIx64
" no need to be killed since not query"
,
pRequest
->
requestId
);
return
;
}
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
TSDB_CODE_TSC_QUERY_KILLED
);
tscDebug
(
"request %"
PRIx64
" killed"
,
pRequest
->
requestId
);
stopAllQueries
((
SRequestObj
*
)
res
);
}
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
)
{
...
...
@@ -860,7 +851,7 @@ int32_t cloneCatalogReq(SCatalogReq* * ppTarget, SCatalogReq* pSrc) {
void
handleSubQueryFromAnalyse
(
SSqlCallbackWrapper
*
pWrapper
,
SMetaData
*
pResultMeta
,
SNode
*
pRoot
)
{
SRequestObj
*
pNewRequest
=
NULL
;
SSqlCallbackWrapper
*
pNewWrapper
=
NULL
;
int32_t
code
=
buildPreviousRequest
(
pWrapper
->
pRequest
,
""
,
&
pNewRequest
);
int32_t
code
=
buildPreviousRequest
(
pWrapper
->
pRequest
,
pWrapper
->
pRequest
->
sqlstr
,
&
pNewRequest
);
if
(
code
)
{
handleQueryAnslyseRes
(
pWrapper
,
pResultMeta
,
code
);
return
;
...
...
source/common/src/systable.c
浏览文件 @
59b8cfbc
...
...
@@ -381,6 +381,7 @@ static const SSysDbTableSchema querySchema[] = {
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
sysInfo
=
false
},
{.
name
=
"exec_usec"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
,
.
sysInfo
=
false
},
{.
name
=
"stable_query"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_BOOL
,
.
sysInfo
=
false
},
{.
name
=
"sub_query"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_BOOL
,
.
sysInfo
=
false
},
{.
name
=
"sub_num"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
,
.
sysInfo
=
false
},
{.
name
=
"sub_status"
,
.
bytes
=
TSDB_SHOW_SUBQUERY_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
false
},
{.
name
=
"sql"
,
.
bytes
=
TSDB_SHOW_SQL_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
,
.
sysInfo
=
false
},
...
...
source/common/src/tmsg.c
浏览文件 @
59b8cfbc
...
...
@@ -224,6 +224,7 @@ static int32_t tSerializeSClientHbReq(SEncoder *pEncoder, const SClientHbReq *pR
if
(
tEncodeI64
(
pEncoder
,
desc
->
stime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pEncoder
,
desc
->
reqRid
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
desc
->
stableQuery
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
desc
->
isSubQuery
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pEncoder
,
desc
->
fqdn
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
desc
->
subPlanNum
)
<
0
)
return
-
1
;
...
...
@@ -291,6 +292,7 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq)
if
(
tDecodeI64
(
pDecoder
,
&
desc
.
stime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pDecoder
,
&
desc
.
reqRid
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
(
int8_t
*
)
&
desc
.
stableQuery
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
(
int8_t
*
)
&
desc
.
isSubQuery
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pDecoder
,
desc
.
fqdn
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
desc
.
subPlanNum
)
<
0
)
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
59b8cfbc
...
...
@@ -834,6 +834,9 @@ static int32_t mndRetrieveQueries(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pQuery
->
stableQuery
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pQuery
->
isSubQuery
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pQuery
->
subPlanNum
,
false
);
...
...
source/libs/executor/src/exchangeoperator.c
浏览文件 @
59b8cfbc
...
...
@@ -204,6 +204,8 @@ static SSDataBlock* loadRemoteData(SOperatorInfo* pOperator) {
SExchangeInfo
*
pExchangeInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
taosSsleep
(
5
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录