fix: keep the stt iterator valid
This commit is contained in:
parent
b85c1ae8a1
commit
fef091b13d
|
@ -792,7 +792,6 @@ typedef struct SLDataIter {
|
|||
SVersionRange verRange;
|
||||
SSttBlockLoadInfo *pBlockLoadInfo;
|
||||
bool ignoreEarlierTs;
|
||||
bool bInit;
|
||||
struct SSttFileReader *pReader;
|
||||
} SLDataIter;
|
||||
|
||||
|
|
|
@ -146,10 +146,8 @@ void *destroySttBlockReader(SArray *pLDataIterArray, int64_t *blocks, double *el
|
|||
SArray *pList = taosArrayGetP(pLDataIterArray, i);
|
||||
for (int32_t j = 0; j < taosArrayGetSize(pList); ++j) {
|
||||
SLDataIter *pIter = taosArrayGetP(pList, j);
|
||||
if (pIter->bInit) {
|
||||
*el += pIter->pBlockLoadInfo->elapsedTime;
|
||||
*blocks += pIter->pBlockLoadInfo->loadBlocks;
|
||||
}
|
||||
*el += pIter->pBlockLoadInfo->elapsedTime;
|
||||
*blocks += pIter->pBlockLoadInfo->loadBlocks;
|
||||
destroyLDataIter(pIter);
|
||||
}
|
||||
taosArrayDestroy(pList);
|
||||
|
@ -446,6 +444,13 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
|
|||
pIter->pReader = pSttFileReader;
|
||||
pIter->pBlockLoadInfo = pBlockLoadInfo;
|
||||
|
||||
if (pIter->pReader == NULL) {
|
||||
tsdbError("stt file reader is null, %s", idStr);
|
||||
pIter->pSttBlk = NULL;
|
||||
pIter->iSttBlk = -1;
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
if (!pBlockLoadInfo->sttBlockLoaded) {
|
||||
int64_t st = taosGetTimestampUs();
|
||||
|
||||
|
@ -837,7 +842,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
|
|||
|
||||
code = tsdbSttFileReaderOpen(pSttLevel->fobjArr->data[i]->fname, &conf, &pSttFileReader);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
return code;
|
||||
tsdbError("open stt file reader error. file name %s, code %s, %s", pSttLevel->fobjArr->data[i]->fname,
|
||||
tstrerror(code), pMTree->idStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -852,7 +858,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
|
|||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _end;
|
||||
}
|
||||
pIter->bInit = true;
|
||||
|
||||
bool hasVal = tLDataIterNextRow(pIter, pMTree->idStr);
|
||||
if (hasVal) {
|
||||
tMergeTreeAddIter(pMTree, pIter);
|
||||
|
|
Loading…
Reference in New Issue