Repository navigation
refactor(txn): retire transaction data trace runtime - #29577
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review — head de992696d99b7fd030e0532a6eb52dbdd070d350, base/merge-base 529ee099e32ed8c38d2806043bf1516ab0345e45。
结论:在已批准的“完整退役事务 data-trace、保留历史数据与惰性声明、停机整体替换”范围内,未发现新增的设计或代码阻塞。没有使用 subagent。当前提交账号也是 PR 作者,因此本次提交 COMMENT 记录审查结果,不是正式 APPROVE,也不代表独立评审或 CI 已全部通过。
设计与职责
- 方向合理:删除独立 trace 状态、控制、存储和执行链,而不是为错误的 service 捕获时序补一层服务或新的兼容状态机。CN 初始化/注册/关闭/目录管理、7 个 worker、6 个队列、CSV/S3/MO exporter、filters、探针、专属时钟/序号/flags/DSN/control handler 已一起清理;反向查找没有残留 runtime facade 或实际配置消费者。
- 没有把真实回调误当成 trace 删除。incrservice、shardservice 的 ClosedEvent,以及 ISCP 的 commit-start/rollback-completion 仍由原来的事务生命周期承担;95/98/99 身份不变,CostEvent 保留的理由是实际完成阶段语义,不是继续采集耗时。snapshot/admission/terminal cleanup 和同对象 RestartTxn 的 ownership/seal 不变。
- lock Result 删除的是诊断副本与只读 waiter 队列遍历,不是 deadlock dependency:waitFor、holder edges、入队/通知/取消仍在原 owner。语义字段 1–5、10、11 未改号,6–9 reserved。reader-summary 仍强制完整 pre-filter eager batch;普通 late-materialization 不再受被退役的 trace 控制。
- catalog、TOML 和 session 声明是有明确最终移除条件的惰性保留,没有第二条执行路径。现有 mo_debug 授权保护、bootstrap/upgrade 注册和历史数据职责保留。仅移除源声明不授权删除历史数据;#29249 是持续工程质量跟踪,不应因此关闭。
增量与测试质量
完整范围为 109 文件,+538/-6997,净减 6459。分别审视后:生产/生成代码 -4837,测试/mock -1159,文档 -447,配置 -16。不是按总减行数判定:删除的 collector-only 测试确实失去了对应运行时;独立 UUID、CN drain/admission、事务错误/关闭/重启等安全 oracle 仍保留。
新增的单 CN owned-cluster 场景确实需要停机重启;地址模板测试在配置层覆盖 4 个模板 × 2 个 CN,没有为纯格式映射启动集群。测试使用 snapshot-admission seam 替代被删除的 trace callback,避免让真实生命周期测试继续依赖已退役功能。
验证与 QA 挑战
本地在干净 detached head 上通过顶层 make -j8 cgo 构建原生依赖,再使用仓库 mo-cgo-test,没有跳过 native provenance:
- 完整
./pkg/txn/client ./pkg/lockservice ./pkg/sql/colexec/table_scan:普通测试和 race 全部 terminal PASS。lockservice 两种模式完整包分别 103.129s / 105.268s;此次不是只复跑作者修正的两个 assertion。 - CN bootstrap failure、pipeline/query/incr drain、close/cancel/admission、UUID:普通/race PASS。
TestRetiredTransactionTracePreservesRollbackArtifacts:真实 SQL fresh bootstrap、历史 row、enabled controls、原 collector 目录 marker、不生成新输出、惰性配置/session、退役命令报错、同集群完整 stopped restart PASS,场景 11.73s。不是两次独立集群启动冒充重启。TestRestartTxnKeepsRunSQLSealedUntilAdmissionCompletes与TestCloseCancelsAdmittedSnapshotWait:race 各 100 次 PASS,验证竞争期间旧代 SQL/commit 拒绝,以及关闭后 active/user/wait slots 清零。- reviewer-only overlay(不改 PR):public commit/rollback × RPC success/error 验证 start → ClosedEvent 恰一次 → completion、ID/status/Err;reader-summary eager 与普通 late 为对照,包含 filter 和 mpool 归零。两项普通/race 各 100 次 PASS。
- 独立 catalog/protocol oracle:31 个保留声明(包括所有 DDL、种子及 InitSQL 顺序)与 base 等价;完整 gzip protobuf descriptor 解码比较,差异只有 Result 6–9 退役/reservation;手工编码语义 wire + 退役 unknown 字段验证解码语义、unknown bytes 保留、Marshal/ProtoSize,均 PASS。
TestDynamicCNTemplatesPreserveAddressBindings所有模板/地址身份对照 PASS。- 复用并核实 exact-head CI:配置化全仓库 Linux SCA 0 issues;COMPOSE/PESSIMISTIC BVT 日志中的 checkout、shared binary SHA 都匹配本 head,实际 Tester terminal success。没有把 skipped 拓扑算成验证。
证据边界与历史 comments
- GitHub review threads 全量查询为 0,无未解决的人类 change-request;fengttt 已对同一 head 提交 APPROVED。
- 全量 Ubuntu UT(run 37075216422 attempt 2)在最后查询时仍 in_progress,未等待,也未记为通过。attempt 1 的 UT 在 checkout 三次 GnuTLS fetch 失败,测试没有启动,不能当作产品 UT failure。
- 本次 restart 日志也出现了 PR 已披露的后台 cron AUTO_INCREMENT/preinsert nil capture。作者报告在 clean base 529ee09 复现同栈;本次复核了未改变的捕获/初始化职责,但没有独立重跑该基线。此 PR 不声称修复该独立问题,本次 restart 不能称为“后台无错误”。
- 未执行真实 old/new/old 二进制切换;证明的是 catalog/data/config 保留与 same-version stopped restart,而非混合升级。旧 collector 在回退后仍有自身的旧目录启动行为,不能将新版本“不删除文件”解释为旧二进制会重放/永远保留它们。
- 性能收益是可确认的结构性删除(workers/queues、探针/原子序号/格式化/导出和诊断锁内遍历),不宣称未实测的 ClickBench/TPCH 或端到端吞吐提升比例。合入会失去未来的事务行级 forensic capture/txn-trace 命令;常规 spans、metrics、EXPLAIN 和 reader summaries 保留,这是明确接受的功能退役。
The transaction data-trace collector has a separate control, storage and lifecycle path that allocates queues and workers even when collection is disabled. CN transaction-client construction captures the service before bootstrap registers it, while dynamic probes still run, leaving incomplete tracing and hot-path diagnostic work.
Remove the collector and its entire caller closure: workers/queues, CSV/S3/MO exporters, filters, CN registration/close/directory ownership, probes, trace-only sequence/action clocks and events, executor/client flags, session consumers, internal DSN parameters, control command, generated configuration defaults, exclusive fixtures/tests and operational docs. Remove trace-only lock-conflict Result fields from their producer and RPC schema together, including the extra locked waiter-queue traversal; deadlock dependency tracking and semantic lock results retain their existing owners. Preserve ordinary spans, metrics, Explain and reader summaries, actual commit/rollback/closed callback phases, lock/snapshot semantics and WAL/recovery paths.
Keep only exact catalog DDL/seeds/bootstrap registrations and inert
Txn.TraceTOML /disable_txn_tracesession declarations for stopped-version replacement and rollback. Existing trace rows, controls and historical files are neither deleted, rewritten nor replayed. No runtime facade, collector replacement, compatibility branch or mixed deployment is supported. Dynamic positional launch templates switch with the source commit; external older six-slot templates must also be replaced. Existing service TOML files still parse in either version. Source comments track final removal after the rollback window excludes collector-bearing versions and deployed TOMLs/client initialization omit the retired settings. Catalog/bootstrap/upgrade/planner declarations and exclusive tests retire together; removing declarations never implicitly deletes historical data. Actual old/new/old binary switching was not executed; catalog/data/config preservation and same-version stopped restart were validated.Related to #29249. Net reduction: 6,459 lines (implementation including generated production code 4,837; tests including mocks 1,159; docs 447; config 16). Latest closure design and final overall review: gpt-6.1-sol/xhigh. Staged implementation retains independent shutdown/admission/UUID safety oracles, consolidates overlapping fixtures and adds minimal real SQL/restart and dynamic-template coverage.
Validation:
No end-to-end throughput improvement percentage is claimed; deletion proves removal of collector work.