fix: delete data error

This commit is contained in:
Hongze Cheng 2023-09-14 17:20:10 +08:00
parent 073ab4cfd2
commit 925cc8f55f
1 changed files with 13 additions and 20 deletions

View File

@ -185,29 +185,22 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
}
if (record->ekey < committer->ctx->minKey) {
goto _next;
// do nothing
} else if (record->skey > committer->ctx->maxKey) {
committer->ctx->maxKey = TMIN(record->skey, committer->ctx->maxKey);
goto _next;
committer->ctx->nextKey = TMIN(record->skey, committer->ctx->nextKey);
} else {
if (record->ekey > committer->ctx->maxKey) {
committer->ctx->nextKey = TMIN(committer->ctx->nextKey, committer->ctx->maxKey + 1);
}
record->skey = TMAX(record->skey, committer->ctx->minKey);
record->ekey = TMIN(record->ekey, committer->ctx->maxKey);
numRecord++;
code = tsdbFSetWriteTombRecord(committer->writer, record);
TSDB_CHECK_CODE(code, lino, _exit);
}
TSKEY maxKey = committer->ctx->maxKey;
if (record->ekey > committer->ctx->maxKey) {
maxKey = committer->ctx->maxKey + 1;
}
if (record->ekey > committer->ctx->maxKey && committer->ctx->nextKey > maxKey) {
committer->ctx->nextKey = maxKey;
}
record->skey = TMAX(record->skey, committer->ctx->minKey);
record->ekey = TMIN(record->ekey, maxKey);
numRecord++;
code = tsdbFSetWriteTombRecord(committer->writer, record);
TSDB_CHECK_CODE(code, lino, _exit);
_next:
code = tsdbIterMergerNext(committer->tombIterMerger);
TSDB_CHECK_CODE(code, lino, _exit);
}