Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Related historical issues (similar 20405 file ... is not found):
- [Bug]: After the clone database is GC, a bug occurs where the file “is not found” #22242 After the clone database is GC, a bug occurs where the file “is not found”
- [Bug]: file 01927f8d-9bcf-7246-935a-07cc3fbf0cf2_00000 is not found when executing queries on standy mo #19268 file ... is not found when executing queries on standby mo
- [Bug]: 阿里云上查询历史SQL时,偶现Error 20405 (HY000): file local-test20/data/eb575fd2-252f-11ee-91e4-1a5f33c77f72_00045 is not found错误 #10763 偶现 Error 20405 (HY000): file ... is not found
Branch Name
main (mo-backup image: main-20260213-fix)
Commit ID
unknown (cluster image tag: registry.cn-hangzhou.aliyuncs.com/mocloud/mo-backup:main-20260213-fix, digest sha256:bb38ed10d2935fac0b68623c89087cf273415e7eea33eb8418bc363debf223b1)
Other Environment Information
- Cluster: freetier-01 (cn-dev)
- Namespace: freetier-01
- Host: freetier-01.cn-hangzhou.cluster.cn-dev.matrixone.tech:6001
- Backup Job/Pod: backup-260908-100944 / backup-260908-100944-7qg9x
- Backup tool: /mo_br backup
- Backup target: s3://moc-backup-dev/backup-260908-100944
- OSS endpoint: http://oss-cn-hangzhou-internal.aliyuncs.com (cn-hangzhou)
- User: dump?role=__MO_OB__
- Parallelism: 150
- Resources: cpu 2500m, memory request 4Gi / limit 10GiActual Behavior
mo_br backup connects to MO successfully and finishes Preparation (including Aliyun OSS client setup), then fails in Backup From MO with:
Error 20405 (HY000): file restore-dev-20260213235245/data/01a07efd-5c71-76e3-86ff-10e8e4f867e9_00000 is not found
Pod exits with exitCode: 1, phase Failed.
Key timeline (UTC):
- 2026-09-08 10:09:45 Connect MO / Test Connection / Preparation: success
- 2026-09-08 10:10:14 Backup From MO: failed with 20405
Important detail:
- The backup output filepath is
backup-260908-100944/full-... - The missing file path is under an old restore prefix:
restore-dev-20260213235245/data/...
This strongly suggests catalog/object metadata still references restore leftover object keys whose physical files are already gone (GC/cleanup/incomplete path rewrite after restore).
Relevant log excerpt:
===== Connect MO =====
Done!
===== Test Connection =====
Done!
===== Preparation =====
... new object storage {"Bucket":"moc-backup-dev", ...}
Done!
===== Backup From MO =====
ERROR backup/backup.go:94 do backup failed: Error 20405 (HY000): file restore-dev-20260213235245/data/01a07efd-5c71-76e3-86ff-10e8e4f867e9_00000 is not found
Error: Error 20405 (HY000): file restore-dev-20260213235245/data/01a07efd-5c71-76e3-86ff-10e8e4f867e9_00000 is not found
Expected Behavior
After restore, subsequent mo_br backup should succeed:
- Either all referenced data files remain readable, or
- Catalog/object metadata no longer references deleted restore-prefix files.
Backup should not fail because of stale restore-dev-... object keys.
Steps to Reproduce
1. Restore a cluster/data into an environment that uses (or previously used) a restore filepath prefix like `restore-dev-YYYYMMDDHHMMSS`.
2. Later run `mo_br backup` against the restored cluster, writing to a new S3 filepath (e.g. `backup-YYMMDD-HHMMSS`).
3. Observe backup fail in Backup From MO with:
Error 20405 (HY000): file restore-dev-.../data/<uuid>_00000 is not foundObserved once on:
- Job:
backup-260908-100944 - Pod:
backup-260908-100944-7qg9x - Namespace:
freetier-01
Additional information
Current analysis / suspected root cause:
- Not auth/connectivity/OSS credential failure (those stages succeeded).
- Failure happens while reading source files requested by MO metadata.
- Missing object is under historical restore prefix
restore-dev-20260213235245, not the current backup target path. - Likely metadata/object-lifecycle inconsistency after restore (stale object key retained after GC/cleanup, or restore did not fully rewrite object references).
Suggested investigation:
- Check whether object
01a07efd-5c71-76e3-86ff-10e8e4f867e9_00000still exists underrestore-dev-20260213235245/data/. - Check why catalog/object meta still references that restore-prefix path after restore.
- Correlate with GC / cleanup around the 2026-02-13 restore.
- Confirm whether ordinary queries on the same cluster also hit intermittent 20405 for the same UUID.
Activity
xzxiong commentedon Sep 9, 2026
backup-260908-100944-7qg9x.log
backup-260908-100944-7qg9x.yaml
LeftHandCold commentedon Sep 9, 2026
根因已收敛到 Backup 的 checkpoint 对象选择,GC 本身目前没有证据异常。
事故中旧 TN 已多次重启,缺少可关联的 DeleteObject 审计,故无法把该对象的实际删除者严格定为某一次 GC;但上述代码缺陷与删除者无关,并且能够解释“checkpoint 有 DropTS、源文件 404、backup 20405”的完整路径。
已提交 main-only 修复 PR #28525:
按当前决定不向 4.2 backport。
LeftHandCold commentedon Sep 9, 2026
补充修正:最初候选补丁把“checkpoint 中有 DropTS”直接作为跳过物理复制的条件,这在 special checkpoint 的
DropTS >= start场景不安全。checkpoint rewrite 会将这类在恢复点仍可见的对象重新写为 live;若跳过文件会形成可完成但不可读的备份。PR #28525 已更新为按每个
BackupObject.DropTS和 special checkpointstart判定:仅DropTS < start的历史对象可跳过;DropTS == start、DropTS > start均必须复制且仍保留 20405 缺文件硬错误。新增真实 checkpointcreate=5/start=15/drop=30的 copy -> rewrite -> live-reference + target-file 回归验证,并覆盖三个时间边界。因此当前修复不再依赖全局 soft-delete 名称集合;GC/protection 本身的结论不变:保护不能复活备份开始前已经被正常回收、且在恢复快照中已不可见的对象。
fix(backup): skip soft-deleted checkpoint objects (#28525)
fix(backup): skip soft-deleted checkpoint objects (matrixorigin#28525)
fix(backup): skip soft-deleted checkpoint objects (matrixorigin#28525)
fix(backup): skip soft-deleted checkpoint objects (matrixorigin#28525)
[4.2-dev] fix(backup): preserve historical objects across repeated ba…
[4.2.1-hotfix] fix(backup): preserve GC retention and restore history (…
MatrixAdventurer commentedon Nov 1, 2026
结论:部分修复(主线已修,4.2 线仅到 hotfix 分支)。证据:根因修复 #28525 已在本窗口前合入 main——备份校验遍历所有 selected checkpoints(含 special checkpoint)收集 softDeletes,跳过 DropTS<start 的逻辑删除对象,保留对真正缺失对象的 20405 硬错误语义(见本 issue 2026-09-09 评论及所附时间边界回归记录)。本窗口内引用本 issue 的合并 PR 仅 #31886:从 4.2-dev backport #29504/#30744 至 release/v4.2.1-hotfix-20261026(hotfix 分支,非主线,不计入核实),描述列本 issue 为 Related 且自述不恢复已缺失的历史对象。还缺:修复向 4.2 正式分支的 backport(此前决定不 backport,如口径已变请更新),以及事故集群备份在新版本上重跑通过的记录。
本操作由LW授权的MOI智能体提交
xzxiong commentedon Nov 5, 2026
分析结果:prod freetier-01 全量备份复现同一 20405,请求确认 4.2 backport 口径
现象
prod
freetier-01全量备份在 Backup From MO 阶段失败,报错与本 issue 完全同族(live data 前缀,非 restore 前缀):环境信息
ack-prod-unit-hz),namespacefreetier-01matrixone:4.2.1-hotfix-20261030,logv4.2.1-d2393868a-2026-08-28default-dn-0mo-backup:main-20260213-fix,/mo_br backup,--parallelism=150s3://mo-backup-20240201/backup-<ts>/full-...(OSS cn-hangzhou)诊断发现(失败时间线,UTC)
自 2026-10-29 起反复失败,每次缺失的是不同的 data 文件 UUID,与 GC/merge 活动相关:
01a184b5-..._0000001a1856d-..._0000001a14049-4f10-7969-a5b3-86d6e76ab6ad_00000成功耗时从 10-25
10-28 的 46min 上升到近期 5~9min 且间歇失败。DN merge scheduler 持续活跃(merge/scheduler.goGatherStats/L0Gather 高频),失败窗口与 GC 回收时间吻合。代码分析
与 #28473 / #28525 收敛的根因一致:
parallelCopyData阶段,源端对象 404 自 fix(backup): fail on missing checkpoint objects #26290 起正确映射为 20405。DropTS < start(逻辑已删、物理已被 GC 正常回收),但 4.2 线缺少 fix(backup): skip soft-deleted checkpoint objects #28525 的「按BackupObject.DropTS与 special checkpointstart判定、仅跳过DropTS < start」的选择修正,仍被送入 copy candidate。已验证:
git branch -r --contains 9475a9c2仅命中main与若干 feature 分支,无任何 4.2.x 分支。4.2 线仅有 #29504「preserve historical objects」(保留而非跳过),不含对已 GC 软删对象的跳过守卫。根因
prod
4.2.1-hotfix-20261030未包含 #28525。TAE GC 在备份窗口内/前正常回收带 DropTS 的历史对象,备份的 checkpoint 对象选择仍引用这些物理已删除的对象,源端 404 → 20405,备份失败。影响范围
freetier-01daily 全量备份间歇失败,10-29 起已有 6 次失败(含 1 次 manual incremental)。建议方案
4.2.1-hotfix),并在 prod 升级后重跑 daily 备份验证。备注
可按需补充 prod 失败 pod 完整日志 / job yaml(与 2026-09-09 附件同格式)。本评论证据取自 prod
ack-prod-unit-hz实时诊断。xzxiong commentedon Nov 5, 2026
xzxiong commentedon Nov 5, 2026
更正 + 更新分析:prod 版本已含修复,失败机制需重新定位
先更正前面两条评论的错误结论:prod 镜像
4.2.1-hotfix-20261030基于release/v4.2.1-hotfix-20261026之后的构建,其pkg/backup/tae.go已包含selectBackupObjects的 DropTS 跳过逻辑(#28525/#29504 系修复已进入 4.2.1-hotfix 线)。此前"修复未 backport 到 4.2"的判断有误(用了git branch --contains <main SHA>验证,cherry-pick 后 SHA 变化导致漏判),向各位致歉。但 prod 仍在带修复的版本上失败,机制如下
4.2.1-hotfix 的跳过是带条件的(
pkg/backup/tae.goselectBackupObjects,约 :866-871):即跳过需同时满足:
dropTS < start、落在 retention 窗口内(CrateTS > retention.start && dropTS <= retention.end)、且不在retained集合。而retained集合由loadBackupObjectRetention(:576-667)构建,来源是当前仍存在的 checkpoint/GC 文件。由此推出一条仍然可行的失败路径:
DropTS < start,且其物理文件已被 GC 删除;retained集合里没有它,或它已落在 retention 窗口之外(CrateTS <= retention.start);NeedCopy=true进入parallelCopyData;ErrFileNotFound20405 → 整个备份失败。这解释了 prod 的现象:间歇性失败、每次缺失不同 UUID(取决于 GC 清理进度与备份枚举的相对时序)。
仍然成立的 aggravator
失败 job
backup-261104-102651耗时 ~40min,超过 GC backup-protection 的 20min TTL(gc/v3/checkpoint.go:1761)。protection 过期后 GC 恢复删除,进一步放大上述窗口。需要进一步确认的点(麻烦 @LeftHandCold)
01a14049-4f10-7969-a5b3-86d6e76ab6ad_00000的DropTS/CrateTS与当时retention.start/end的关系(需要其 checkpoint 记录);若它确实落在窗口外/不在 retained,则上述路径坐实。prod 现场信息(不变)
freetier-01(ack-prod-unit-hz),MO4.2.1-hotfix-20261030,mo_brmain-20260213-fixError 20405: file mo-20231112/data/<uuid>_00000 is not found(每次 UUID 不同)40min 不等,成功任务 59min[4.2.1-hotfix] consolidate missing fixes from dated releases (#32699)