Merge pull request #27267 from taosdata/fix/TS-5269-3.0
fix: possible delete data loss when stt_trigger = 1
This commit is contained in:
commit
0934fd7974
|
@ -157,41 +157,35 @@ static int32_t tsdbCommitTombData(SCommitter2 *committer) {
|
||||||
int64_t numRecord = 0;
|
int64_t numRecord = 0;
|
||||||
SMetaInfo info;
|
SMetaInfo info;
|
||||||
|
|
||||||
if (committer->tsdb->imem->nDel == 0) {
|
// if no history data and no new timestamp data, skip tomb data
|
||||||
goto _exit;
|
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));) {
|
||||||
|
if (record->uid != committer->ctx->tbid->uid) {
|
||||||
|
committer->ctx->tbid->suid = record->suid;
|
||||||
|
committer->ctx->tbid->uid = record->uid;
|
||||||
|
|
||||||
// do not need to write tomb data if there is no ts data
|
if (metaGetInfo(committer->tsdb->pVnode->pMeta, record->uid, &info, NULL) != 0) {
|
||||||
bool skip = (committer->ctx->info->fset == NULL && !committer->ctx->hasTSData);
|
TAOS_CHECK_GOTO(tsdbIterMergerSkipTableData(committer->tombIterMerger, committer->ctx->tbid), &lino, _exit);
|
||||||
|
continue;
|
||||||
committer->ctx->tbid->suid = 0;
|
}
|
||||||
committer->ctx->tbid->uid = 0;
|
|
||||||
for (STombRecord *record; (record = tsdbIterMergerGetTombRecord(committer->tombIterMerger));) {
|
|
||||||
if (record->uid != committer->ctx->tbid->uid) {
|
|
||||||
committer->ctx->tbid->suid = record->suid;
|
|
||||||
committer->ctx->tbid->uid = record->uid;
|
|
||||||
|
|
||||||
if (metaGetInfo(committer->tsdb->pVnode->pMeta, record->uid, &info, NULL) != 0) {
|
|
||||||
TAOS_CHECK_GOTO(tsdbIterMergerSkipTableData(committer->tombIterMerger, committer->ctx->tbid), &lino, _exit);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (record->ekey < committer->ctx->minKey) {
|
if (record->ekey < committer->ctx->minKey) {
|
||||||
// do nothing
|
// do nothing
|
||||||
} else if (record->skey > committer->ctx->maxKey) {
|
} else if (record->skey > committer->ctx->maxKey) {
|
||||||
// committer->ctx->nextKey = TMIN(record->skey, committer->ctx->nextKey);
|
// committer->ctx->nextKey = TMIN(record->skey, committer->ctx->nextKey);
|
||||||
} else {
|
} else {
|
||||||
record->skey = TMAX(record->skey, committer->ctx->minKey);
|
record->skey = TMAX(record->skey, committer->ctx->minKey);
|
||||||
record->ekey = TMIN(record->ekey, committer->ctx->maxKey);
|
record->ekey = TMIN(record->ekey, committer->ctx->maxKey);
|
||||||
|
|
||||||
if (!skip) {
|
|
||||||
numRecord++;
|
numRecord++;
|
||||||
TAOS_CHECK_GOTO(tsdbFSetWriteTombRecord(committer->writer, record), &lino, _exit);
|
TAOS_CHECK_GOTO(tsdbFSetWriteTombRecord(committer->writer, record), &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(tsdbIterMergerNext(committer->tombIterMerger), &lino, _exit);
|
TAOS_CHECK_GOTO(tsdbIterMergerNext(committer->tombIterMerger), &lino, _exit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
|
Loading…
Reference in New Issue