From 156567b9bc4e91904d0e6db3a884838078fc8f10 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Fri, 29 Jul 2022 09:01:35 +0800 Subject: [PATCH] fix: fix show queries crash and error msg --- include/util/taoserror.h | 1 + source/client/src/clientHb.c | 1 + source/common/src/tmsg.c | 2 ++ source/libs/parser/src/parTranslater.c | 2 +- source/libs/parser/src/parUtil.c | 2 ++ source/libs/scheduler/src/schJob.c | 2 +- source/util/src/terror.c | 1 + 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 3493cbb3a3..da2f58307d 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -555,6 +555,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F) #define TSDB_CODE_PAR_INVALID_SMA_INDEX TAOS_DEF_ERROR_CODE(0, 0x2660) #define TSDB_CODE_PAR_INVALID_SELECTED_EXPR TAOS_DEF_ERROR_CODE(0, 0x2661) +#define TSDB_CODE_PAR_GET_META_ERROR TAOS_DEF_ERROR_CODE(0, 0x2662) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) //planner diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 6a583842d1..3d6cf1c626 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -353,6 +353,7 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) { desc.subDesc = NULL; desc.subPlanNum = 0; } + ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); } else { desc.subDesc = NULL; } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 3163982dec..05b27546eb 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -305,6 +305,8 @@ static int32_t tDeserializeSClientHbReq(SDecoder *pDecoder, SClientHbReq *pReq) taosArrayPush(desc.subDesc, &sDesc); } } + + ASSERT(desc.subPlanNum == taosArrayGetSize(desc.subDesc)); taosArrayPush(pReq->query->queryDesc, &desc); } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 5cba920a43..4dfae222f2 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -1857,7 +1857,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { pCxt, toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, pRealTable->table.tableName, &name), &(pRealTable->pMeta)); if (TSDB_CODE_SUCCESS != code) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code)); } code = setTableVgroupList(pCxt, &name, pRealTable); if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 79d6f3b8e8..e51800aece 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -31,6 +31,8 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Invalid column name: %s"; case TSDB_CODE_PAR_TABLE_NOT_EXIST: return "Table does not exist: %s"; + case TSDB_CODE_PAR_GET_META_ERROR: + return "Fail to get table info, error: %s"; case TSDB_CODE_PAR_AMBIGUOUS_COLUMN: return "Column ambiguously defined: %s"; case TSDB_CODE_PAR_WRONG_VALUE_TYPE: diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index 50f8b91023..46140ccdff 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -916,7 +916,7 @@ int32_t schProcessOnOpBegin(SSchJob* pJob, SCH_OP_TYPE type, SSchedulerReq* pReq qDebug("job not initialized or not executable job, refId:0x%" PRIx64, pJob->refId); SCH_ERR_RET(TSDB_CODE_SCH_STATUS_ERROR); } - break; + return TSDB_CODE_SUCCESS; default: SCH_JOB_ELOG("unknown operation type %d", type); SCH_ERR_RET(TSDB_CODE_TSC_APP_ERROR); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index f8d8e9d168..f20c5d8593 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -559,6 +559,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN, "Not valid function TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE, "Only support single table") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SMA_INDEX, "Invalid sma index") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_SELECTED_EXPR, "Invalid SELECTed expression") +TAOS_DEFINE_ERROR(TSDB_CODE_PAR_GET_META_ERROR, "Fail to get table info") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") //planner -- GitLab