Skip to content

[Bug]: Incremental backup recopies old immutable objects after deletion and fails on GC-removed sources #32169

Closed

Description

@LeftHandCold

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Searched open and closed issues for incremental backup, NeedCopy, and backup file-not-found failures. #28473 is an older full-backup/restore-prefix report and does not establish this incremental selection mechanism. #23460 concerns cloned objects; #25937 concerns index ordering.

Branch Name

4.2-dev; the same timestamp predicate is also present on main.

Commit ID

  • Observed release: e0e2308d074d84c507ce15352ffb0ea0405ab3b8.
  • Reproduced copy-decision error on main 36c99836498293e5ada615a017908832e99072af and 4.2-dev a3cfb7551431d7e9d87c33383fb13c44e3757873.

Other Environment Information

  • Linux amd64; physical full/incremental backups to object storage.
  • Isolated validation uses a real TAE engine, MinIO, and unmodified mo-backup index/restore functions from 84cb6f797cbfda622258a96f5bd629ce566d24f4.
  • main and 4.2-dev have different downstream object-retention selectors; their end-to-end failure behavior is not assumed identical.

Actual Behavior

An incremental backup requests a fresh source copy of an immutable object that was created before the base backup and deleted afterwards. The source file has already been collected, while a valid copy still exists in the earlier backup chain. The backup fails with file ... is not found.

LoadCheckpointEntriesFromKey substitutes DeleteTS for commitAt and sets NeedCopy when either CreateTS or that value is at/after baseTS. Deletion changes an immutable object's visibility, not its stored bytes. Treating it as a new payload causes unnecessary source reads.

The observed checkpoint was decoded directly: CreateTS < baseTS < DeleteTS, non-appendable object, NeedCopy=true. Its historical backup entry and physical file were independently confirmed. Bloom-filter false positives are not needed to reproduce this decision.

An isolated 4.2-dev full + incremental + merge/source-GC sequence reproduces the file-not-found failure without a global index supplied to the kernel. With the copy-decision correction, the same workflow restores all four backup points using both indexed and non-indexed mo-backup resolution, including data checks and restart.

Expected Behavior

  • Full backups still copy required files.
  • Incremental backups copy immutable objects created at/after the base timestamp; older immutable objects reuse the valid backup chain, even if deleted later.
  • Preserve conservative flush/drop handling for appendable objects, including appendable tombstones.
  • Preserve CreateTS/DropTS, visibility/GC rules, checkpoint copying and archive/index formats.
  • Missing newly required source files must fail; do not broadly swallow NotFound.

Steps to Reproduce

  1. Persist immutable data, then take a full backup.
  2. Insert/delete more rows and take an incremental backup.
  3. Merge old immutable objects so their deletion timestamps exceed the incremental base.
  4. Remove only the merged-out test source objects to simulate physical GC; leave historical backup files intact.
  5. Take another incremental backup without a kernel-loaded global index.
  6. On the referenced 4.2-dev base, it attempts to recopy the removed object and fails.

A deterministic smaller regression writes and reads actual checkpoint rows with CreateTS before base and DeleteTS equal to/after base. The existing predicate fails the immutable-object expectations on both branches.

Additional information

Keep this fix separate from mo-backup index-repair/fail-open behavior. Reusing an older file requires a valid backup chain; this change must not invent a current-directory index entry or claim to repair damaged historical backups.

Activity

  1. added
    kind/bug
    on Nov 4, 2026
  2. added a commit that references this issue on Nov 5, 2026
    007dd57
  3. XuPeng-SH commented on Nov 5, 2026

    @XuPeng-SH
    Contributor

    #32172 已于 2026-11-05 12:45 UTC 合入 main,merge SHA 007dd57,最终 head 027c0ff。该问题的 main 修复转 QA 验证,交由 @Ariznawlll 跟进;这是转测,不是验收通过。

    修复范围:不可变对象按 CreateTS 决定增量备份是否需要新复制,较晚的 DeleteTS 不再把已有历史备份载荷变成新文件;appendable 数据/墓碑仍保留原有 flush/drop 保守处理。CreateTS/DropTS、可见性/GC、检查点和归档/索引格式不变,新必需源文件缺失仍应报错。复用依赖有效备份链,不修复损坏的历史链,也不涵盖独立的 #32170/#32171 mo-backup 问题。

    验证证据:已核对合并的两个文件与最终 head 一致。作者报告真实检查点回归的失败前/通过后对照、logtail/backup 包测试,以及隔离 TAE + MinIO 下四个备份点的有索引/无索引共八次恢复、逐文件/数据核对与重启。评审正文绑定较早的 3c61f5c,复用当时的 CI/作者证据,未重新运行 Go/恢复测试;本轮仅远端、源码和日志核对,未在 merge SHA 本地实测。

    最终 head CI 中 shared build 和 UT Coverage 成功;PROXY BVT 在 setup-cmake 阶段遇 HTTP 504,尚未执行 BVT。UT、SCA、PESSIMISTIC BVT 在合并后取消,CI Required 为 failure,不能写成 CI 全绿。该安装失败未构成当前备份行为的已验证反例。

    建议 QA 在隔离环境覆盖完整备份与连续增量、CreateTS/baseTS/DeleteTS 边界、不可变数据和墓碑复用、appendable flush/drop,以及历史备份存在而源对象已清理的场景;验证四个备份点的文件内容、typed rows、重启和索引/非索引恢复。保留新必需源文件缺失时失败且不发布 tae_list 的负对照。main 与 4.2 的下游保留选择逻辑不同,不能把一支的结果自动当作另一支通过;4.2 companion #32173 目前仍未合入,本次不宣称跨分支全部交付。

  4. added a commit that references this issue on Nov 6, 2026
    02fcfbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions