Skip to content

fix(sql): reuse ordered cleanup for DROP DATABASE - #29393

Merged
XuPeng-SH merged 31 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-27575-drop-database-serial
Sep 29, 2026
Merged

XuPeng-SH merged 31 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue-27575-drop-database-serial

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Related to #27575 and #29400. Fixes #29395. Integrates the reviewed RC lifecycle correction from #29457 into this PR.

  • Keep DROP DATABASE cleanup in ordered per-table execution, including temporary-table ownership, FK handling, failure boundaries, and allocator deletion intent reconciliation after statement rollback.
  • Use the RC lifecycle protocol with scoped catalog/database/component/table admission, exact mutation rows, applied-frontier identity revalidation, and transaction-owned locks. A DROP TABLE in an unrelated database can finish while the target DROP DATABASE waits for a slow table. RC multi-table DROP TABLE reclaims branch state at each reached persistent member, preserving later temporary-table failure boundaries. Unrelated ordinary components skip repeated ALTER-lineage compaction scans. Retained shared-to-exclusive lifecycle promotion fails promptly; ordinary prior DML cycles are resolved by the distributed deadlock detector with whole-transaction rollback and survivor progress.
  • Preserve the View/deferred-FK correction, nil index-metadata error handling, database-wide FK cleanup, bounded workspace point-read optimization, and existing DDL/TN operation logs.

This does not establish the cause or resolution of #27575's historical two-hour disconnect. ALTER-history cleanup still uses a broad lifecycle gate. First activation of the RC protocol requires the documented stop/drain/replace-all maintenance cutover; rolling old/new writers are unsupported.

Validation

  • Current head 07bc41ffdb retains base main at d8152cb08d; fix(sql): scope pessimistic RC DROP branch lifecycle by component #29457 is integrated into this PR. The full branch retains the original parent fixes and focused RC follow-ups.
  • make cgo, full pkg/sql/compile, pkg/sql/plan, and pkg/incrservice tests passed on the integrated code. On the current cleanup revision, full pkg/sql/compile and pkg/frontend packages pass with -race; focused compile/frontend tests and a real public SQL RC database tail-reclaim fault test pass.
  • Public SQL passed the retained-lock/deadlock-victim, disjoint database progress, cancellation after table progress, statement rollback, branch partition, and branch clone/FK cases. Added post-admission branch mutation fault cases in both persistent/temporary orders, with statement rollback followed by COMMIT, branch protection checks, and temporary name reuse. The new three-actor check requires DROP TABLE in an unrelated database to finish within 2 seconds while the target DROP DATABASE remains blocked on a retained UPDATE table lock.
  • Previous lockservice detector/race and snapshot SQL/result parser checks remain applicable to unchanged code. The current public fault test injects an RC DROP DATABASE reclaim failure after table cleanup. It then commits prior statement work and verifies database tables, branch metadata/snapshot, temporary alias, allocator usability, original ISCP job identity and hidden table, and continued durable CDC tail progress after a later INSERT. Before this correction, the same test failed because a runtime ISCP fence survived statement-only rollback; after statement-scoped fence cleanup, it passes in 42.24s. Full pkg/sql/compile -race, focused local/remote fence tests including 5-run race checks, and changed-package go vet pass. Combined-head multi-CN BVT and CI are not claimed as passed.

Current integrated performance

The exact c69187e0e3 base and integrated code before the branch-only ordered-reclaim correction used the same Go 1.26.4/native inputs, GOAMD64=v3, GOEXPERIMENT=simd, fresh one-CN clusters/data directories, and alternating three-sample order at each scale. Setup was excluded. Every sample checked the live table count, SELECT 1 and connection identity on one pinned connection, and zero database/table/column/index catalog rows by saved database ID.

Build 1,000-table raw seconds 2,000-table raw seconds Median 1,000 / 2,000
Exact base 6.698, 6.713, 6.804 16.418, 16.497, 16.529 6.713 / 16.497
Integrated head 5.414, 5.360, 5.312 12.657, 12.665, 12.418 5.360 / 12.657

