Merge pull request #2589 from taosdata/hotfix/TD-481
support cancel query
This commit is contained in:
commit
5e86a28a3d
|
@ -438,8 +438,9 @@ void tscKillSTableQuery(SSqlObj *pSql) {
|
||||||
* here, we cannot set the command = TSDB_SQL_KILL_QUERY. Otherwise, it may cause
|
* here, we cannot set the command = TSDB_SQL_KILL_QUERY. Otherwise, it may cause
|
||||||
* sub-queries not correctly released and master sql object of super table query reaches an abnormal state.
|
* sub-queries not correctly released and master sql object of super table query reaches an abnormal state.
|
||||||
*/
|
*/
|
||||||
pSql->pSubs[i]->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
rpcCancelRequest(pSub->pRpcCtx);
|
||||||
rpcCancelRequest(pSql->pSubs[i]->pRpcCtx);
|
pSub->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
||||||
|
tscQueueAsyncRes(pSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -617,19 +617,18 @@ void taos_stop_query(TAOS_RES *res) {
|
||||||
if (pSql->signature != pSql) return;
|
if (pSql->signature != pSql) return;
|
||||||
tscDebug("%p start to cancel query", res);
|
tscDebug("%p start to cancel query", res);
|
||||||
|
|
||||||
pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
|
||||||
|
|
||||||
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
|
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
|
||||||
if (tscIsTwoStageSTableQuery(pQueryInfo, 0)) {
|
if (tscIsTwoStageSTableQuery(pQueryInfo, 0)) {
|
||||||
tscKillSTableQuery(pSql);
|
tscKillSTableQuery(pSql);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pSql->cmd.command >= TSDB_SQL_LOCAL) {
|
if (pSql->cmd.command < TSDB_SQL_LOCAL) {
|
||||||
return;
|
rpcCancelRequest(pSql->pRpcCtx);
|
||||||
}
|
}
|
||||||
|
pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED;
|
||||||
|
tscQueueAsyncRes(pSql);
|
||||||
|
|
||||||
rpcCancelRequest(pSql->pRpcCtx);
|
|
||||||
tscDebug("%p query is cancelled", res);
|
tscDebug("%p query is cancelled", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,10 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
|
||||||
} else {
|
} else {
|
||||||
assert(pQInfo == NULL);
|
assert(pQInfo == NULL);
|
||||||
}
|
}
|
||||||
|
if (handle != NULL) {
|
||||||
|
dnodePutItemIntoReadQueue(pVnode, handle);
|
||||||
|
qReleaseQInfo(pVnode->qMgmt, (void**) &handle, false);
|
||||||
|
}
|
||||||
vDebug("vgId:%d, QInfo:%p, dnode query msg disposed", vgId, pQInfo);
|
vDebug("vgId:%d, QInfo:%p, dnode query msg disposed", vgId, pQInfo);
|
||||||
} else {
|
} else {
|
||||||
assert(pCont != NULL);
|
assert(pCont != NULL);
|
||||||
|
@ -146,14 +149,10 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
|
||||||
} else {
|
} else {
|
||||||
vDebug("vgId:%d, QInfo:%p, dnode query msg in progress", pVnode->vgId, *(void**) pCont);
|
vDebug("vgId:%d, QInfo:%p, dnode query msg in progress", pVnode->vgId, *(void**) pCont);
|
||||||
code = TSDB_CODE_VND_ACTION_IN_PROGRESS;
|
code = TSDB_CODE_VND_ACTION_IN_PROGRESS;
|
||||||
|
qTableQuery(*handle); // do execute query
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (handle != NULL) {
|
|
||||||
qTableQuery(*handle); // do execute query
|
|
||||||
qReleaseQInfo(pVnode->qMgmt, (void**) &handle, false);
|
qReleaseQInfo(pVnode->qMgmt, (void**) &handle, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue