From 2b7b433a95637390a2ed130c51ad181475b90854 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 4 Jan 2022 10:30:57 +0800 Subject: [PATCH] [td-11818] fix deadlock. --- source/client/src/clientMain.c | 4 +++- source/libs/scheduler/src/scheduler.c | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index e7c44d9f28..e5f3eba5c2 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -29,7 +29,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) { // this function may be called by user or system, or by both simultaneously. void taos_cleanup(void) { - tscDebug("start to cleanup client environment"); + tscInfo("start to cleanup client environment"); if (atomic_val_compare_exchange_32(&sentinel, TSC_VAR_NOT_RELEASE, TSC_VAR_RELEASED) != TSC_VAR_NOT_RELEASE) { return; @@ -47,6 +47,8 @@ void taos_cleanup(void) { rpcCleanup(); taosCloseLog(); + + tscInfo("all local resources released"); } TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 8ef67a8e93..bcdbc57798 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -456,15 +456,27 @@ int32_t schProcessOnTaskFailure(SSchJob *job, SSchTask *task, int32_t errCode) { int32_t schProcessRspMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *msg, int32_t msgSize, int32_t rspCode) { int32_t code = 0; - + + switch (msgType) { + case TDMT_VND_CREATE_TABLE_RSP: { + if (rspCode != TSDB_CODE_SUCCESS) { + SCH_ERR_JRET(schProcessOnTaskFailure(job, task, rspCode)); + } else { +// job->resNumOfRows += rsp->affectedRows; + code = schProcessOnTaskSuccess(job, task); + if (code) { + goto _task_error; + } + } + } case TDMT_VND_SUBMIT_RSP: { - SShellSubmitRspMsg *rsp = (SShellSubmitRspMsg *)msg; - if (rsp->code != TSDB_CODE_SUCCESS) { - SCH_ERR_JRET(schProcessOnTaskFailure(job, task, rsp->code)); + if (rspCode != TSDB_CODE_SUCCESS) { + SCH_ERR_JRET(schProcessOnTaskFailure(job, task, rspCode)); } else { + SShellSubmitRspMsg *rsp = (SShellSubmitRspMsg *)msg; job->resNumOfRows += rsp->affectedRows; - + code = schProcessOnTaskSuccess(job, task); if (code) { goto _task_error;