Median improvement is 20.2% / 23.3%, and the 2,000/1,000 growth ratio improves from 2.458 to 2.361. This misses the original 25% target; the revised delivery acceptance is measured improvement plus independent progress when one target table is slow. A separate alternating three-sample 1,000-table check found the integrated head 2.3% faster than the parent-only revision. The later correction changes branch-present DROP TABLE reclaim only; this plain-table DROP DATABASE path is unchanged. These are controlled local results, not production latency guarantees. Raw provenance and older nonpassing rounds are in the design evidence.

Review status

The latest #29393 external review's sole P1 prerequisite, integration of #29457, is included in this branch. The latest parent View, sparse-index, and redundant-FK-SQL comments remain fixed. This follow-up removes test-only SI quota reading, impossible View errors, the test-only single-table DROP wrapper, and its unreachable RC fallback. Ordinary DML/SELECT no longer allocates temporary-DROP retry state. Current RC protocol and archived design text are distinct. GPT-6 Astra medium reviewed the follow-up cleanup and the new ISCP statement-rollback correction with GO and no material blocker. New-head CI, maintainer re-review, and deployment cutover validation are not inferred from local tests.

The complete branch against its PR base changes 89 files, +8,008/−1,195 lines (net +6,813); production Go including generated code is +3,620/−725 (net +2,895), Go tests +3,733/−431 (net +3,302), and docs +380/−16 (net +364). The latest ISCP correction adds 128 and removes 28 lines (net +100): production net +14, focused tests net +84, and two documentation lines. The existing public regression now checks durable CDC consumer progress after rollback. This includes the parent DROP/FK/allocator/read-path repairs and the full RC protocol, tests, generated lock wire field, SQL fixtures, and design contracts. Exactly ten child commits were imported without duplicating their inherited parent history. ALTER-bearing members of one component can still require fresh full-catalog scans; this path has not been separately benchmarked.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep commit review + 黑盒/白盒 QA

审查范围:9c6fcb5b501d040ab1bcb5ada139939770468638..686e91253502949ff61d53535c23e533667a7f54,全部六个 commits、18 个文件。

结论:REQUEST_CHANGES(验证闭环)。未确认本 PR 新引入的生产回归。 当前登录账号是 PR 作者,因此以绑定 commit 的 COMMENT review 提交,不能自我提交 GitHub REQUEST_CHANGES。

确认的 inherited 缺陷

已在精确 base 和候选二进制上复现并记录为 #29395:较早表已执行 allocator Delete,DROP DATABASE 随后阻塞在后续表锁;观察到指定 catalog waiter 后 KILL QUERY,仅回滚失败语句,再 COMMIT。较早表的 catalog/data 仍在,但自增 INSERT 报1146;未访问的后续表正常。完整 ROLLBACK 对照正常。白盒进一步确认 pending allocator delete 按事务终结处理,没有随 statement-context cancel 撤销。该问题不作为本 PR 新增回归。

本轮真实挑战

  • 同一连接下:取消后 ROLLBACK、取消后 COMMIT、mo_rollback_txn_on_error=1、KILL CONNECTION。
  • 持锁事务 COMMIT 后 DROP 的真实重试:同一 txn 重复 admission/首成员处理、snapshot 更新,最终数据库消失,先前 guard 写入提交。
  • 多表 DROP 临时表在前/在后两种取消顺序,分别验证已退休临时表与未访问临时表的边界。
  • 外部 FK 拒绝后 COMMIT:base 的自增/临时表失效,候选的父表 next ID9、临时表 INSERT 正常,确认提前检查的实际收益。
  • 第二租户存在延迟 FK、sys 有同名父表:租户空库可删、FK 元数据保留、sys 父表不受影响,重建父表后非法 INSERT 和 DROP 均被约束拒绝。

并发控制使用限定数据库/表名的 mo_locks.lock_content 与实际 waiter,不用固定 sleep 判定执行阶段。白盒 probe PASS;真实 SQL 才是 statement rollback 的证据。QA 库、表、FK、账号残留均0;自建服务已停止;源代码 worktree 未改动。

尚未关闭的三项

详见下面三个行内评论:首成员运行期失败后的后续 allocator/ISCP 消费者证明;真实重试期间变化的 FK 决策;声明的性能验收证据。之前本地 whole-range review 的前两项尚未因最后一个 commit 的 GO 自动关闭。

