fix(query): reset index when moving to next file.
This commit is contained in:
parent
a7ba94939a
commit
f029df4876
|
@ -2327,15 +2327,17 @@ static TSDBKEY getCurrentKeyInBuf(STableBlockScanInfo* pScanInfo, STsdbReader* p
|
||||||
|
|
||||||
static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
|
static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum) {
|
||||||
SReaderStatus* pStatus = &pReader->status;
|
SReaderStatus* pStatus = &pReader->status;
|
||||||
|
pBlockNum->numOfBlocks = 0;
|
||||||
|
pBlockNum->numOfLastBlocks = 0;
|
||||||
|
|
||||||
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
|
size_t numOfTables = taosHashGetSize(pReader->status.pTableMap);
|
||||||
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBlockIdx));
|
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBlockIdx));
|
||||||
SArray* pLastBlocks = pStatus->fileIter.pLastBlockReader->pBlockL;
|
SArray* pLastBlocks = pStatus->fileIter.pLastBlockReader->pBlockL;
|
||||||
|
taosArrayClear(pLastBlocks);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
bool hasNext = filesetIteratorNext(&pStatus->fileIter, pReader);
|
bool hasNext = filesetIteratorNext(&pStatus->fileIter, pReader);
|
||||||
if (!hasNext) { // no data files on disk
|
if (!hasNext) { // no data files on disk
|
||||||
taosArrayClear(pLastBlocks);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2631,6 +2633,9 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
|
||||||
resetDataBlockIterator(pBlockIter, pReader->order, pReader->status.pTableMap);
|
resetDataBlockIterator(pBlockIter, pReader->order, pReader->status.pTableMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SLastBlockReader* pLReader = pReader->status.fileIter.pLastBlockReader;
|
||||||
|
pLReader->currentBlockIndex = -1;
|
||||||
|
|
||||||
// set the correct start position according to the query time window
|
// set the correct start position according to the query time window
|
||||||
initBlockDumpInfo(pReader, pBlockIter);
|
initBlockDumpInfo(pReader, pBlockIter);
|
||||||
return code;
|
return code;
|
||||||
|
|
Loading…
Reference in New Issue