Merge pull request #22289 from taosdata/szhou/fix-25385
fix: keep stt iterator valid
This commit is contained in:
commit
68f2018246
|
@ -413,6 +413,13 @@ int32_t tLDataIterOpen2(struct SLDataIter *pIter, SSttFileReader *pSttFileReader
|
||||||
pIter->pReader = pSttFileReader;
|
pIter->pReader = pSttFileReader;
|
||||||
pIter->pBlockLoadInfo = pBlockLoadInfo;
|
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) {
|
if (!pBlockLoadInfo->sttBlockLoaded) {
|
||||||
int64_t st = taosGetTimestampUs();
|
int64_t st = taosGetTimestampUs();
|
||||||
|
|
||||||
|
@ -783,6 +790,12 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
|
||||||
SLDataIter *pIter = taosMemoryCalloc(1, sizeof(SLDataIter));
|
SLDataIter *pIter = taosMemoryCalloc(1, sizeof(SLDataIter));
|
||||||
taosArrayPush(pList, &pIter);
|
taosArrayPush(pList, &pIter);
|
||||||
}
|
}
|
||||||
|
} else if (numOfIter > TARRAY2_SIZE(pSttLevel->fobjArr)){
|
||||||
|
int32_t inc = numOfIter - TARRAY2_SIZE(pSttLevel->fobjArr);
|
||||||
|
for (int i = 0; i < inc; ++i) {
|
||||||
|
SLDataIter *pIter = taosArrayPop(pList);
|
||||||
|
destroyLDataIter(pIter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < TARRAY2_SIZE(pSttLevel->fobjArr); ++i) { // open all last file
|
for (int32_t i = 0; i < TARRAY2_SIZE(pSttLevel->fobjArr); ++i) { // open all last file
|
||||||
|
@ -798,7 +811,8 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
|
||||||
|
|
||||||
code = tsdbSttFileReaderOpen(pSttLevel->fobjArr->data[i]->fname, &conf, &pSttFileReader);
|
code = tsdbSttFileReaderOpen(pSttLevel->fobjArr->data[i]->fname, &conf, &pSttFileReader);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -813,7 +827,7 @@ int32_t tMergeTreeOpen2(SMergeTree *pMTree, SMergeTreeConf *pConf) {
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasVal = tLDataIterNextRow(pIter, pMTree->idStr);
|
bool hasVal = tLDataIterNextRow(pIter, pMTree->idStr);
|
||||||
if (hasVal) {
|
if (hasVal) {
|
||||||
tMergeTreeAddIter(pMTree, pIter);
|
tMergeTreeAddIter(pMTree, pIter);
|
||||||
|
|
Loading…
Reference in New Issue