性能新对照的候选采样遇到其他任务的并行 race 编译/测试,已终止并标记污染,不据此判断退化或达标。历史两小时断连、繁忙系统全局锁等待及 merge-event outcome 均不能声称已解决;建议 PR 描述使用 Related to #27575,避免自动关闭整个 issue。

工程质量:生产代码+159/-66,net+93;复用按表生命周期,局部 descriptor/set,无新增 worker、全局状态或通用框架,现有 DDL 日志保留。测试总体有独立价值,无需为了减少行数删除有效 oracle。

提交前 GitHub 没有人类 review/行内问题,只有 Qodo 暂停通知;“所有 comments 已解决”应区分这个事实与本地历史评审仍开放的验证项。CI build/preflight 成功,但 UT/SCA/coverage/BVT 仍显示 IN_PROGRESS,未记作全绿。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit review · fdcd553

审查范围:PR base 9c6fcb5b501d040ab1bcb5ada139939770468638 到本 commit 的完整变更;本轮修复为终态物理删除集合过滤 allocator Delete 意图。独立 GPT-6 Astra medium 最终复审 GO:未发现新的实质生产缺陷,允许按部分改进提交。

既有三条评论

  1. 首表 branch-reclaim 运行时失败 / 后表 ISCP:已验证。 真实分支元数据锁等待后 KILL QUERY,只回滚 DROP 语句再 COMMIT。首表和后表分配器可用;后表同一 ISCP job ID=1 保持运行,CDC tail 1→2。
  2. FK 跨外层重试:已验证。 DROP 首次检查后等待表锁,另一事务对尚未访问的父表提交外部 FK;同一 DROP 事务重进 admission 后拒绝新 FK,数据库和 FK 均保留。另一个三表重试在首表 allocator Delete 已排队后验证:失败语句的首表意图被过滤,更早成功删除的表仍由 GC 清理。
  3. 1000/2000 表 ≥25%:未达标,保持开放。 新鲜 base/candidate 各 3 次中位数分别 5.997→4.930s(17.8%)和 16.079→12.699s(21.0%);saved-ID 目录检查均为 0。单个慢表期间的全局 SNAPSHOT gate 仍使无关 DDL 等待,#27575 保持 open,PR 已改为 Related to。

修复与 QA

#29395 的取消 DROP → 语句回滚 → 后续 COMMIT 误删 allocator 已在旧 PR 二进制上复现,并在本 commit 的二进制上通过同连接、AUTO_ID_CACHE=1、两次已完成 GC 控制后的新分配验证。accepted/rejected terminal intents、活动 builder、create→drop、Reset 旧 ID、准备失败、中止与 unknown 组合控制通过;hidden fulltext 子表在 allocator Delete 排队后注入物理删除错误的跨组件控制通过。CGo owning packages、全量 owning-package race、两个精确并发测试各 100 次 race、go vet 和选择性 BVT 通过。DDL INFO 日志保留。

结论:修复可作为部分改进进入 PR 审查;#27575 的 25% 性能门槛、忙系统 DDL convoy、历史两小时断连原因仍未解决。新 commit 的 CI 待完成。由于当前账号是 PR 作者,这里以绑定 commit 的 COMMENT review 记录,不提交 GitHub 自我 APPROVE。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep commit review — fdcd553

结论:本轮未发现新的可证实代码阻塞问题;当前 PR 可按明确的部分改进范围继续合并审查,但 #27575 的整体优化验收仍未通过,不能说所有问题都已解决。

范围:新鲜 fetch 后的 base/merge-base 9c6fcb5b501d040ab1bcb5ada139939770468638 → head fdcd553b0cfe356679f43d798d645599d9ba375e,完整 7 个提交、23 个文件。工作树干净,逐 hunk 复核;不是仅检查最后一次增量。

历史评论逐项核对

