From 77097dc14f2cc648dd2ba9f2929cabf6a181fc56 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 6 Aug 2024 10:39:51 +0800 Subject: [PATCH] fix: check return value and fix bugs. --- source/libs/executor/src/tsort.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/libs/executor/src/tsort.c b/source/libs/executor/src/tsort.c index 300d7576d9..755eef4431 100644 --- a/source/libs/executor/src/tsort.c +++ b/source/libs/executor/src/tsort.c @@ -469,10 +469,10 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) { int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "sortExternalBuf", tsTempDir); - dBufSetPrintInfo(pHandle->pBuf); if (code != TSDB_CODE_SUCCESS) { return code; } + dBufSetPrintInfo(pHandle->pBuf); } SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t)); @@ -562,10 +562,10 @@ static int32_t sortComparInit(SMsortComparParam* pParam, SArray* pSources, int32 code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "sortComparInit", tsTempDir); - dBufSetPrintInfo(pHandle->pBuf); if (code != TSDB_CODE_SUCCESS) { - terrno = code; return code; + } else { + dBufSetPrintInfo(pHandle->pBuf); } } @@ -1111,9 +1111,10 @@ static int32_t createPageBuf(SSortHandle* pHandle) { int32_t code = createDiskbasedBuf(&pHandle->pBuf, pHandle->pageSize, pHandle->numOfPages * pHandle->pageSize, "tableBlocksBuf", tsTempDir); - dBufSetPrintInfo(pHandle->pBuf); if (code != TSDB_CODE_SUCCESS) { return code; + } else { + dBufSetPrintInfo(pHandle->pBuf); } } return 0;