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