评论 实质状态 本次核对的证据
首成员运行期失败、后续 allocator/ISCP 已闭环 真实 branch 元数据锁等待后 KILL QUERY,语句回滚再 COMMIT;两表 catalog/allocator 保留且可 INSERT;后表同一 ISCP job ID=1/state=3,CDC tail 1→2。
真实外层重试重新检查 FK 已闭环 首轮检查后阻塞,另一事务在未访问父表上提交 ALTER ADD FK;同一 DROP 事务重新进入 admission 并拒绝。另一个实际重试验证陈旧 allocator 意图被过滤,较早成功 DROP 的 allocator 仍清理。
1000/2000 表性能门槛 门槛未通过;如实留开放 精确 base/candidate 各 3 次,中位数 5.997→4.930s / 16.079→12.699s,降低 17.8% / 21.0%,均低于 25%。原始字段为 drop_and_same_connection_checks_seconds,包含同连接校验,不能当作独立 DROP 语句耗时。

评论要求的“不达标则明确留开放、不要自动关闭原 issue”已落实:PR 为 Related to #27575,#27575 仍 OPEN。但这不等于性能问题已解决。复核时三条 GitHub review thread 的 isResolved 都是 false(性能那条已 outdated);“已回复/有验证闭环”和 UI resolved 状态需区分。

正确性、unhappy 与工程质量

  • 保留按表完成 cleanup 后才进入下一表的顺序;直接执行复用原 per-table primitive,保留 branch、PITR、merge settings、partition、plugin/ISCP 清理及原 DDL INFO 日志。临时表物理 ID、同名持久表、隐藏子表、view/sequence 和 tenant/FK 边界均纳入复核。
  • allocator 发布为已提交事务的 pending intents ∩ surviving physical deletions。过滤发生在 generation bump、cache retirement 和 GC tombstone 前;语句回滚删除当前 marker,保留更早成功删除;unsupported workspace 保留原契约。
  • 不新增 worker、事务 journal、持久格式或通用 callback 框架。完整 PR 生产 Go 代码 +190/−68,净 +122;测试区分真实不同的契约,复用轻量 fixture,没有用 sleep 或大集群掩盖顺序问题。
审计 结论及边界
Q1 所有权 四处 catalog Result 获得后 defer Close;返回名称为复制字符串、rowid 按值保留。allocator accepted/rejected 意图在终态被消费,只有 surviving physical deletion 能退休缓存。
Q2 等待/终态 SQL seal/drain → workspace prepare → operator mutex → service mutex → 无锁只读 membership;callback 完成后才 finalize。无新增等待边;原全局 SNAPSHOT gate 仍会使无关 DDL 等待慢表,不能宣称忙系统问题解决。
Q3 增长 descriptor/set 归单次 DROP 所有,终态消费 pending queue,没有新增长期状态;既有大事务写集/锁及失败 GC 重试仍不是本 PR 提供硬上限的对象。

验证与限制

本轮复用经源码、revision 和原始日志核对后仍有效的证据,没有重复运行未变化的全套测试:CGo owning packages、完整 owning-package race、两个精确并发测试各 -race -count=100、vet;公开 BVT DB 47/47、FK 39/39、multi-table 147/147。复核了 cancellation→statement rollback→COMMIT、AUTO_ID_CACHE=1 且两次实际 GC 控制后的新分配、hidden-child enqueue 后失败、prepare failure/abort/unknown 的证据。部分强化挑战是私有 QA 工件,并非提交后的持续 CI 用例;Reset 用例只证明旧物理 ID 过滤,不声称覆盖 replacement cache 的全部恢复。

当前 exact-head CI 已完成:CI Required、Ubuntu UT、arm64 SCA、coverage、PROXY 和 PESSIMISTIC multi-CN BVT 均 SUCCESS。 总计 12 SUCCESS / 14 SKIPPED / 2 NEUTRAL;跳过的任务不计作通过。CI run。PR body 中“CI pending”已经落后于当前状态。

#29395 的特定 allocator 误删有失败基线与修复后的真实回归证据;#27575 的 25% 性能门槛、繁忙系统全局 gate convoy、两小时断连和更广的 merge-event outcome 仍未关闭。此处不给整体问题完成背书。

当前账号是 PR 作者,因此提交绑定该 commit 的 COMMENT review,不能自我提交 GitHub APPROVE。此次复审未修改源码或测试。

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA challenge · commit fdcd553

