未验证 提交 7109800e 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17022 from taosdata/fix/TD-18148

fix: change qworker async destroy issue
......@@ -205,6 +205,7 @@ typedef struct SQWorker {
SHashObj *ctxHash; // key: queryId+taskId, value: SQWTaskCtx
SMsgCb msgCb;
SQWStat stat;
int32_t *destroyed;
} SQWorker;
typedef struct SQWorkerMgmt {
......
......@@ -485,6 +485,8 @@ void qwDestroyImpl(void *pMgmt) {
}
taosHashCleanup(mgmt->schHash);
*mgmt->destroyed = 1;
taosMemoryFree(mgmt);
atomic_sub_fetch_32(&gQwMgmt.qwNum, 1);
......
......@@ -1114,10 +1114,17 @@ void qWorkerDestroy(void **qWorkerMgmt) {
return;
}
int32_t destroyed = 0;
SQWorker *mgmt = *qWorkerMgmt;
mgmt->destroyed = &destroyed;
if (taosRemoveRef(gQwMgmt.qwRef, mgmt->refId)) {
qError("remove qw from ref list failed, refId:%" PRIx64, mgmt->refId);
return;
}
while (0 == destroyed) {
taosMsleep(2);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册