Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f7434783
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f7434783
编写于
3月 25, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-32]use code to denote if query is killed or not
上级
737d4c10
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
38 deletion
+33
-38
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+19
-24
src/vnode/detail/src/vnodeQueryImpl.c
src/vnode/detail/src/vnodeQueryImpl.c
+2
-2
src/vnode/detail/src/vnodeQueryProcess.c
src/vnode/detail/src/vnodeQueryProcess.c
+12
-12
未找到文件。
src/query/src/queryExecutor.c
浏览文件 @
f7434783
...
...
@@ -1599,7 +1599,8 @@ static void teardownQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv) {
pRuntimeEnv
->
pTSBuf
=
tsBufDestory
(
pRuntimeEnv
->
pTSBuf
);
}
static
bool
isQueryKilled
(
SQuery
*
pQuery
)
{
static
bool
isQueryKilled
(
SQInfo
*
pQInfo
)
{
return
(
pQInfo
->
code
==
TSDB_CODE_QUERY_CANCELLED
);
#if 0
/*
* check if the queried meter is going to be deleted.
...
...
@@ -1613,8 +1614,6 @@ static bool isQueryKilled(SQuery *pQuery) {
return (pQInfo->killed == 1);
#endif
return
0
;
}
static
bool
setQueryKilled
(
SQInfo
*
pQInfo
)
{
...
...
@@ -2641,7 +2640,7 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
while
(
tsdbNextDataBlock
(
pQueryHandle
))
{
// check if query is killed or not set the status of query to pass the status check
if
(
isQueryKilled
(
pQuery
))
{
if
(
isQueryKilled
(
GET_QINFO_ADDR
(
pRuntimeEnv
)
))
{
return
cnt
;
}
...
...
@@ -3607,7 +3606,7 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) {
pRuntimeEnv
->
scanFlag
=
REPEAT_SCAN
;
/* check if query is killed or not */
if
(
isQueryKilled
(
pQuery
))
{
if
(
isQueryKilled
(
GET_QINFO_ADDR
(
pRuntimeEnv
)
))
{
// setQueryStatus(pQuery, QUERY_NO_DATA_TO_CHECK);
return
;
}
...
...
@@ -4394,14 +4393,10 @@ static void queryOnDataBlocks(SQInfo *pQInfo, STableDataInfo *pMeterDataInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
// SMeterObj * pTempMeter = getMeterObj(pSupporter->pMetersHashTable, pSupporter->pMeterSidExtInfo[0]->sid);
// __block_search_fn_t searchFn = vnodeSearchKeyFunc[pTempMeter->searchAlgorithm];
// dTrace("QInfo:%p start to check data blocks in %d files", pQInfo, pVnodeFileInfo->numOfFiles);
tsdb_query_handle_t
*
pQueryHandle
=
pRuntimeEnv
->
pQueryHandle
;
while
(
tsdbNextDataBlock
(
pQueryHandle
))
{
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
break
;
}
...
...
@@ -4583,7 +4578,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
pSupporter->meterIdx = start;
for (int32_t k = start; k <= end; ++k, pSupporter->meterIdx++) {
if (isQueryKilled(pQ
uery
)) {
if (isQueryKilled(pQ
Info
)) {
setQueryStatus(pQuery, QUERY_NO_DATA_TO_CHECK);
return;
}
...
...
@@ -4610,7 +4605,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
pSupporter->subgroupIdx);
for (int32_t k = start; k <= end; ++k) {
if (isQueryKilled(pQ
uery
)) {
if (isQueryKilled(pQ
Info
)) {
setQueryStatus(pQuery, QUERY_NO_DATA_TO_CHECK);
return;
}
...
...
@@ -4661,7 +4656,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
while (pSupporter->meterIdx < pSupporter->numOfMeters) {
int32_t k = pSupporter->meterIdx;
if (isQueryKilled(pQ
uery
)) {
if (isQueryKilled(pQ
Info
)) {
setQueryStatus(pQuery, QUERY_NO_DATA_TO_CHECK);
return;
}
...
...
@@ -4955,7 +4950,7 @@ static void vnodeMultiMeterQueryProcessor(SQInfo *pQInfo) {
doMultiMeterSupplementaryScan(pQInfo);
if (isQueryKilled(pQ
uery
)) {
if (isQueryKilled(pQ
Info
)) {
dTrace("QInfo:%p query killed, abort", pQInfo);
return;
}
...
...
@@ -4994,7 +4989,7 @@ static void tableFixedOutputProcessor(SQInfo *pQInfo) {
vnodeScanAllData
(
pRuntimeEnv
);
doFinalizeResult
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -5027,7 +5022,7 @@ static void tableMultiOutputProcessor(SQInfo *pQInfo) {
vnodeScanAllData
(
pRuntimeEnv
);
doFinalizeResult
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -5074,7 +5069,7 @@ static void vnodeSingleMeterIntervalMainLooper(SQueryRuntimeEnv *pRuntimeEnv) {
initCtxOutputBuf
(
pRuntimeEnv
);
vnodeScanAllData
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQuery
))
{
if
(
isQueryKilled
(
GET_QINFO_ADDR
(
pRuntimeEnv
)
))
{
return
;
}
...
...
@@ -5177,7 +5172,7 @@ void qTableQuery(SQInfo *pQInfo) {
SQueryRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
dTrace
(
"QInfo:%p it is already killed, abort"
,
pQInfo
);
return
;
}
...
...
@@ -5267,7 +5262,7 @@ void qTableQuery(SQInfo *pQInfo) {
pQInfo
->
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
);
/* check if query is killed or not */
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
dTrace
(
"QInfo:%p query is killed"
,
pQInfo
);
}
else
{
dTrace
(
"QInfo:%p query task completed, %d points are returned"
,
pQInfo
,
pQuery
->
rec
.
pointsRead
);
...
...
@@ -5309,7 +5304,7 @@ void qSuperTableQuery(void *pReadMsg) {
/* record the total elapsed time */
pQInfo->elapsedTime += (taosGetTimestampUs() - st);
pQuery->status = isQueryKilled(pQ
uery
) ? 1 : 0;
pQuery->status = isQueryKilled(pQ
Info
) ? 1 : 0;
// taosInterpoSetStartInfo(&pQInfo->runtimeEnv.interpoInfo, pQuery->pointsRead,
// pQInfo->query.interpoType);
...
...
@@ -6172,7 +6167,7 @@ int32_t qRetrieveQueryResultInfo(SQInfo *pQInfo, int32_t *numOfRows, int32_t *ro
}
SQuery
*
pQuery
=
pQInfo
->
runtimeEnv
.
pQuery
;
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
dTrace
(
"QInfo:%p query is killed, code:%d"
,
pQInfo
,
pQInfo
->
code
);
if
(
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_QUERY_CANCELLED
;
...
...
@@ -6289,11 +6284,11 @@ int32_t qDumpRetrieveResult(SQInfo *pQInfo, SRetrieveTableRsp** pRsp, int32_t* c
// has more data to return or need next round to execute
addToTaskQueue
(
pQInfo
);
}
else
if
(
isQueryKilled
(
pQuery
))
{
code
=
TSDB_CODE_QUERY_CANCELLED
;
}
else
{
code
=
pQInfo
->
code
;
}
if
(
isQueryKilled
(
pQ
uery
)
||
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
if
(
isQueryKilled
(
pQ
Info
)
||
Q_STATUS_EQUAL
(
pQuery
->
status
,
QUERY_COMPLETED
))
{
(
*
pRsp
)
->
completed
=
1
;
// notify no more result to client
vnodeFreeQInfo
(
pQInfo
);
}
...
...
src/vnode/detail/src/vnodeQueryImpl.c
浏览文件 @
f7434783
...
...
@@ -5312,7 +5312,7 @@ static int64_t doScanAllDataBlocks(SQueryRuntimeEnv *pRuntimeEnv) {
while
(
1
)
{
// check if query is killed or not set the status of query to pass the status check
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
cnt
;
}
...
...
@@ -6375,7 +6375,7 @@ void vnodeScanAllData(SQueryRuntimeEnv *pRuntimeEnv) {
pRuntimeEnv
->
scanFlag
=
REPEAT_SCAN
;
/* check if query is killed or not */
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
}
...
...
src/vnode/detail/src/vnodeQueryProcess.c
浏览文件 @
f7434783
...
...
@@ -105,7 +105,7 @@ static void queryOnMultiDataCache(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
int32_t
start
=
pSupporter
->
pSidSet
->
starterPos
[
groupIdx
];
int32_t
end
=
pSupporter
->
pSidSet
->
starterPos
[
groupIdx
+
1
]
-
1
;
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -276,7 +276,7 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
int64_t
st
=
taosGetTimestampUs
();
while
(
1
)
{
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
break
;
}
...
...
@@ -363,7 +363,7 @@ static void queryOnMultiDataFiles(SQInfo *pQInfo, SMeterDataInfo *pMeterDataInfo
int32_t
j
=
QUERY_IS_ASC_QUERY
(
pQuery
)
?
0
:
numOfBlocks
-
1
;
for
(;
j
<
numOfBlocks
&&
j
>=
0
;
j
+=
step
)
{
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
break
;
}
...
...
@@ -603,7 +603,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
pSupporter
->
meterIdx
=
start
;
for
(
int32_t
k
=
start
;
k
<=
end
;
++
k
,
pSupporter
->
meterIdx
++
)
{
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
}
...
...
@@ -630,7 +630,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
pSupporter
->
subgroupIdx
);
for
(
int32_t
k
=
start
;
k
<=
end
;
++
k
)
{
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
}
...
...
@@ -681,7 +681,7 @@ static void vnodeSTableSeqProcessor(SQInfo *pQInfo) {
while
(
pSupporter
->
meterIdx
<
pSupporter
->
numOfMeters
)
{
int32_t
k
=
pSupporter
->
meterIdx
;
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
setQueryStatus
(
pQuery
,
QUERY_NO_DATA_TO_CHECK
);
return
;
}
...
...
@@ -958,7 +958,7 @@ static void vnodeMultiMeterQueryProcessor(SQInfo *pQInfo) {
doMultiMeterSupplementaryScan
(
pQInfo
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
dTrace
(
"QInfo:%p query killed, abort"
,
pQInfo
);
return
;
}
...
...
@@ -998,7 +998,7 @@ static void vnodeSingleTableFixedOutputProcessor(SQInfo *pQInfo) {
vnodeScanAllData
(
pRuntimeEnv
);
doFinalizeResult
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -1033,7 +1033,7 @@ static void vnodeSingleTableMultiOutputProcessor(SQInfo *pQInfo) {
vnodeScanAllData
(
pRuntimeEnv
);
doFinalizeResult
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -1087,7 +1087,7 @@ static void vnodeSingleMeterIntervalMainLooper(STableQuerySupportObj *pSupporter
initCtxOutputBuf
(
pRuntimeEnv
);
vnodeScanAllData
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
return
;
}
...
...
@@ -1301,7 +1301,7 @@ void vnodeSingleTableQuery(SSchedMsg *pMsg) {
pQInfo
->
useconds
+=
(
taosGetTimestampUs
()
-
st
);
/* check if query is killed or not */
if
(
isQueryKilled
(
pQ
uery
))
{
if
(
isQueryKilled
(
pQ
Info
))
{
dTrace
(
"QInfo:%p query is killed"
,
pQInfo
);
pQInfo
->
over
=
1
;
}
else
{
...
...
@@ -1345,7 +1345,7 @@ void vnodeMultiMeterQuery(SSchedMsg *pMsg) {
/* record the total elapsed time */
pQInfo
->
useconds
+=
(
taosGetTimestampUs
()
-
st
);
pQInfo
->
over
=
isQueryKilled
(
pQ
uery
)
?
1
:
0
;
pQInfo
->
over
=
isQueryKilled
(
pQ
Info
)
?
1
:
0
;
taosInterpoSetStartInfo
(
&
pQInfo
->
pTableQuerySupporter
->
runtimeEnv
.
interpoInfo
,
pQuery
->
pointsRead
,
pQInfo
->
query
.
interpoType
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录