本轮对原 review 增加一组真实黑盒 + 白盒组合挑战;结论仍是:未发现此 PR 新引入的可证实生产回归,#27575 的忙系统等待没有解决。

  • 使用此 commit 的 binary SHA256 1d12b91c74f25a83aff68a40a029b67c7de9a6ad4309f21bede8238105332f4b,全新独立数据目录,SQL/ISCP ready 后执行。目标库 a_first 同时有 AUTO_ID_CACHE=1 和独立的 mo_merge_settings 行;b_later 被另一事务持锁。DROP DATABASE 的日志记录首表 allocator Delete 意图,同一 DROP 随后在 b_later 锁上等待。
  • 在该等待期间,对另一个数据库执行 DROP TABLE u_unrelated:mo_locks 证实它在 mo_feature_registry 上等待;已到达该屏障后继续保持目标锁 2 秒,无关 DROP 没有完成。取消目标 DROP、只回滚失败语句并提交原事务后,无关 DROP 完成。无阻塞的独立 DDL 对照(含 mysql 客户端启动及 4 个 DDL)为 0.09 秒;本次被阻塞 DROP 约 2.04 秒。这是当前 head 的实际 global-gate convoy,不是 #27575 的完成证据。
  • 失败 DROP 返回 context canceled;原连接仍稳定。首表及后表物理 ID 保留,首表 allocator 行=1,首表 mo_merge_settings 行=1,新的自增 INSERT 成功并生成 ID 2。随后真正提交的 DROP DATABASE 使该 merge 设置行变为 0。两组运行结束的 QA 数据库和标记 merge 设置行均为 0;测试服务已正常停止。
  • 白盒确认:ddl.go 在每表清理时删 mo_merge_settings;disttae 的 RollbackLastStatement 清掉本语句的物理删除 marker;终态 allocator 过滤先于缓存退休。TN handle.go 的 merge postFunc 在 handleRequests 内安排,早于 txn.Commit;本次 SQL 只验证 CN 语句失败后的可见元数据和 allocator 恢复,不能据此证明 TN 晚期 commit 错误、内部重试或 unknown 结果时的 merge scheduler 状态。该更广的基础行为保持独立审计对象,未作为本 PR 新增缺陷提出。

实际脚本、两次 JSON 结果、服务日志、干净启动配置和对照记录保存在私有 QA 工件目录 /private/tmp/mo-pr29393-qa-challenge-20260927/。本轮只复用现有源码和 binary,未改 PR 代码;没有重复提交和原 BVT 等价的新测试。CI Required 对此 head 已通过。当前账号为 PR 作者,故以绑定 commit 的 COMMENT review 记录 QA 结果。

Keep the post-registration allocator lifecycle log while suppressing success logs for routine branch and CCPR probes. Record current-base end-to-end results.
Pin catalog identity and TN-applied visibility before destructive DDL or local Snapshot/PITR publication. Recheck cross-database FK and publication scope after admission, retain commit conflict validation for branch lineage GC, and delay database branch reclaim until physical table cleanup has finished. Cover disjoint two-CN progress and stale-history failure paths.
Use nonwaiting global promotion and refresh relation identity for COPY ALTER and TRUNCATE. Defer complete multi-table DROP admission until the first live persistent member, retaining temporary-table order. Document the protocol and add two-CN and ordered DROP regressions.
Use the existing distributed deadlock detector after a wait edge is published, preserving normal waits for explicit transactions with prior DML locks. Cover both lifecycle gate modes, prompt submission, and paired snapshot fixtures.
@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

@aptend Your P1 integration prerequisite is now included in #29393 head c9451c221abc094f19354ebd4c5b97c3b84e600e. I rebased the latest parent repairs, imported exactly the ten #29457 RC commits without duplicating parent history, and kept the original multi-table failure boundary by reclaiming each reached persistent DROP TABLE member before advancing. A public SQL fault test covers both temporary-table orders, branch metadata/snapshot survival after statement rollback then COMMIT, and temporary name reuse. The three-actor check shows an unrelated database DROP TABLE completes while target DROP DATABASE waits on a retained UPDATE lock. Full compile/plan/incrservice and focused public branch/FK/cancellation cases passed locally; independent QA found no correctness blocker, and GPT-6 Astra medium final review is GO. Exact-base three-sample 1,000/2,000-table medians improved 20.2%/23.3%; the original fixed 25% target was revised by the requester to measured improvement plus slow-target independent progress. The plain-table benchmark predates only branch-present DROP TABLE reclaim changes. CI has not been counted as passed. Please re-review the combined head. The duplicate draft #29457 is closed as superseded; #27575 remains open.

