diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index d59ede920fed27659fc2aa6d3bceb662ee2b5956..c7429b5fe8db96cdaa2ec2486ab0fbb83f7f8b31 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -1234,7 +1234,6 @@ static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t c static void moveDataToFront(STsdbQueryHandle* pQueryHandle, int32_t numOfRows, int32_t numOfCols); static void doCheckGeneratedBlockRange(STsdbQueryHandle* pQueryHandle); static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SDataBlockInfo* pBlockInfo, int32_t endPos); -static TSKEY extractFirstTraverseKey(STableCheckInfo* pCheckInfo, int32_t order, int32_t update); static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* pBlock, STableCheckInfo* pCheckInfo){ SQueryFilePos* cur = &pQueryHandle->cur; @@ -1244,7 +1243,6 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p int32_t code = TSDB_CODE_SUCCESS; /*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo); - assert(cur->pos >= 0 && cur->pos <= binfo.rows); key = extractFirstTraverseKey(pCheckInfo, pQueryHandle->order, pCfg->update); @@ -1255,7 +1253,6 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p tsdbDebug("%p no data in mem, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId); } - if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) || (!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) { @@ -2706,6 +2703,7 @@ static bool loadBlockOfActiveTable(STsdbQueryHandle* pQueryHandle) { } if (exists) { + tsdbRetrieveDataBlock((TsdbQueryHandleT*) pQueryHandle, NULL); if (pQueryHandle->currentLoadExternalRows && pQueryHandle->window.skey == pQueryHandle->window.ekey) { SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, 0); assert(*(int64_t*)pColInfo->pData == pQueryHandle->window.skey);