fix: possible delete data loss when stt_trigger = 1

This commit is contained in:
Hongze Cheng 2024-08-16 13:27:51 +08:00
parent 5ae13e7bf8
commit 5361d5f38a
1 changed files with 21 additions and 27 deletions

View File

@ -157,13 +157,8 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
int64_t numRecord = 0;
SMetaInfo info;
if (committer->tsdb->imem->nDel == 0) {
goto _exit;
}
// do not need to write tomb data if there is no ts data
bool skip = (committer->ctx->info->fset == NULL && !committer->ctx->hasTSData);
// if no history data and no new timestamp data, skip tomb data
if (committer->ctx->info->fset || committer->ctx->hasTSData) {
committer->ctx->tbid->suid = 0;
committer->ctx->tbid->uid = 0;
for (STombRecord *record; (record = tsdbIterMergerGetTombRecord(committer->tombIterMerger));) {
@ -185,14 +180,13 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
record->skey = TMAX(record->skey, committer->ctx->minKey);
record->ekey = TMIN(record->ekey, committer->ctx->maxKey);
if (!skip) {
numRecord++;
TAOS_CHECK_GOTO(tsdbFSetWriteTombRecord(committer->writer, record), &lino, _exit);
}
}
TAOS_CHECK_GOTO(tsdbIterMergerNext(committer->tombIterMerger), &lino, _exit);
}
}
_exit:
if (code) {