@aptend aptend left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep re-review of exact head 3122b89 against d8152cb. I read the complete PR review/inline-comment history, author replies, and all six resolved threads; compared the prior reviewed head's concerns with the integrated #29457 RC protocol and the full current diff.

The prior integration blocker is closed in this head. I checked the C→G→D→K→T→Q lock order, exact-row/KeepRows behavior across the lock transport, applied-frontier and identity revalidation, synchronous branch cleanup and rollback, clone/snapshot/PITR ownership, and the earlier FK/View/index fixes. I found no new actionable blocking defect.

My exact-head validation passed: focused lockservice, lockop, frontend/databranchutils, compile, disttae, incrservice and frontend tests; two two-CN SQL regressions (TestIssue29400DropDatabaseDoesNotHoldBranchDAGAfterTable and TestIssue29400CopyAlterRetainedGatePromotionFastFails); targeted lockservice/databranchutils race tests; and git diff --check. The current GitHub UT/SCA and multi-CN BVT jobs were still in progress when I submitted this review, so this is not a claim that CI is green. #27575 remains open, and the documented maintenance cutover remains a deployment prerequisite—not a claim that rolling mixed-version deployment is safe.

@mergify

mergify Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep commit review · 07bc41f

结论:在已约定的悲观 RC 范围及全量维护切换条件下,代码审查 GO;本轮未发现新的可证实阻断缺陷。 这不代表 #27575 整体关闭,也不把未运行的验证计作通过。

范围:merge-base d8152cb08d7e73316034c33aaf0e7bc01c176f91 → 本 commit,完整 89 文件,同时检查上次外部批准 3122b897 → 当前 head 的 ISCP 修复。未使用 subagent。当前账号是 PR 作者,故提交绑定 commit 的 COMMENT,不能提交 GitHub 自我 APPROVE。

设计与工程质量

  • DROP DATABASE 复用既有逐表物理清理 primitive,移除嵌套 SQL 执行及重复数据库级 FK 清理;隐藏对象仍由父表负责。没有对同一 workspace 增加并行写路径。
  • C→G→D→K→T→Q 将生命周期保护落实在现有 catalog、lockservice、事务和组件身份上;追踪了 frontend 发布者与 compile 删除者、applied frontier 后的身份重检、exact-row 本地/远端/proxy 路由及锁粗化拒绝。组件载入与回收共享现有 DAG 语义,没有新增持久状态机。
  • 临时表退休暂存仅由 DROP 语句的 Run/retry 生命周期持有;重规划期间保留 alias,终结时发布已到达前缀。内部 executor 的事务性临时表仍归原事务所有。正常 SELECT/DML 不分配这个状态。
  • allocator 终态过滤复用 workspace 的物理删除集合;ISCP 新修复复用已有 statement-scoped ClosedEvent,在 workspace 恢复后停止 lease 并清除失败语句的 fence。sync.Once 防止遗留的事务回滚 callback 清掉后续语句的新 fence。没有另建 callback 框架。
  • 删除了旧 quota 控制事务、测试专用 DROP wrapper、不可达 RC fallback 和禁用 View refresh 的无效 marker 写入。必要 DDL 日志保留。

增量分别审视:非生成实现/协议/支持代码 +3421/−567,测试及 SQL/result +4005/−454,文档 +380/−16,生成文件 +202/−158。净增较大,主要来自完整 RC 发布/删除协议和各边界验证;不能按“多数是测试”免审。测试中真实 SQL 的持久身份/消费者恢复、失败顺序、粗化/取消和结果所有权提供不同 oracle;旧全局串行预期与禁用功能测试已清理。历史设计明确标记为 archive,当前协议单独说明。

