From e8123a9422d4de27b1537523d488f445e60c5197 Mon Sep 17 00:00:00 2001 From: wangjiaming0909 <604227650@qq.com> Date: Tue, 10 Sep 2024 11:13:31 +0800 Subject: [PATCH] fix tdb/client eating error codes caused creating tsma blocking --- source/client/src/clientImpl.c | 8 ++++++-- source/dnode/vnode/src/meta/metaQuery.c | 12 ++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index b9a00f4434..d77b8dcbb7 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -1068,6 +1068,7 @@ static int32_t createResultBlock(TAOS_RES* pRes, int32_t numOfRows, SSDataBlock* TAOS_ROW pRow = taos_fetch_row(pRes); if (NULL == pRow[0] || NULL == pRow[1] || NULL == pRow[2]) { tscError("invalid data from vnode"); + blockDataDestroy(*pBlock); return TSDB_CODE_TSC_INTERNAL_ERROR; } int64_t ts = *(int64_t*)pRow[0]; @@ -1102,8 +1103,11 @@ void postSubQueryFetchCb(void* param, TAOS_RES* res, int32_t rowNum) { } SSDataBlock* pBlock = NULL; - if (TSDB_CODE_SUCCESS != createResultBlock(res, rowNum, &pBlock)) { - tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64, pRequest->self, pRequest->requestId); + pRequest->code = createResultBlock(res, rowNum, &pBlock); + if (TSDB_CODE_SUCCESS != pRequest->code) { + tscError("0x%" PRIx64 ", create result block failed,QID:0x%" PRIx64 " %s", pRequest->self, pRequest->requestId, + tstrerror(pRequest->code)); + returnToUser(pRequest); return; } diff --git a/source/dnode/vnode/src/meta/metaQuery.c b/source/dnode/vnode/src/meta/metaQuery.c index 725d16d86f..acee24e494 100644 --- a/source/dnode/vnode/src/meta/metaQuery.c +++ b/source/dnode/vnode/src/meta/metaQuery.c @@ -54,8 +54,8 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u STbDbKey tbDbKey = {.version = version, .uid = uid}; // query table.db - if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf) < 0) { - return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; + if ((code = tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &pReader->pBuf, &pReader->szBuf)) < 0) { + return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code); } // decode the entry @@ -98,8 +98,9 @@ int metaReaderGetTableEntryByUidCache(SMetaReader *pReader, tb_uid_t uid) { SMeta *pMeta = pReader->pMeta; SMetaInfo info; - if (metaGetInfo(pMeta, uid, &info, pReader) == TSDB_CODE_NOT_FOUND) { - return terrno = TSDB_CODE_PAR_TABLE_NOT_EXIST; + int32_t code = metaGetInfo(pMeta, uid, &info, pReader); + if (TSDB_CODE_SUCCESS != code) { + return terrno = (TSDB_CODE_NOT_FOUND == code ? TSDB_CODE_PAR_TABLE_NOT_EXIST : code); } return metaGetTableEntryByVersion(pReader, info.version, uid); @@ -1584,10 +1585,9 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR } // search TDB - if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) { + if ((code = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData)) < 0) { // not found if (!lock) metaULock(pMeta); - code = TSDB_CODE_NOT_FOUND; goto _exit; }