From d89806970e6866fe53871a33e392ca0193c2cdfe Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 27 Aug 2024 17:27:15 +0800 Subject: [PATCH] fix(tsdb): update log. --- source/dnode/vnode/src/tsdb/tsdbRead2.c | 31 ++++++++++++++----------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead2.c b/source/dnode/vnode/src/tsdb/tsdbRead2.c index 391b7f636d..4063c0cf99 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead2.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead2.c @@ -45,7 +45,7 @@ typedef struct { bool moreThanCapcity; } SDataBlockToLoadInfo; -static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo); +static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* idStr); static int32_t buildDataBlockFromBufImpl(STableBlockScanInfo* pBlockScanInfo, int64_t endKey, int32_t capacity, STsdbReader* pReader); static void getValidMemRow(SIterInfo* pIter, const SArray* pDelList, STsdbReader* pReader, TSDBROW** pRes); @@ -920,7 +920,7 @@ static int32_t doCopyColVal(SColumnInfoData* pColInfoData, int32_t rowIndex, int return code; } -static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo) { +static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInfo** pInfo, const char* id) { *pInfo = NULL; if (pBlockIter->blockList == NULL) { @@ -929,8 +929,10 @@ static int32_t getCurrentBlockInfo(SDataBlockIter* pBlockIter, SFileDataBlockInf size_t num = TARRAY_SIZE(pBlockIter->blockList); if (num == 0) { - tsdbError("tsdb read failed at: %s:%d", __func__, __LINE__); - return TSDB_CODE_INTERNAL_ERROR; + if (num != pBlockIter->numOfBlocks) { + tsdbError("tsdb read failed at: %s:%d %s", __func__, __LINE__, id); + } + return TSDB_CODE_FAILED; } *pInfo = taosArrayGet(pBlockIter->blockList, pBlockIter->index); @@ -1207,7 +1209,7 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, SRowKey* pLastPro bool asc = ASCENDING_TRAVERSE(pReader->info.order); int32_t step = asc ? 1 : -1; - code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -1435,7 +1437,7 @@ static int32_t doLoadFileBlockData(STsdbReader* pReader, SDataBlockIter* pBlockI } } - code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2787,7 +2789,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { SSttBlockReader* pSttBlockReader = pReader->status.fileIter.pSttBlockReader; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; - code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return 0; } @@ -2836,7 +2838,8 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) { pDumpInfo->rowIndex += step; if (pDumpInfo->rowIndex >= pBlockData->nRow || pDumpInfo->rowIndex < 0) { - code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); // NOTE: get the new block info + // NOTE: get the new block info + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { goto _end; } @@ -3310,7 +3313,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { bool asc = ASCENDING_TRAVERSE(pReader->info.order); int32_t code = TSDB_CODE_SUCCESS; - code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -3530,7 +3533,7 @@ static void initBlockDumpInfo(STsdbReader* pReader, SDataBlockIter* pBlockIter) SReaderStatus* pStatus = &pReader->status; SFileBlockDumpInfo* pDumpInfo = &pStatus->fBlockDumpInfo; - int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + int32_t code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr); if (code == TSDB_CODE_SUCCESS) { pDumpInfo->totalRows = pBlockInfo->numRow; pDumpInfo->rowIndex = ASCENDING_TRAVERSE(pReader->info.order) ? 0 : pBlockInfo->numRow - 1; @@ -4115,7 +4118,7 @@ int32_t doMergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pSc CHECK_FILEBLOCK_STATE st; SFileDataBlockInfo* pFileBlockInfo = NULL; - code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo); + code = getCurrentBlockInfo(&pReader->status.blockIter, &pFileBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -5372,7 +5375,7 @@ int32_t tsdbRetrieveDatablockSMA2(STsdbReader* pReader, SSDataBlock* pDataBlock, return TSDB_CODE_SUCCESS; } - code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo); + code = getCurrentBlockInfo(&pReader->status.blockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -5462,7 +5465,7 @@ static int32_t doRetrieveDataBlock(STsdbReader* pReader, SSDataBlock** pBlock) { SFileDataBlockInfo* pBlockInfo = NULL; *pBlock = NULL; - code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo); + code = getCurrentBlockInfo(&pStatus->blockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -5678,7 +5681,7 @@ int32_t tsdbGetFileBlocksDistInfo2(STsdbReader* pReader, STableBlockDistInfo* pT while (true) { if (hasNext) { SFileDataBlockInfo* pBlockInfo = NULL; - code = getCurrentBlockInfo(pBlockIter, &pBlockInfo); + code = getCurrentBlockInfo(pBlockIter, &pBlockInfo, pReader->idStr); if (code != TSDB_CODE_SUCCESS) { break; }