历史 comments 闭环

核对全部 review、issue comments、13 条 inline comments;六个技术 thread 当前均 resolved,且不只依赖这个标志:

历史问题 当前结论
首成员 reclaim 失败后,未到达的 allocator/ISCP 不应受影响 原真实 QA 及逐成员失败边界仍成立;本轮另验证数据库尾部失败后的已到达消费者恢复。
真实外层重试必须看到变化的 FK 原真实重试见证保留;当前 RC 路径重读完整 FK domain/物理身份,变化返回 def-changed retry,未缓存旧决定。没有把直接调用两次的 UT 当作这项证明。
同名 View、稀疏 nil index、重复逐表 FK DELETE 源码与相应测试均已修复;Sequence 的真实 FK 能力仍保留。
性能证据不匹配最终路径 已有受控对照及用户批准的验收调整:实测改善+慢目标期间无关操作推进;旧固定 25% 不再是当前合同。20.2%/23.3% 为文档记录的集成候选测量,本轮没有重跑或冒称当前 head 新测。
#29457 集成前置条件 已整合;当前真实两 CN 的慢目标/无关组件推进和锁升级挑战通过。

本轮实际 QA

使用仓库 CGo wrapper/native 输入,针对本 head:

  1. 两 CN 三项公开 SQL 测试全部通过,包耗时 46.698s:TestIssue29400CopyAlterRetainedGatePromotionFastFails、TestIssue29400DropDatabaseDoesNotHoldBranchDAGAfterTable、TestIssue29400DropDatabaseRCReclaimFailureRollsBackWholeDatabase。覆盖保留 UPDATE 锁的互相等待、整事务 victim 回滚、无关 DROP 推进、数据库尾部失败后 COMMIT、allocator 和原 ISCP job/hidden table/CDC tail 恢复。
  2. 审查者私有强化变体 PASS,42.00s:同一事务连续两次注入 DROP DATABASE 尾部 reclaim 失败,随后 COMMIT。检查原物理身份、branch snapshot、临时 alias、allocator、原 job ID;再次 INSERT 后 CDC tail 推进,MATCH(body) AGAINST('aftermarker') 实际查到新增行;后续成功 DROP 也通过。复用现有真实集群 fixture,仅扩大失败序列和结果 oracle,未向 PR 堆入重复测试。
  3. ISCP 本地与远端语句回滚 fence 测试首次 -race -json 均非空通过;按记录的测试耗时分别执行两个精确测试 -race -count=100,均通过(包耗时 3.148s / 4.385s)。既有完整 owning-package race 证据来自作者当前修复记录,明确不冒称本轮重跑。
  4. git diff --check 通过。生成的 protobuf descriptor 解压后与 base 比较,唯一语义增量是 LockOptions.KeepRows bool 字段 14;marshal/size/unmarshal 与协议一致。

Q1:result/packer/proc、临时退休和 fence 有明确终结 owner;Q2:取消、statement rollback、整事务 abort/commit 及重试边界与现有 owner 对齐,真实等待挑战通过;Q3:组件/descriptor/bitmap 为请求或 datasource 生命周期,bitmap 有显式阈值;整个大事务锁集、workspace 及历史目录扫描不被宣称为常数开销。

保留的边界

  • 含 ALTER 历史的组件仍可能提升全局 G 并全目录扫描,未独立建立这类规模的性能结果;不能外推普通分支的无关操作推进结论。
  • 首次启用要求已批准的全量维护切换;不支持新旧协议在线混跑。未执行本轮部署/回滚演练。
  • #27575 两小时断连原因及更广 TN merge scheduler 的晚期 commit/unknown outcome 不是本轮证明完成的内容。
  • 按要求不等待 CI;本轮未运行全套 BVT、大规模重新计时或所有平台构建。源码审查与有限真实挑战不等于穷尽所有极端场景。

本轮未修改 PR 生产代码、PR 描述或 thread 状态。完整分组审查记录、私有 QA 源码及原始日志保存在 /private/tmp/mo-review-29393-20260929/。

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cancelled DROP DATABASE leaves restored AUTO_INCREMENT tables unusable after COMMIT

5 participants