Repository navigation
Description
Note
SEND by Agent | Codex | GPT-6
Is there an existing issue for the same bug?
- I checked existing issues for the FDB incident, historical
mo_tablesPK filtering and the related fix PR. Related catalog-recovery reports have different mechanisms; no matching issue was found.
Branch Name
Observed in production on v4.2.8-hotfix (MatrixOne 4.2.8). The fixes are also being ported to 4.2-dev and main.
Commit ID
Production: 10d204b8763f19b2b37ba2147d1d4c1a7828d6d4.
Port bases tested: 4.2-dev@1d90e5197c639ddc26afb447dc6ad7b28c36f56b and main@1064837ae2648aa20e5e1abb7edd0564493e6b4d.
Other Environment Information
The incident occurred in production MOI/FDB on 2026-11-13. Both the main business table and preview branch contained six rows; only one row differed. The ordinary CLI request deadline was 30 seconds. Production investigation was read-only; the failed business operation was not blindly replayed.
Actual Behavior
DATA BRANCH MERGE preview INTO customers WHEN CONFLICT SKIP reached the client deadline even though only one row needed updating. Production SQL failed with context canceled after 29.941863061 seconds.
The dominant phase was resolving the branch ancestor table's creation commit timestamp from historical mo_catalog.mo_tables changes:
DataBranch-TableCTS-CollectChanges-Donetook 29.859157836 seconds, or 99.72% of SQL duration.- The caller logged
has-pk-filter=true, but the checkpoint recovery constructor did not receive that context filter. - Range selection admitted 4,749 data objects and 7,116 tombstone objects. Their physical candidate-row total was 13,170,690; this is not the business table's logical size or proof that all candidate rows were read.
- Before cancellation, the reader delivered 824,182 data versions and 1,036,957 tombstone versions, totaling 1,861,139 catalog-history rows.
- MO logged a transaction rollback. The application's earlier
committingflag remained stale; it is separate from MO's transaction state and application-state recovery is outside this engine fix.
Expected Behavior
Historical recovery must preserve the exact-table PK predicate already constructed by the frontend and avoid reading provably unrelated catalog payloads. It must retain conservative behavior for unknown zonemaps, non-PK sort keys and tombstones, and preserve metadata required to resolve replacement chains. Missing required metadata/files must remain errors.
Steps to Reproduce
The reproducible regression fixtures are included in the related PRs:
- Create a database with a target table plus unrelated catalog insertions and deletions. Persist their catalog objects and force a checkpoint.
- GC/truncate the CN
mo_tablespartition history so the requested interval starts before its in-memory coverage. - Call
CollectChangeswith the target's account/database/table composite-PK predicate under checkpoint replay and visible-state range policies. - On the original implementation, checkpoint replay drops the predicate and returns unrelated table history. The release branch's visible-state constructor also loses it. The source regression fails on the production/base implementation and passes after the fix while preserving the target's original creation commit timestamp.
- The SQL regression creates a six-row table and a preview branch with a single rename, forces historical catalog recovery, performs MERGE, and checks every resulting row. It also covers repeated merge, conflict SKIP, insertion and deletion.
Relevant tests:
TestCatalogChangesPKFilterAfterPartitionGCTestDataBranchMergeWithCheckpointCatalogTestHistoricalChangesPKBlockPruningandTestHistoricalChangesObjectPKPruningTestHistoricalChangesPKFilterReplacementChain
The replacement-chain test reproduces the review counterexample using the public range constructor and real object files: an unknown/broad predecessor remains eligible while a disjoint replacement is prematurely removed from the lineage index. Its controls retain ErrFileNotFound for genuinely missing successors and matching files.
Additional information
Fix PRs:
- [v4.2.8-hotfix] fix(branch): preserve PK pruning in historical catalog reads #32704 —
v4.2.8-hotfix, including its replacement-chain review follow-up. - [4.2-dev] fix(branch): preserve PK pruning in historical catalog reads #32705 —
4.2-dev. - fix(branch): prune historical catalog replay and prefer snapshot reads #32707 —
main, adapted to its existing physical/logical column mapping and bounded range/spill APIs.
Targeted tests and existing MERGE/PICK suites passed locally on each branch. A local matched workload on the original fix commit measured 8,192 unrelated tables with a six-row business table: MERGE median 136.75 → 33.84 ms and cumulative catalog lookup 110.05 → 5.09 ms. The long-common-prefix control showed no speedup because existing fixed-size zonemaps could not distinguish the keys. These measurements are not a production-latency guarantee; the detailed limits and the baseline post-measurement cleanup failure are retained in #32704.
Priority: pending repository triage.
Activity
[v4.2.8-hotfix] fix(branch): preserve PK pruning in historical catalo…
[4.2-dev] fix(branch): preserve PK pruning in historical catalog reads (
fix(branch): prune historical catalog replay and prefer snapshot reads (
[4.2-dev] perf(branch): resolve creation timestamps before catalog re…
Ariznawlll commentedon Nov 29, 2026
结论
测试通过。本次补齐两条目标分支的目录历史规模与性能验证:保留 PK 条件后,能够跳过无关历史对象;实际 checkpoint/目录 GC 后仍能正确找到目标表创建版本,六行表 MERGE、重复合并和冲突处理均正确。回归分别加入现有 MOTR main #404、4.2-dev #399,没有向 MatrixOne 主库提交 PR。
关键证据
版本与环境
f9d52a3a39edb57f33723ed8979084d0f60eda43,4.2-dev6a905c7e660a71597ff1eb9fc61907145584377b。对应修复为 fix(branch): prune historical catalog replay and prefer snapshot reads #32707 与 [4.2-dev] fix(branch): preserve PK pruning in historical catalog reads #32705;没有用 main 的结果替代 4.2-dev。一、原生修复与错误边界
两条分支分别执行以下五个原生测试,每项重复三次,全部通过,无跳过:
覆盖原调用链、checkpoint replay/visible state、块与对象剪枝、未知 zonemap 的保守保留、replacement lineage,以及确实缺失文件时仍报错。main 额外四个取消/缺文件/中止窗口资源测试各三次通过;4.2-dev 没有这四个同名测试,不把 main 结果计入 4.2-dev。合计 main 27 次、4.2-dev 15 次顶层测试执行。
二、补齐原始物理候选规模
单独构造落盘对象,使用实际对象读取器与公开历史范围构造入口:
这与原 Issue 的对象数、总候选版本数一致;数据为合成目录键分布,不是客户生产目录副本。它也不是把六行业务表扩成 1,317 万行业务数据。关闭 MO 文件缓存,保留 OS 缓存状态;按“无过滤、有过滤、有过滤、无过滤、无过滤、有过滤”顺序执行。每轮完整消费结果:无过滤必须返回全部候选版本;有过滤必须只返回目标键 1 行、无无关 tombstone。所有计数和目标键断言通过。
这里证明本场景中无关历史读取被有效剪枝;不将跨分支的绝对耗时差当作分支优劣,也不把本机数字外推为生产 SLA。过程最大 RSS 约 1.8 GiB,记录未见 swap;没有以缓存命中替代目标行正确性校验。
三、真实系统目录的 8,192 表 checkpoint/GC
额外创建 8,192 张无关表,分组提交并 flush 真实目录,强制 checkpoint,裁剪 CN 的 mo_tables 分区历史。先断言历史边界确实越过请求起点,再调用 CollectChanges,分别走 checkpoint replay 与 visible-state 策略。
检查的是目标 table ID、创建/提交时间戳、完整目标版本与无关删除缺席,不仅检查行数。两条路径均通过。
四、端到端六行 MERGE 与大目录组合
在两条分支再次建立真实六行 customers/preview,修改一行名称,再创建 8,192 张无关表,强制 checkpoint 并裁剪历史;断言必须依靠历史恢复后,执行原始 SQL:
20707: row level lock is too large that need upgrade to table level lock。保留该失败记录;改为每批 128 表清理本测试创建的表后,重新运行完整流程通过。未修改 MERGE 断言,也未将第一轮整体标成 PASS。批量 DROP DATABASE 锁上限不是本 Issue 的目录剪枝修复结论。五、MOTR 与托管 CI
.github/qa/issue_32708_bigdata.sh执行 1,317 万物理版本与真实 8,192 表 checkpoint 两项;原生 gate 每个根测试要求通过三次。端到端 8,192 表 MERGE 是本次额外本地验收,未将它表述为已每日执行。389ea899c5fea18c9105405b175e5089c9fc7931、4.22600caf482baccc21ba7e99b3000a9f2177fbc9f。4.2 PR 后续0cbe63a8d3cb0c193e234de161922eb058d4c198只修改另一个 IVF 专项,已核对目录恢复代码没有变化。待解决点
本 Issue 在上述两个目标分支的修复验收项已完成。未获取原生产目录物理副本,因此不声称原生产现场逐字节重放,也不覆盖应用侧遗留 committing 标记修复。本次以原规模合成落盘历史、真实系统目录与端到端 SQL 三层证据验收引擎问题。
最终结论:测试通过。main 与 4.2-dev 的 PK 过滤传递、历史恢复正确性、替换链/缺文件边界、原候选规模性能与真实大目录 MERGE 均通过,对应 MOTR 回归已提交并核验 CI。本次验收无剩余未通过项;回归 PR 尚待合入。
fix(logtailreplay): cancel pending catalog metadata reads on replay f…
XuPeng-SH commentedon Nov 30, 2026
补充 #32992 合入版验证:在
main@51fe86e110738f097a102618773ee630c21d2fc8上运行了真实 logtail replay 路径的 4 个定向用例,各 20 次通过:TestHistoricalChangesCancelPendingReadsOnMissingFile、TestHistoricalChangesAvoidUninterruptibleReadAhead、TestHistoricalChangesReturnMissingFileBeforeUninterruptibleReadAhead、TestHistoricalChangesReclaimAbortedWindows。另有TestFileServiceReadCancellationCapability通过。覆盖必要对象出错时取消并回收后续读取、保留缺对象错误及不可取消存储的边界。这不是原生产
DATA BRANCH MERGE的重跑,未覆盖约 1,317 万候选的大目录及耗时对照,也不替代被取消的完整 CI。继续保留现有 QA 负责人,性能验收仍开放。