fix: commit bug

This commit is contained in:
Hongze Cheng 2022-09-01 14:24:47 +08:00
parent 1cfd3e74f9
commit 28e520656b
1 changed files with 34 additions and 27 deletions

View File

@ -332,7 +332,10 @@ static int32_t tsdbCommitterUpdateTableSchema(SCommitter *pCommitter, int64_t su
int32_t code = 0; int32_t code = 0;
if (suid) { if (suid) {
if (pCommitter->skmTable.suid == suid) goto _exit; if (pCommitter->skmTable.suid == suid) {
pCommitter->skmTable.uid = uid;
goto _exit;
}
} else { } else {
if (pCommitter->skmTable.uid == uid) goto _exit; if (pCommitter->skmTable.uid == uid) goto _exit;
} }
@ -425,8 +428,10 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) {
tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter); tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter);
// disk // disk
pCommitter->toLastOnly = 0;
SDataFReader *pReader = pCommitter->dReader.pReader; SDataFReader *pReader = pCommitter->dReader.pReader;
if (pReader && pReader->pSet->nLastF >= pCommitter->maxLast) { if (pReader) {
if (pReader->pSet->nLastF >= pCommitter->maxLast) {
int8_t iIter = 0; int8_t iIter = 0;
for (int32_t iLast = 0; iLast < pReader->pSet->nLastF; iLast++) { for (int32_t iLast = 0; iLast < pReader->pSet->nLastF; iLast++) {
pIter = &pCommitter->aDataIter[iIter]; pIter = &pCommitter->aDataIter[iIter];
@ -451,14 +456,16 @@ static int32_t tsdbOpenCommitIter(SCommitter *pCommitter) {
tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter); tRBTreePut(&pCommitter->rbt, (SRBTreeNode *)pIter);
iIter++; iIter++;
} }
if (iIter > 0) {
pCommitter->toLastOnly = 0;
} else { } else {
pCommitter->toLastOnly = 0;
for (int32_t iLast = 0; iLast < pReader->pSet->nLastF; iLast++) {
SLastFile *pLastFile = pReader->pSet->aLastF[iLast];
if (pLastFile->size > pLastFile->offset) {
pCommitter->toLastOnly = 1; pCommitter->toLastOnly = 1;
break;
}
}
} }
} else {
pCommitter->toLastOnly = 0;
} }
code = tsdbNextCommitRow(pCommitter); code = tsdbNextCommitRow(pCommitter);