Repository navigation
fix: remove lifecycle waits from embedded race fixtures - #29875
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? |
There was a problem hiding this comment.
Final review: SUBMISSION PASS
Reviewed 73b325fc7eee603d715545ec7c5af79e12be6f06 against merge-base 90a822ec7b603034fbb5d8baacd5a06d551ee52e. Actual model: gpt-6.1-sol / xhigh, session 01a128e4-cec3-7860-81a8-4735c73a9590. Complete 22-file change map, accepted designs, final code review and evidence reconciliation: no remaining material blockers.
Design and unhappy paths
- Existing CN/TN heartbeat owners receive bounded, coalesced notifications after successful state transitions; failed/no-advance paths do not fabricate readiness.
- Cron discovery, replacement jobs and SQL operations preserve generation cancellation and joins. Successful committed work wins cancellation races; healthy retry cadence and per-operation bounds remain intact.
- Automatic/manual upgrades share the existing interruptible retry wait, retaining 1/2/4/8/10s healthy backoff.
- Embedded runtime retirement follows completed service/stopper/file-service teardown, preserves incomplete ownership, and cannot delete a replacement registration.
- Testing lock timing belongs to the existing WithTesting configuration owner, with stored TN/legacy pointers and scenario overrides last. Production defaults, ordinary Unlock ownership, authoritative expiry and generation fences remain unchanged. No duplicate lifecycle/state machine, new worker or shutdown path is added.
QA and performance closure
Full owning and affected-consumer normal/race checks and complete ten-package incremental formatting/vet/molint/lint checks pass. Unchanged proof is reused only after source/contract reconciliation; the newly merged idxcron consumer has fresh normal/vet coverage. Negative controls discriminate the changed mechanisms, including real-RPC authoritative ownership and stale generation guards.
Fresh whole-embed race comparisons, including all Close costs:
| Order | Main | PR | Reduction |
|---|---|---|---|
| Main → PR | 346.71s | 267.20s | 22.93% |
| PR → main | 347.59s | 267.65s | 23.00% |
| Pooled mean | 347.15s | 267.425s | 22.97% |
Each predeclared pair and pooled result passes the 15% gate. All four runs preserve identical 116 roots / 375 outcomes, the original 349-outcome subset, four upgrade variants and query readiness (114 PASS, two existing SKIP roots). Candidate Close max is 0.304/0.360s. Mean footprint falls 26.14%, RSS 7.96%, CPU 8.65%; first-pair RSS rises 5.93%, explicitly retained in the resource assessment.
Rebase had no conflicts or delivered-byte changes. Main's subsequent idxcron-only change has no file overlap with this scope; merge-base remains 90a822. Linux CI and integration with newer main are pending, so these measurements establish local whole-embed race improvement, not a 22.97% reduction in the entire Linux CI job. No workflow/runner changes or manual CI actions.
Publication readback
GitHub automatically merged main after PR creation: current head efcb9da99c28b1a9d62fbfe8415058d2517aa960 has parents 73b325fc and 42d42546. The complete 22-file PR diff and every reviewed file hash remain identical. The review and local measurements above apply to 73b325fc; integration checks for the automatic merge remain pending.
There was a problem hiding this comment.
Deep review of efcb9da99c28 — code design acceptable; delivery gate remains blocked
Reviewed all 22 changed files against base/merge-base 42d42546fd2c2b2449cb81cea47f81d300139753, including the owning lifecycle, affected consumers and old/new paths. No subagents were used. This is a fresh read-only review, with prior execution evidence reused where its source and behavioral contracts remain valid.
Finding: [P2] Fix the issue reference that prevents the main CI workload from running
The Which issue(s) this PR fixes: section references only PR #29858. The actual preflight log rejects that reference as “no valid issue”. Consequently, the shared build, UT coverage and other main MatrixOne CI jobs are SKIPPED, and CI Required is failed. Linux UT racing is not running or merely awaiting completion.
Associate the existing related issue #29562, retaining #29858 as the preceding PR. The checker accepts an actual issue regardless of open/closed state; it rejects objects with pull_request. This should remain a related-issue reference: the overall 600-second CI improvement target has not been demonstrated. Also correct the stale body text: the current merge-base is 42d42546, while 90a822 remains the historical measurement baseline. A corrected description alone is not evidence that the required checks passed.
This is a confirmed delivery blocker, not evidence of a production-code failure. Recommendation: hold merge until preflight and the required integration checks pass. No workflow, runner or manual CI action was changed/performed during this review.
Design and implementation
No additional confirmed must-fix code finding:
- CN/TN notifications: reuse the existing serial heartbeat owner. Capacity-one wakeups coalesce changes and sample current state. Failed starts/fences do not announce readiness; CN readiness remains separately controlled. TN startup notification follows successful endpoint startup, and replica completion requires an actually started replica.
- Cron lifecycle: both cron implementations borrow the scheduler generation context through discovery and replacement, keeping query/operation timeouts and existing storage paths. Stop cancels and joins the owners before storage close. Success is handled before cancellation after a committed operation; failed-operation retries and backoff terminate on cancellation. Retired callbacks cannot execute in the next generation.
- Bootstrap retries: reuse the existing cancellation-aware wait and retain the healthy 1/2/4/8/10-second cadence. Already-canceled entry, deadline during backoff and success racing cancellation have distinct oracles.
- Runtime retirement: cleanup belongs to the operator that registered the runtime. Deletion follows completed service shutdown, stopper join and file-service cleanup. Incomplete cleanup retains ownership; identity comparison protects a replacement registration.
- Test lock timing: belongs to
WithTesting, before scenario overrides. Production defaults are unchanged. The existing grace period, authoritative RPC validation, renewal/replacement generation checks and ordinary Unlock cleanup still determine retirement. Increased test heartbeat/scan traffic is a real cost, covered by affected-consumer and resource measurements.
The changes remove fixed waiting and stale ownership at existing owners; they do not introduce a second scheduler, storage path or lifecycle state machine. No newly obsolete branch or unused abstraction requiring removal was identified.
Test quality, unhappy paths and evidence limits
The increments were assessed separately: implementation 11 files, +128/-49; tests 11 files, +838/-12; tracked documentation 0 files. The test growth covers distinct startup, in-flight notification, failure/retry, blocked storage, commit/cancel, restart and replacement contracts. Shared memory fixtures, barriers and virtual time are reused; real scheduler/cluster cases retain their behavioral purpose. Existing test callbacks invoked after stopping a fixture explicitly retain a live fixture context, while separate lifecycle tests exercise actual owner cancellation.
Reconciled the prior owning-package normal/race terminal records, affected DML/issue/SQL consumers, full embed runs and discriminating negative controls. These are reused results, not tests newly executed during this review. All 22 delivery-file hashes match the measured/reviewed 73b325fc implementation. The later main merge changes idxcron code/tests outside that delivery; current integration checks remain outstanding.
The two reversed-order whole-embed race pairs support the local claim: 347.15s → 267.425s mean, 22.97% lower, including Close, with identical 116 roots / 375 outcomes in all four runs (114 passing roots, two existing skips). CPU, RSS and footprint results were checked, including the first pair's RSS increase. This is Darwin arm64 package evidence; it does not establish the whole Linux CI improvement or the 600-second overall target.
Existing comments
At this review snapshot there are no inline review threads or external actionable code-review requests. The earlier self-review is reconciled above; the Qodo subscription notice is not a code finding. The new preflight failure and missing Linux integration/performance evidence remain open. The earlier blanket submission-PASS/pending-CI wording should not be read as current merge readiness.
Finding disposition after PR description update
The issue section now links actual issue #29562, the merge-base is corrected to 42d42546, and the description accurately records the failed initial preflight and skipped downstream workload. The description defects in the P2 finding are addressed. Required checks and Linux UT racing measurements remain outstanding; no successful CI result is claimed. Source head remains efcb9da99c28; no source/workflow/runner changes or manual CI rerun were made for this correction.
New CI evidence: code-readiness conclusion superseded
The second attempt passes preflight and shared build, but Coverage UT job 114424435721 fails on two concrete paths. The earlier no-code-blocker conclusion is withdrawn pending closure of this evidence.
-
Runtime-retirement consumer gap: sqlintegration crashes in
TableDetector.scanTable -> sqlExecutor.Exec -> txnClient.New -> getTxnModeatpkg/txn/client/client.go:927, dereferencingruntime.ServiceRuntime(client.sid)after the registration is absent. The embedded operator now deletes runtime registrations; the process-local CDC detector retains its SQL executor across CN lifecycles. Its scan goroutine has an independent background context,Closeonly cancels without joining, andscanTablecreates another background-derived context. Service/stopper teardown therefore does not establish that this consumer is quiescent before registry retirement. The new deletion exposes an actual missing lifecycle closure. This consumer must be retired/joined or otherwise prevented from using the old generation before runtime deletion; simply relaxing the assertion or returning a default transaction mode would not close ownership. My prior review missed this reverse consumer. -
Remote native-error contract failure:
TestRemoteNativeFailureSQLContractatpipeline_failure_native_test.go:110, with stream reuse enabled, runsselect k from src union all select cast(k * 1000 as tinyint) from src. Expected MySQL error 1690 (0x69a); actual error 20101 (0x4e85), with messageallocation account invariant failure / remote allocation statement group already aborted. The original range error is masked by allocation/abort processing. This is an observed contract failure; attribution to this PR versus clean base has not yet been established. Do not classify it as an environment failure or waive it without that comparison.
The failed job is executing tests, not rejecting a coverage-percentage threshold. Diagnosis made no source or CI configuration changes and did not trigger a CI rerun.
efcb9da to
e561b75
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Final CI-repair review: SUBMISSION PASS
Revision: e561b75a2a5427dfc1a06e0c1d61a931fa726698; rebased onto a6eba2d7b56a5bc72c6d9842361b40f24e15c1ff. Reviewed the complete 41-file delivery, implementation/test increments and existing responsibilities. Verified actual model gpt-6.1-sol / xhigh, session 01a12a32-9eae-76f3-be63-fa2f18b89199. The source fingerprint is 03123583eee41ed30865bef8d802dbba8a0712c229fbd45cb9bac268e01196be.
CI causes and disposition
- CDC runtime retirement — fixed. The process-global scanner retained an old SQL executor and was neither canceled through its SQL context nor joined before CN runtime deletion. Discovery now belongs to the exact service runtime; shutdown seals/cancels, stops task producers and joins scans/callbacks before dependency retirement. Delayed frontend cleanup and reader accounting retain their detector generation. Closed transaction clients reject metadata access under the existing lifecycle gate. A failed drain keeps retirement incomplete.
- Native SQL error masking — fixed. The old aborted-group/tombstone path could replace MySQL 1690 / SQLSTATE 22003 with an allocation invariant. The mechanism was already present on the pre-delivery base. Existing groups and bounded tombstones now retain a compact first causal error; legitimate late fragments preserve it. Invalid topology, identities/counts/capacity and actual cleanup allocation invariants remain visible. The deterministic pre-fix counterexample fails with the old invariant.
- Rejected-fragment ownership race found during final review — fixed. Unowned-board sealing is serialized with admission through the existing registry mutex. Destruction stays outside it. The authoritative closed flag prevents admission of a sealed board; a second rejected cleanup does not hold global admission while another destructor is blocked.
- Finalization window and canceled-test double notification — fixed. Matching late fragments retain their cause while the finalizer still owns the board; scan cancellation is checked before new work and test notifications are idempotent.
- Takeover test false-positive risk — fixed. An expired heartbeat permitted A to reclaim a row intended for B. The real SQL test now limits eligibility with existing account labels, directly asserts durable B/C ownership and restores labels on every exit. Manual-scan admission barriers and real periodic scanning remain covered.
Final evidence
All checks are on the unchanged final source, Darwin arm64 / Go 1.27.1, repository CGo runner, -count=1, GOMAXPROCS=8; public fixture packages run serially with -p 1.
| Scope | Normal | Race |
|---|---|---|
| Whole txn/client, CDC, compile, CN, frontend, MessageBoard packages | PASS | PASS |
| Whole DML, 44 roots | PASS | PASS |
| Whole SQL integration, 28 roots | PASS | PASS |
| Whole embed, 116 roots / 375 outcomes | PASS, 195.963s | PASS, 268.302s |
| Final incremental formatting / diff check / configured lint and vet | PASS | — |
| molint | PASS; 16 unchanged baseline diagnostics, zero new | — |
Embed retains exactly 114 passing roots and the two existing skips. The frontend allocation test's pre-existing !race build constraint is explicitly reconciled; no new skip or removed test is used. Deterministic controls cover cancellation and joined cleanup, retired/replacement runtimes, callback generation ownership, active/tombstoned/finalizing native errors, invalid registrations, blocked destruction, unrelated admission, wire MySQL codes/SQLSTATE and real invariant errors. Original unaffected bootstrap/TN/taskservice/runtime evidence is reused with source and contract reconciliation.
Design and overall review have no remaining material blocker. Complexity remains at existing owners: no second registry, response barrier, production topology change or new cluster fixture. Failure-only diagnostics are bounded; success paths add short synchronization and atomic reads.
The earlier 22.97% local whole-embed race improvement remains historical evidence. This head's single 268.302s run is validation, not a controlled Linux comparison; the overall 600-second Linux target is not claimed. No CI/workflow/runner configuration or manual CI rerun was changed. Required CI for this pushed revision remains pending. This review supersedes the former CI-related delivery hold.
aunjgr
left a comment
There was a problem hiding this comment.
APPROVE at87de072c2b4ec28038995945552bc50035d97cfb against basee454407a1a94d13fd136706d02ffb5f0dfa3de35. No confirmed blocker in the reviewed lifecycle/ownership boundaries; this is not a certification of the overall Linux600-second target.
Independently traced service-owned CDC discovery admission/seal/cancel/drain, exact runtime-generation retirement after service dependencies, transaction-client closure gating, cron-generation context propagation and allocator transaction borrows. Allocator borrows are registered before queue publication, rejected enqueue releases after unlocking, accepted actions release after callbacks, and Close's FIFO barrier drains accepted work before stopping the worker. The run-SQL tracker invokes terminal drain callbacks asynchronously after its own lock is released, closing the suspected synchronous release/queue-lock cycle. CDC callback admission bounds concurrent work; CN shutdown seals discovery before producer shutdown and joins admitted work before dependency retirement.
Reviewed remote native-cause retention and board admission/sealing contracts, bounded diagnostic tombstones, and retained invalid-topology/allocation-invariant controls. Embedded timing changes are scoped through WithTesting and do not replace readiness or lock-retirement validation. The checkpoint and Bash fixes retain actual completion/cancellation oracles rather than relying on sleeps or weakening assertions.
Evidence reused: current-head required CI and UT/SCA/coverage/BVT are green; author owning normal/race suites, deterministic fault/borrow/takeover proofs and platform-specific Bash checks retain their stated revisions. No fresh full package/race/embedded/performance run was performed locally. The review independently checked the listed owner/terminal paths and test contracts, not every hunk of the wider CI-repair series. Historical performance reductions are not relabeled as a current-head Linux measurement. Diff whitespace checks pass.
Join admitted SQL and owner checks before runtime retirement; pin frontend borrowers to their CN generation. Compare CDC restart collection against the final durable checkpoint instead of a live-reader sample (fixes #29894).
87de072 to
77f9eca
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Follow-up fixes reviewed at commit 77f9eca, rebased onto main61d8e2887f0. The remaining watermark updater lifetime finding is closed: the CN runtime owns one updater; frontend borrows its exact generation; SQL, snapshot epochs, owner checks and queue publication share one cancellation/admission boundary. CN shutdown joins admitted I/O and workers before dependency retirement. Timeout remains fail-stop and retains dependencies; post-stop cache-only cleanup stays supported. The global singleton/reset API and dead frontend detector stubs are removed.
Fixes #29894 without weakening the restart oracle: the pre-close sample is a lower bound, the final durable watermark is read while replacement admission is blocked, and the first actual CollectChanges start must exactly equal that final value. Row1 exclusion, row2 exactly-once and row3 delivery assertions remain. A controlled later real-snapshot checkpoint causes the old equality assertion to fail; the same injected fixture passes after the fix in race mode. This does not claim reproduction of the original probabilistic Linux interleaving.
Fresh uncached normal/race verification passes for complete CDC, frontend, CN, compile, embed and SQLintegration packages, including real multi-CN takeover. Final regressions verify direct/queued/cron/owner-check cancellation, timeout and late I/O rejection, pinned generation, and real frontend session creation across CN close. Complete-delivery configured lint and final test delta checks report zero new issues; standard vet/formatting pass, and all 18 existing molint diagnostics match the verified baseline. Unchanged allocator/checkpoint/Bash/DML and other closures retain source-valid earlier evidence.
Verified gpt-6.1-sol / xhigh design and final overall REVIEW PASS, with all evidence conditions closed. The complete 58-file delivery, including rebase dependencies and final cleanup changes, is reconciled with source-map SHA2569f64c796b9f489fe78ea864b9a97392aa2f02909fc1bba8a2feb385e74a94ea2. Local validation is Darwin arm64, Go1.27.1, the repository CGo runner, count=1. Current elapsed times are validation under concurrent load, not performance comparisons. The Linux600s goal remains unproven, and CI for this new head is pending.
There was a problem hiding this comment.
结论已撤回(2026-10-12): 本地普通与 race 测试复现了 New 与 runtime retirement 并发时的 nil-pointer panic。下面的“无阻塞项”和“生命周期闭环通过”已被最新阻塞 review取代;性能适用范围也在新 review 中修正。
Deep review — 设计与生命周期闭环通过;性能影响需如实限定
Reviewed the exact head 77f9ecad91cd6a6e4d035900682bb01d214474cf against base 61d8e2887f0ae5b63e3baa7b399e3b10b9c47d6a. I found no confirmed correctness or design blocker in the current diff.
职责仍归属于既有 owner:CDC detector 和 watermark updater 是 CN runtime 的资源;frontend/task 持有精确 generation 的借用;CN 先停 producer、封 admission 并 join 已准入的工作,再关闭 SQL、pipeline 及后续依赖。runtime 使用 identity compare-and-delete,旧 generation 的清理不会误删替代者。watermark SQL、snapshot epoch、owner fence 和 queue publication 共用一个 admission/cancellation 边界;没有另起全局状态机、SQL 存储路径或重复 worker。remote allocation 的首个原生错误在清理/abort 期间保留;allocator queue 接收事务 action 前登记 borrow,拒收时在解锁后释放,接收后在 store 和 callback 完成后释放。这些额外状态和同步各自对应明确的生命周期或错误契约。
Unhappy path 的关键边界也闭合:close 超时会保留依赖并 fail-stop,不会提前销毁仍被使用的资源;sealed/closed admission 拒绝新工作;取消与提交竞争保留正确结果;队列、cron、SQL I/O、scanner 和 callback 均有对应 drain/join。历史 review 中提到的 scanner 使用已退役 runtime、native SQL 错误被 allocation invariant 覆盖、allocator borrow、checkpoint completion、Bash PID、takeover 假阳性及最终 watermark 采样问题,在当前代码/回归覆盖中已关闭。本 head 没有 inline review thread;Qodo 留言是服务暂停通知,不是代码问题。
我分别核对了实现与测试增量:实现 26 个文件(+871/-382),测试 32 个文件(+2168/-225),没有文档文件。新增测试覆盖 owner/generation、in-flight drain、取消/失败/重试、错误 wire contract、真实 takeover 和 restart oracle;不是仅靠 mock 或增加断言行数。精确 head 的 GitHub CI Required、Ubuntu/x86 UT、Linux/arm64 SCA、coverage、Compose/standalone multi-CN BVT、Connector/J 和 CodeQL 均成功;其他平台或非适用 job 被显式 skip。本地没有重复跑已通过的套件。
性能结论有边界。 旧的 whole-embed race 定时结果不代表这个 head 的 TP 性能,当前 CI 也不是 TP 基准。新增 allocator borrow 会在接收的事务 action 上增加派生 context、tracker admission/release 和同步;它触及 auto-increment 执行路径,正确性收益明确,但本 review 没有可比的 TP 吞吐/延迟数据,因此不能声称性能无影响或已有性能提升。建议后续以 auto-increment-heavy TP workload 对比吞吐、尾延迟和分配量;目前没有足够证据将潜在成本判定为回归 blocker。
本 review 为 COMMENT-only:PR 作者不能批准自己的 PR;这不是 APPROVE 状态。
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review:1 个已本地复现的阻塞问题,暂缓合并
审查精确 head 77f9ecad91cd6a6e4d035900682bb01d214474cf,base/merge-base 61d8e2887f0ae5b63e3baa7b399e3b10b9c47d6a。全程单人审查,没有 subagent。撤回并取代上轮同 head 的“无阻塞项”结论:绿色 CI 和已有的 Close 后 New 测试漏掉了一个相邻的并发边界。
[P1] New 已完成 metadata 快照后,runtime 退役仍能使 operator 构造 panic
真实调用链是 txnClient.New → newTxnOperator → txn/util.GetLogger → runtime.ServiceRuntime(sid).Logger()。新增的 metadata gate 在构造 operator 之前就释放;Close 可以完成,embedded owner 随后删除 runtime,而尚未进入 admission 的 New 没有被这个 gate 或 stopper join。New 恢复时 panic,晚些时候的 closed 检查无从执行。具体位置见本 review 的 inline finding。
本地探针调用真实 New/Close/runtime retirement,生产源码没有改动。普通和 race 均得到同一条 nil-pointer panic 栈:txn/util/log.go:30 → txn/client/operator.go:669 → txn/client/client.go:547。保留 runtime 的相邻对照返回 client-closed;已经 Close 再调用 New 的对照也返回 ErrClientClosed。探针只用合法的空操作 options 扩大已经存在的调度窗口;不将这种放大方式当作生产发生频率。
修复可以复用现有依赖归属:client 已持有 logger,未改动的 NewWithSnapshot 也把它直接交给 operator。无需新建 registry、状态机或执行路径;不能把 admission 等待纳入 shutdown gate。
设计、既有评论和增量核对
已完成全部 58 个文件的变更映射并追到实际 owner、consumer 和清理路径:
- CDC detector/updater 的 CN runtime 归属、frontend 精确 generation、先停止 producer 再 join I/O/扫描/回调的方向合理;旧 process-global owner 已清理。runtime retirement 的整体结论仍被上面的事务构造消费者缺口阻塞。
- allocator 复用既有 RunSQL borrow tracker,队列拒收后在解锁外释放,成功接收后覆盖 store 与 callback;没有重复状态机。
- remote allocation 保留有界首个原生错误,同时保持 identity/count/capacity 的真实 invariant 错误;board seal 与 admission 共用既有锁,阻塞析构移出全局锁。
- cron 的 generation cancellation、成功提交与取消竞争、bootstrap 可取消退避、CN/TN 容量为一的 heartbeat 通知,以及只影响测试配置的时序调整,未发现第二个已确认阻塞问题。
- checkpoint completion barrier、Bash PID、真实 multi-CN takeover 归属、restart watermark 的最终 durable sample 分别核对了真实 oracle;测试体量没有作为豁免。实现为 26 文件 +871/-382,测试为 32 文件 +2168/-225,文档文件为 0。
当前没有旧 inline review thread;Qodo 留言为服务暂停通知。历史 review 中的上述具体修复已逐项核对,但不能再声称 runtime retirement 问题全部解决。此前两次外部 APPROVE 在旧 87de072,不是当前 head 的批准。
本轮实际本地验证
环境:Darwin arm64、Go 1.27.1、GOMAXPROCS=4、仓库 mo-cgo-test、-count=1。隔离 worktree;native 输入与复用产物 provenance 已核验。这里是实际执行结果,不是复用 CI 的表述。
| 验证 | 结果 |
|---|---|
| 新增 New/Close/runtime retirement 探针,普通模式 | FAIL:上述 nil-pointer panic |
同一边界及保留 runtime 对照,-race |
退役分支 FAIL;保留分支 PASS |
保留 runtime 对照单独 -race -v |
PASS,返回 client-closed |
原有整个 pkg/txn/client,-race,排除临时探针 |
PASS:193 个顶层测试,273 个含子测试的通过事件 |
CDC / allocator / cron / remote allocation 的 12 个重点顶层边界测试,-tags=matrixone_test -race |
PASS:36 个含子测试的通过事件 |
精确 head 的 CI run 38149233709 仍是绿色;已检查 UT artifact 的 race 选择和终态。它未覆盖本次新增交错,不能推翻本地反例。本轮没有重跑整个本地 embed/SQL integration suite;相应精确 head CI 证据继续复用。
性能判断修正
New/RestartTxn 每次新增一次 lifecycle RLock/RUnlock,这是普通事务入口的实际同步开销。allocator 的新增 context/tracker borrow 仅发生在 act.txnOp != nil;tableCache.commit() 清掉该事务,因此已提交表的普通 INSERT/补号不会每次承担这段 borrow。队列 worker 增加了相应条件/取消检查。上轮将 allocator 成本笼统归到 auto-increment-heavy TP,范围过宽,现予修正。
没有这个精确 head 的可比 TP 吞吐/尾延迟基准,不能声称“性能无影响”或量化回归;历史 whole-embed 提速也不是 TP 证据。未把没有实测回归的性能疑虑列为 blocker。
结论:修复 inline P1 并验证其并发回归后再合并。此账号是 PR 作者,因此正式提交 COMMENT 记录阻塞结论,不能提交自己的 REQUEST_CHANGES/APPROVE。
本地复现源码与命令(临时测试,不属于 PR 交付)
在精确 head 将下面文件放到 pkg/txn/client/review_29875_retirement_test.go,使用已满足仓库 native 前置条件的环境:
GOMAXPROCS=4 .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=60s -run '^TestReview29875NewConcurrentRetirement$' ./pkg/txn/client
GOMAXPROCS=4 .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=60s -run '^TestReview29875NewConcurrentRetirement$' ./pkg/txn/client
GOMAXPROCS=4 .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=60s -v -run '^TestReview29875NewConcurrentRetirement/retained-runtime-control$' ./pkg/txn/clientpackage client
import (
"context"
"fmt"
goruntime "runtime"
"runtime/debug"
"testing"
"time"
"github.com/matrixorigin/matrixone/pkg/common/moerr"
moruntime "github.com/matrixorigin/matrixone/pkg/common/runtime"
"github.com/matrixorigin/matrixone/pkg/logutil"
"github.com/matrixorigin/matrixone/pkg/pb/metadata"
"github.com/matrixorigin/matrixone/pkg/pb/timestamp"
"github.com/matrixorigin/matrixone/pkg/txn/clock"
"github.com/stretchr/testify/require"
)
type reviewRetirementGenerator struct{ entered, release chan struct{} }
func (g *reviewRetirementGenerator) Generate() []byte {
close(g.entered)
<-g.release
return []byte("review-txn-id")
}
func TestReview29875NewConcurrentRetirement(t *testing.T) {
t.Run("retained-runtime-control", func(t *testing.T) { reviewNewConcurrentRetirement(t, false) })
t.Run("retired-runtime", func(t *testing.T) { reviewNewConcurrentRetirement(t, true) })
}
func reviewNewConcurrentRetirement(t *testing.T, retire bool) {
sid := t.Name()
rt := moruntime.NewRuntime(metadata.ServiceType_CN, sid, logutil.GetPanicLogger(),
moruntime.WithClock(clock.NewHLCClock(func() int64 { return 1 }, 0)))
moruntime.SetupServiceBasedRuntime(sid, rt)
t.Cleanup(func() { moruntime.CompareAndDeleteServiceBasedRuntime(sid, rt) })
c := NewTxnClient(sid, newTestTxnSender()).(*txnClient)
t.Cleanup(func() { require.NoError(t, c.Close()) })
c.Resume()
g := &reviewRetirementGenerator{make(chan struct{}), make(chan struct{})}
c.generator = g
// Valid no-op options enlarge only the existing post-metadata scheduling
// window. Production source and New/Close/runtime removal are unchanged.
opts := make([]TxnOption, 1<<20)
noop := func(*txnOperator) {}
for i := range opts {
opts[i] = noop
}
result := make(chan string, 1)
go func() {
defer func() {
if p := recover(); p != nil {
result <- fmt.Sprintf("PANIC: %v\n%s", p, debug.Stack())
}
}()
op, err := c.New(context.Background(), timestamp.Timestamp{}, opts...)
if op != nil {
_ = op.Rollback(context.Background())
}
result <- fmt.Sprintf("returned %v", err)
}()
<-g.entered
closing, retired := make(chan struct{}), make(chan error, 1)
go func() {
close(closing)
err := c.Close()
if retire {
moruntime.CompareAndDeleteServiceBasedRuntime(sid, rt)
}
retired <- err
}()
<-closing
goruntime.Gosched()
close(g.release)
require.NoError(t, <-retired)
// Nearest existing control: a New begun after retirement rejects cleanly.
op, err := c.New(context.Background(), timestamp.Timestamp{})
require.Nil(t, op)
require.True(t, moerr.IsMoErrCode(err, moerr.ErrClientClosed), err)
select {
case observed := <-result:
require.NotContains(t, observed, "PANIC:", observed)
t.Log(observed)
case <-time.After(5 * time.Second):
t.Fatal("concurrent New did not return")
}
}该探针用于可达交错反证,不应原样交付为依赖调度概率的正式回归;修复时应在相同真实边界提供确定性的控制和断言。
| meta, err := client.snapshotTxnMeta() | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| op := newTxnOperator( |
There was a problem hiding this comment.
[P1] 生命周期保护必须覆盖事务构造中的最后一次 runtime 读取
snapshotTxnMeta() 返回时已经释放 lifecycle.gate,但紧接着的 newTxnOperator() 仍通过 txn/util.GetLogger(sid) 调用 runtime.ServiceRuntime(sid).Logger()。可达交错是:New 取完 metadata → Close 获取 gate 并完成 → embedded owner 删除该 runtime → New 恢复并构造 operator。此时直接 nil-pointer panic,根本到不了 doCreateTxn 的 closed 检查。
已在这个精确 head 的未修改生产源码上调用真实 New/Close/CompareAndDeleteServiceBasedRuntime,本地普通和 -race 两种模式均复现。仅保留 runtime 的相邻对照通过;Close 后才开始 New 的现有测试也通过,所以现有测试没有覆盖这个窗口。探针用合法的 no-op TxnOption 扩大调度窗口;这是生命周期交错证明,不是发生概率测量。
请让 operator 复用 client 已经持有的 logger(NewWithSnapshot 已经这样做),或确保短生命周期保护覆盖最后一次 runtime 读取,同时保持 admission 等待在 gate 外。补上“metadata 已完成、operator 尚未构造时退役”的回归;只测试 Close 后再 New 不足以关闭这个问题。完整探针和执行结果见本次 review。
…d index (#29863) After `DATA BRANCH CREATE TABLE` copies a table with a synchronized `FULLTEXT2` index, deleting a row **inherited from the copied index** does not shadow the copied posting. A **covered** full-text query (one that projects only columns stored by the index) keeps returning the deleted primary key, while the equivalent query that projects a base-table column returns the correct rows, because its `INNER` join against the base table happens to filter the ghost. Two equivalent predicates disagree, and the wrong answer survives a cold restart, so it is persisted index state rather than a cache/visibility delay. ```sql SELECT id FROM leaf WHERE MATCH(body) AGAINST('alpha'); -- => 1, 3 (1 was deleted) SELECT id, body FROM leaf WHERE MATCH(body) AGAINST('alpha'); -- => 3 | alpha branch new ``` ### Root cause `RestoreTable` (`pkg/sql/compile/ddl.go`) copies each special index's hidden tables and then re-registers its CDC with `startFromNow=true`. `registerJob` (`pkg/iscp/watermark_updater.go:212`) resolves that to: ```go startTs := types.TS{} if startFromNow { startTs = types.TimestampToTS(txn.SnapshotTS()) // PRE-commit snapshot of the DDL txn } ``` So the clone's **own row appends** commit strictly after `startTs` and land *inside* the first change range the copied index is maintained from — sharing that one range with the user's branch `DELETE` of an inherited row. `filterBatch` (`pkg/vm/engine/disttae/logtailreplay/change_handle.go`) classifies a key whose first op in the range is an `INSERT` and whose last is a `DELETE` as **Case 2.2**, and with `isRecoveryMode=false` drops **both** as "no net change": ``` pk1 insert@10 (the clone's copy) ┐ Case 2.2 → both dropped → NO tombstone pk1 delete@30 (the branch DELETE) ┘ ``` That cancellation is only sound when the consumer's materialized state equals the table state at the range start, because the leading `INSERT` is then proof the key was absent before the range. **A copied index violates that precondition by construction**: its base segment already holds `pk1` from the source generation, at recency `0`. With no tombstone written, nothing outranks the copied posting and `Index.resolve` keeps reporting `pk1` as live. The covered path projects straight out of the index, so the ghost reaches the user; the joined path only *looks* correct. `ALTER ... REINDEX ... FORCE_SYNC` "fixes" it merely by discarding the copied base. This is the same precondition break that `isRecoveryMode` already exists for on CDC restart-from-checkpoint — the cloned generation was simply never covered by it. Decoded persisted state before the fix: one tail chunk, `n_inserts=2 (pk2,pk3)`, **`n_deletes=0`** — the delete never reached the sink at all. ### The fix One opt-in engine option, requested only for the ranges where the Case 2.2 precondition is actually broken: - **`pkg/vm/engine/change_handle_net_effect.go`** (new) — `WithCollectChangesKeepTrailingDeletes(ctx)` / `CollectChangesKeepTrailingDeletesFromContext(ctx)`, mirroring the existing `WithCollectChangesPreserveAllVersions` pattern, with explicit `nil`-context handling. - **`pkg/iscp/util.go`** — the shared `CollectChanges` wrapper stays a **plain pass-through** for the caller's `ctx` and injects no policy of its own (`skipDeletes` unchanged; only the doc comment differs from `main`). This keeps the other caller — the `mo_iscp_log` self-scan in `applyISCPLogWithRel` (`executor.go:794`), which maintains no copied index — on the default net effect. - **`pkg/iscp/iteration.go`** — new `collectChangesCtxForJobs(ctx, jobSpecs, prevStatus, committedWatermark)` + `jobStateMayLagRangeStart(jobSpec, status, committed)`, applied at the one index-maintenance read site (`iteration.go:238`). A job generation is opted in **only** while it was seeded by `InitSQL` *and* its materialized state may still predate the range start: `prevStatus.ErrorCode != 0` (the last attempt may have been applied only partially, so its range is retried from the same lagging state), `prevStatus.To.IsEmpty()` (no range selected yet), or `committed < prevStatus.To` (a range was selected but its consumption never committed). All three inputs come from the durable `mo_iscp_log` row, so the window is bounded by **durable consumption** — not by the index algorithm, and not by a range the executor merely selected. - **`pkg/iscp/iteration.go` — `GetJobSpecs`** now also selects the durable `mo_iscp_log.watermark` column and returns it as a third value, decoded with the same `types.StringToTS` the replay path already uses (`executor.go:1148`). That column is the authoritative commit boundary: only the sink transaction's `UpdateWatermark` (`data_retriever.go:166`, reached from `fulltext2_consumer.go:121`, `cuvs_writer.go:403`, `index_consumer.go:242`/`:383`) or the Snapshot path's final flush (`iteration.go:331`, persisting `watermark = status.To` at `:336-338`) advances it to a range's `To`, and it is the same column the scheduler reads back to choose the next range's `from` (`consumer_entry.go:153-154`, `job_config.go:88`). Its five `pkg/iscp` call sites in `iteration_test.go`, the two `gostub` stubs in `pkg/vm/engine/test/change_handle_test.go`, and the fake `mo_iscp_log` result (one added `varchar` column) were updated to match; no production caller other than `iteration.go:112` exists. - **`pkg/vm/engine/disttae/logtailreplay/change_handle.go`** — all three `ChangeHandler` constructors honour the option. `NewChangesHandlerWithPartitionStateRangeAndPrimaryIdx` now passes `isRecoveryMode` into `prepareRangeNetEffectSpill` instead of a hard-coded `false`, so the **spill path and the in-memory path apply the same rule** (previously a range too large to coalesce in memory silently disagreed). `newChangesHandlerWithCheckpointEntries` ORs it with its explicit parameter. Comments on `isRecoveryMode` and Case 2.2 now name the cloned-generation trigger. **No filtering logic was rewritten.** - **`pkg/vm/engine/disttae/change_handle.go`** — `PartitionChangesHandle` captures `keepTrailingDeletes` at construction and re-attaches it in `collectChangesContext`, so a range split into successive sub-handles cannot lose the policy. `collectChangesContext` was also fixed to *chain* both options rather than early-return on the first. `installSnapshotStateRangeHandle` propagates it to the sub-handle it builds. **Why the window closes.** A *selected* range is not a *consumed* range. `ExecuteIterationWithRuntime` fills `statuses[i].To` and commits it with `ISCPJobState_Running` (`iteration.go:292`) **before** the consumers start (`:311`), and a stop inside that window leaves a row that `repairAbandonedJobs` (`executor.go:430-443`) and `addOrUpdateRecoveredJob` (`:1013-1030`) both turn into `Completed` while `To` and the zero `ErrorCode` stay intact — so a populated `To` cannot be the proof, and the durable `watermark` is used instead. The seed range is `typ == ISCPDataType_Snapshot` (`iteration.go:287-290`), so its final flush always runs (`:331`) and commits `watermark = status.To` with `ErrorCode = 0`; the next range then reads `committed >= To` and the option is off. Every later range starts after the clone's appends, where coalescing is sound again. The `ErrorCode` arm stays separate and is load-bearing rather than a second test of the same fact: a failed attempt persists `watermark = status.From` (`iteration.go:336-338`), but two maintenance passes advance that column **without replacing `job_status`** — `ISCPLogAdvanceWatermarkSQL` (`sql_builder.go:1225`, called from `consumer_entry.go:233`) and the clean-table pass (`executor.go:618`). Either can later move the watermark past a range that was never applied, and only the retry flag keeps that tombstone alive. A success clears it (`statuses[i]` is rebuilt fresh each iteration, `SetError(nil)` is a no-op), and a permanently failed job goes terminal and stops being a candidate (`iteration.go:976-994` sets `PermanentErrorThreshold` and flushes `ISCPJobState_Error`; `table_entry.go:148` then skips it via `IsInitedAndFinished`, `consumer_entry.go:164-166`). The seed read also cannot leak into an unrelated job: `getCandidate` appends the empty-watermark iteration and `continue`s before the shareable pool (`table_entry.go:163-174`), and an `InitSQL` job in `JobStage_Init` is forced unshared (`:182-183`). The option keeps the trailing `DELETE` and still drops the redundant `INSERT`, so it cannot resurrect or duplicate rows. Deliberately **not** changed: recency rules, the CDC start boundary, the frame format, and query plans. Moving `registerJob`'s `startTs` to a post-commit timestamp was considered and rejected — `startFromNow = snapshotTS` is intentionally at-least-once for `CREATE INDEX`, where the index is built from the snapshot and CDC must not miss anything committed between the snapshot and the DDL commit; shifting that boundary risks losing updates for *every* index type. ### Blast radius `iscp.CollectChanges` has exactly **two** callers (`pkg/iscp/executor.go:794`, `pkg/iscp/iteration.go:238`), and only the second — the index-maintenance read — can opt in, and only for the bounded seed/retry window above. `pkg/cdc`, `pkg/publication`, `pkg/frontend/data_branch.go` and `colexec/table_function/table_changes.go` all use their **own** wrappers and are untouched, so no downstream-CDC or publication behaviour changes. `iscp.GetJobSpecs` gained one return value, and it has exactly **one** production caller (`pkg/iscp/iteration.go:112`) plus seven test call/stub sites, all updated here. The added `watermark` column is already part of the row's DDL (`pkg/frontend/predefined.go:307`, `watermark VARCHAR NOT NULL`) and is already selected by the replay snapshot (`cdc.CDCSQLBuilder.ISCPLogSelectSQL()`), so no schema, migration or CDC-replication change is involved — `pkg/cdc`'s `mo_iscp_log` sinker templates are untouched. The gate itself adds no new state: it reads a column the scheduler already reads, and no generation metadata is plumbed through `CollectChanges`. Keeping the delete means a sink can be handed a tombstone for a key it never received. Verified per sinker family: | Sinker | Behaviour on delete of an unknown key | | --- | --- | | hnsw | explicitly skipped — `pkg/vectorindex/hnsw/sync.go:511` (`cannot find key from existing models. ignore it`) and `:392` | | fulltext / ivfflat SQL writers | `DELETE FROM <idx> WHERE <pk> IN (...)` (`pkg/iscp/index_sqlwriter.go:309`, `:720`) — affects zero rows | | cuvs / cagra | encodes a lookup-free 9-byte delete record keyed by pkid (`pkg/vectorindex/cuvs/cdc.go:283`) | | fulltext2 | liveness keys deletes by pk and consults them only for pks present in a segment — proven inert below | ### Verification Live single-process cluster built from this branch, **data dir wiped and re-bootstrapped** so no state carries over. Readiness was gated on the **ISCP watermark**, never on `MATCH` and never on `REINDEX`, so the per-CN search cache was never pre-warmed: ``` base truth (leaf) : 2|beta retained row|20, 3|alpha branch new|30 COVERED select id ... alpha : 3 (before: 1, 3) COVERED select id, tag ... alpha : 3|30 JOINED select id, body... alpha : 3|alpha branch new → covered == joined retained beta : 2|20 SOURCE control (src) alpha : 1|10 → source index unaffected ``` `EXPLAIN` of the covered query contains **0** `Join` lines and **1** `Table Function on fulltext2_search`, so the correct answer comes from the index itself, not from a join masking a still-stale posting. Decoded persisted index state after the fix (`tbl=leaf`): ``` copied base : recency 0, nrow 2 ← inherited generation cdc_tail:1 : recency 1, n_inserts=1 n_deletes=0 payload=6144 ← clone copy of retained pk2 cdc_tail:2 : recency 2, n_inserts=0 n_deletes=1 payload=28 ← TOMBSTONE for inherited pk1 cdc_tail:3 : recency 3, n_inserts=1 n_deletes=0 payload=6144 ← branch insert pk3 ``` Tombstone recency `2` > copied base recency `0` — exactly the "tombstone newer than the copied base posting" the issue asks for. The same results and the same three frames were retained across a **cold service restart**. ### Issue-to-test proof | #28847 requirement | Test | | --- | --- | | Covered query must not return the deleted inherited row | `TestCopiedBaseShadowedByBranchDelete`, BVT covered `select id` / `select id,tag` | | The bug is real, not a harness artifact (**counterexample**) | `TestCopiedBaseWithoutDeleteFrameReturnsGhost` — no tombstone ⇒ covered search returns exactly `{1,3}` with pk1 live | | Tombstone must *outrank* the copied base (recency, not mere presence) | `TestCopiedBaseTailRecencyIsAboveBase` — also asserts a delete ranked *below* the base must **not** shadow it | | Engine drops the pair without the option, delivers it with it (**controlled ablation**) | `TestFilterBatchKeepsTrailingDeleteForCopiedIndexBase` — OFF ⇒ tombstone `EMPTY`; ON ⇒ tombstone `{1}`, data side `{2,3}` unchanged | | Option is narrow: only Case 2.2 changes (**8 counterexamples**) | `TestFilterBatchKeepTrailingDeletesIsScopedToInsertThenDelete` — delete-then-insert, +`skipDeletes`, delete-then-delete, reinsert, lone insert, lone delete, update-then-delete, independent keys | | Spill path must agree with the in-memory path | `TestSelectRangeNetEffectRowsKeepsTrailingDeleteInRecovery` — incl. nil/degenerate inputs and the `first==last` shortcut | | Option survives a range split into sub-handles | `TestPartitionChangesHandlePreservesKeepTrailingDeletesContext` | | ISCP forwards the caller's policy and opts in only inside the seed/retry window (**12-case table**, incl. nil spec/status, shared iteration, inline-built generation, both maintenance-flush passes) | `TestCollectChangesForwardsCallerPolicy`, `TestCollectChangesCtxForJobs`, `TestCollectChangesCtxForJobsKeepsCallerContext` | | A **selected** range is not a **consumed** range — an abandoned `Running` row must keep the window open | `TestCollectChangesCtxForJobs` / `"seeded generation stopped before any sink work"` ⇒ `true`; and `TestSeedWindowAcrossAbandonedRunningRow` round-trips the durable row through the production encoder (`MarshalJobSpec`/`MarshalJobStatus`/`normalizeJobStatuses`), `GetJobSpecs`' real SELECT + decode and the real gate: `watermark == From` ⇒ `true`, `watermark == To` ⇒ `false` | | The retry arm cannot be folded into the watermark comparison | `TestCollectChangesCtxForJobs` / `"failed range whose watermark a maintenance flush already passed"` ⇒ `true` (a clean-table pass moved the column past a `job_status` the failed flush left behind) | | **Boundedness**: steady-state insert-then-delete churn must keep cancelling, so no append-only sink accumulates delete-only history | `TestCollectChangesCtxForJobs` / `"seeded generation after its first committed range"` ⇒ `false`, plus the real-engine control below | | The seed-range fixture owns every batch the real reader returns | `TestCollectChangesSeedRangeDeliversInheritedDelete` reads from a dedicated `mpool` and ends on `require.Equal(readBaseline, readMP.Stats().NumCurrBytes)` ⇒ **0** outstanding bytes after all six range reads and handle closes | | Deterministic **collection-boundary** regression on the real engine read (`skipDeletes=false`) | `TestCollectChangesSeedRangeDeliversInheritedDelete` (`pkg/vm/engine/test`) — seed range: OFF ⇒ `0` deletes, ON ⇒ `1` tombstone for the inherited row; delete-only range delivered either way; steady-state churn ⇒ `0` **either way**; steady-state delete of an earlier row ⇒ `1` | | Option round-trip / nil-context safety | `TestCollectChangesKeepTrailingDeletesContextRoundTrip` | | Tombstone for a key the index never held is inert (**unhappy path**) | `TestDeleteOfKeyAbsentFromIndexIsNoOp` + BVT `phantom` ⇒ `EMPTY` (pk9 created *and* destroyed inside the branch window) | | delete-then-reinsert the same inherited key across frames | `TestCopiedBaseDeleteThenReinsertAcrossFrames` | | Branch `UPDATE` of an inherited row still correct (#27950 regression) | `TestCopiedBaseUpdateInheritedRow` + live branch UPDATE/INSERT run (incl. an HNSW index on the same table through the same wrapper) | | Non-cloned source tables unaffected | live source controls: same-txn insert+delete does not resurrect; delete+reinsert and update both leave the old text gone | | Covered and joined agree, with plan shape pinned | BVT `@regex` assertions: covered requires `fulltext2_search` present **and** `Join` absent; joined requires `Join Type: INNER` | The BVT case gates readiness with `@wait_expect(2, 90)` on `mo_catalog.mo_iscp_log.watermark` against a timestamp captured **after** the DML committed, and issues no `MATCH` while waiting. ### Test commands ```bash # Focused proofs (CGo wrapper is required; bare `go test` fails on xxhash.h/usearch.h/roaring.h) .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -v \ -run 'TestCopiedBase|TestDeleteOfKeyAbsentFromIndexIsNoOp' ./pkg/fulltext2/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -v \ -run 'TestFilterBatchKeepsTrailingDeleteForCopiedIndexBase|TestFilterBatchKeepTrailingDeletesIsScopedToInsertThenDelete|TestSelectRangeNetEffectRowsKeepsTrailingDeleteInRecovery' \ ./pkg/vm/engine/disttae/logtailreplay/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -v \ -run 'TestCollectChangesKeepTrailingDeletesContextRoundTrip' ./pkg/vm/engine/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -v \ -run 'TestPartitionChangesHandlePreservesKeepTrailingDeletesContext' ./pkg/vm/engine/disttae/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -v \ -run 'TestCollectChangesForwardsCallerPolicy|TestCollectChangesCtxForJobs|TestSeedWindowAcrossAbandonedRunningRow' ./pkg/iscp/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=1800s -v \ -run 'TestCollectChangesSeedRangeDeliversInheritedDelete' ./pkg/vm/engine/test/ # Full regression, no -run filter .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=2400s ./pkg/vm/engine/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=2400s ./pkg/iscp/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=2400s ./pkg/vm/engine/disttae/logtailreplay/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=2400s ./pkg/vm/engine/disttae/ .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=2400s ./pkg/fulltext2/ # every test in pkg/vm/engine/test/change_handle_test.go + the new seed-range test .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=3600s \ -run 'TestGetErrorMsg|TestFlushErrorMsg|TestChangesHandle|TestChangeHandleFilterBatch|TestPartitionChangesHandle|TestGetObjectsFromCheckpoint|TestISCP|TestUpdateJobSpec|TestFlushWatermark|TestGCInMemoryJob|TestIteration|TestDropJobsByDBName|TestInvalidTimestamp|TestCancelIteration|TestStartFromNow|TestApplyISCPLog|TestRenameSrcTable|TestStaleRead|TestInitSql|TestCheckLeaseFailed|TestRealStaleReadStillReturnsError|TestFileNotFoundFallbackToSnapshotRead|TestWaitForISCPWatermarkTimeoutDoesNotWaitForBlockedGetter|TestCollectChangesSeedRangeDeliversInheritedDelete' \ ./pkg/vm/engine/test/ # Repo self-checks make err-check # Does not find 'fmt.Errorf()' ... gofmt -l -s <changed files> # clean # The repo pins v2.14.0 (Makefile:install-static-check-tools) but go.mod says # `go 1.27.1`, so a linter binary built with go1.26 refuses to load .golangci.yml. # Rebuild it under go1.27.1 exactly as CI does (go-version-file: go.mod): GOTOOLCHAIN=go1.27.1 GOBIN=$(go env GOPATH)/bin \ go install github.com/golangci/golangci-lint/v2/cmd/[email protected] CGO_CFLAGS="-I$PWD/cgo -I$PWD/thirdparties/install/include" \ golangci-lint run -c .golangci.yml ./pkg/iscp/... ./pkg/vm/engine/ \ ./pkg/vm/engine/disttae/ ./pkg/vm/engine/disttae/logtailreplay/ \ ./pkg/fulltext2/... ./pkg/vm/engine/test/ # 0 issues CGO_CFLAGS="-I$PWD/cgo -I$PWD/thirdparties/install/include" \ go vet -vettool=$(which molint) <same packages> # 4 pre-existing findings license-eye -c .licenserc.yml header check # 6184 files, invalid: 0 # BVT (mo-tester, run mode) → TOTAL 32, SUCCESS 32, FAILED 0, RATE 100% ``` Results on the current head `7590df0d88` (all via the CGo wrapper, every command `rc=0`, zero `--- FAIL` lines): all focused tests `PASS` — `TestCollectChangesSeedRangeDeliversInheritedDelete` 0.17s including its 0-outstanding-bytes assertion, `TestSeedWindowAcrossAbandonedRunningRow`, and all **12** `TestCollectChangesCtxForJobs` subcases. All six suites `ok`: `pkg/iscp` 1.569s, `pkg/vm/engine` 0.760s, `logtailreplay` 2.634s, `disttae` 8.448s, `fulltext2` 4.065s, `pkg/vm/engine/test` change-handle subset 58.617s. Self-checks: `golangci-lint` v2.14.0 **0 issues**; `license-eye` 6184 files / **0 invalid**; `make err-check` pass; `go vet` clean over all ten packages that import `pkg/iscp`. `gofmt -l -s` reports only `pkg/vm/engine/test/change_handle_test.go`, whose two findings are **byte-identical on `origin/main`** at the same offsets (`@@ -4378` / `@@ -4484`, pre-existing `gostub` continuation-indentation); reformatting them would add churn to lines this PR does not need to touch, so they are left as upstream has them. `molint` reports only its two pre-existing `unsafe recover()` findings (`pkg/iscp/fulltext2_sqlwriter.go:102`, `pkg/iscp/iteration.go:1175` — both present on `origin/main`, both outside every hunk here). BVT `32/32` twice locally, and green in CI five times — on `59e2ba9c18`, `a5a73f8e6f`, `caa62ac8ca`, `d36ea83ad5` and `5b432ef87a`; this head's `test/distributed/` blobs are unchanged from all five (`.sql` `ddcc68433a6de25fe29f2d991572bb2a082b3ead`, `.result` `2d9a89425020a8783e7ed3374df1b7e8b577b493`). ### Review response — P2 cuVS delete-only history (`r4241023375`) **Accepted, and fixed by scoping the opt-in rather than by arguing the frame size.** Both cited owners were re-verified in code and the review is right about each: - `pkg/vectorindex/cuvs/cdc.go:623` — the `CdcOpDelete` branch does `delete(overflow, rec.Pkid); deleted[rec.Pkid] = struct{}{}`, and the `CdcOpInsert` branch immediately below *deliberately* does not clear the pkid from `deleted`. Every distinct deleted pk is therefore retained for the index generation's lifetime. - `pkg/vectorindex/cuvs/idxcron/cuvs_updatable.go:259-260` — `_ = totalDeletes; return totalInserts + totalUpserts`, so a delete-only workload can never arm the rebuild that would reclaim it. Under the previous **unconditional** opt-in the reviewer's workload (base rows unchanged, one fresh pk inserted and deleted inside each maintenance range) emits permanent delete-only history while the reclamation metric stays zero forever. That is an unbounded retained-history regression, and neither documenting a ~72-byte frame nor proving DELETE idempotence bounds it — so that argument was not made. The fix takes the review's second option, *scope policy through an existing consumer ownership boundary*, and leaves the cuVS retention/rebuild contract alone (changing it is outside this PR's purpose). The boundary is the durable `JobStatus` the ISCP iteration already reads and writes, so the option is live only while a consumer's materialized state can genuinely predate the range start — see **Why the window closes** under *The fix*. The reviewer's exact workload now reads with the option **off** and coalesces exactly as before; `TestCollectChangesCtxForJobs/"seeded generation after its first collected range"` pins the gate, and `TestCollectChangesSeedRangeDeliversInheritedDelete` pins the observable read on the real engine. Also addressed from the review body: - *"retain a deterministic collection-boundary regression when revising"* — `TestCollectChangesSeedRangeDeliversInheritedDelete` drives the real `disttaeEngine` read that `iscp.CollectChanges` performs (`skipDeletes=false`) over the exact ranges a copied index's consumer sees: seed range OFF ⇒ `0` deletes / ON ⇒ `1` tombstone for the inherited row, delete-only range delivered either way, steady-state churn ⇒ `0` **either way**, steady-state delete of an earlier row ⇒ `1`. This supplies the collection-and-wiring proof that hand-feeding a tombstone to `TailBuilder` and the literal-boolean spill helper could not; both are kept as unit-level controls. - The requested **delete-only churn case alongside a real inherited-row-delete control** is that same test's third and first blocks respectively. - The `pkg/iscp` wrapper test was renamed `util_collect_changes_test.go` → `collect_changes_policy_test.go` because it no longer tests a policy baked into `util.go`; `TestCollectChangesForwardsCallerPolicy` now asserts the wrapper injects **no** policy (which also keeps the `mo_iscp_log` self-scan at `executor.go:794` on the default net effect). ### Review response — P2 durable-watermark gate + P3 fixture ownership (`PRR_kwDOFEPiGM8AAAABRt6qIg`) **Both accepted. Both were re-verified in the source before anything was changed, and the P2 counterexample reproduces from it.** **[P2] `To != empty && ErrorCode == 0` did not prove consumption.** Three facts, each checked in code: - `ExecuteIterationWithRuntime` stamps `statuses[i].To` and commits it with `ISCPJobState_Running` at `iteration.go:292`, while `runISCPTaskIterationConsumers` only starts at `:311`. A stop in between persists a range that nothing applied. - `repairAbandonedJobs` (`executor.go:430-443`) rewrites **only** `job_state` (`Pending`/`Running` → `Completed`), and `addOrUpdateRecoveredJob` (`:1013-1030`) normalizes the same two states in memory. Neither touches `job_status`, so `To` stays populated and `ErrorCode` stays `0`. - The next range's `from` is derived from the durable watermark (`consumer_entry.go:153-154` → `job_config.go:88`), so an abandoned row re-reads a range the old gate had already declared consumed. Case 2.2 cancels the clone's append with the inherited delete again, and the retry can commit its watermark while the copied FULLTEXT2 posting stays queryable — the exact bug this PR exists to fix, reintroduced on a crash path. The old gate was wrong, and the persisted-nonzero-error control could not cover it, precisely because that path leaves `ErrorCode == 0`. **The gate now keys off the existing durable consumption boundary.** `GetJobSpecs` selects `mo_iscp_log.watermark` and returns it as a third value; `jobStateMayLagRangeStart` opts in when `ErrorCode != 0`, or `To.IsEmpty()`, or `committed < To`. That column reaches a range's `To` only through the sink transaction's `UpdateWatermark` (`data_retriever.go:166`, reached from `fulltext2_consumer.go:121`, `cuvs_writer.go:403`, `index_consumer.go:242`/`:383`) or the Snapshot path's final flush (`iteration.go:331`, `:336-338`), and it is the same column the scheduler already reads back to pick the next `from` — so this is the contract the review asked to base the gate on, not a new one, and no generation metadata is plumbed through `CollectChanges`. The `ErrorCode` arm was **kept, and is now demonstrably load-bearing rather than a redundant second test of the same fact**: a failed attempt persists `watermark = status.From`, but two maintenance passes advance the column *without replacing `job_status`* — `ISCPLogAdvanceWatermarkSQL` (`sql_builder.go:1225`, called from `consumer_entry.go:233`) and the clean-table pass (`executor.go:618`). Either can later carry the watermark past a range that was never applied; folding the retry into the comparison would silently drop its opt-in. `"failed range whose watermark a maintenance flush already passed"` pins that, and `"seeded generation whose watermark a maintenance flush passed"` pins the healthy direction (`committed > To`, no error ⇒ `false`). **Both requested controls were added:** - *Abandoned-`Running`, including interruption before any sink work* — `TestCollectChangesCtxForJobs/"seeded generation stopped before any sink work"` at the predicate level, plus `TestSeedWindowAcrossAbandonedRunningRow`, which drives the reviewer's exact transition through the **production** encoder (`MarshalJobSpec`, `normalizeJobStatuses`, `MarshalJobStatus`), the **production** SELECT/decode inside `GetJobSpecs` and the **production** gate: `watermark == From` (the Running flush wrote `iterCtx.fromTS`, no consumer ran) ⇒ `keep=true`; `watermark == To` (the sink committed) ⇒ `keep=false`. Only `ExecWithResult` is injected, so no hand-built `JobStatus` can mask a decode mismatch — and it asserts the round trip on the way (`prevStatus[0].To == to`, `ErrorCode == 0`, `committed[0] == watermark`). - *Successful-progress / churn control retained* — `"seeded generation after its first committed range"` ⇒ `false`, and the real-engine steady-state churn block of `TestCollectChangesSeedRangeDeliversInheritedDelete` still asserts `0` inserts and `0` deletes with the option **off**. The cuVS boundedness fix from the previous round is not lost by this revision. **[P3] The seed-range fixture leaked the batches `Next` returned.** The ownership contract was confirmed as described: `ChangesHandle.Next` transfers each nonempty `data`/`tombstone` batch to the caller, `changes.Close()` releases the handle's own resources rather than batches already handed out, and neither `checkInsertBatch` nor `checkTombstoneBatch` frees anything — so the leak was present on the success path, not only on assertion/error exits. The fix is the one specified: a dedicated `readMP := mpool.MustNew("iscp-seed-range-read")` replaces the shared `common.DebugAllocator`, a `countAndRelease` closure cleans **both** batches in a `defer` so no exit path can skip it, and the test ends on `require.Equal(t, readBaseline, readMP.Stats().NumCurrBytes.Load())`. Measured on this head: **0** outstanding bytes after all six range reads and handle closes (was 96). Agreed that this is a test-fixture ownership issue — no production allocation path changed, and none of the 96 bytes was a production regression. ### Branch state and CI (head `7590df0d88`) The branch is a **single linear commit** on current `main` `6af999e7b8` (`HEAD~1 == 6af999e7b8 == origin/main`; `git rev-list --count HEAD..origin/main` = `0`, `git rev-list --merges --count origin/main..HEAD` = `0`), so the PR is not `BEHIND`. `main` did **not** move during this turn, so no rebase was needed and none was performed — this sync is a content change answering the second review, not a head chase. `mergeable` stayed `MERGEABLE` throughout (no conflict at any point). `mergeStateStatus` is `BLOCKED` only because `reviewDecision` is still `CHANGES_REQUESTED` from the review submitted at head `d36ea83ad5`; both of its threads are answered by this head and the two earlier threads are resolved. See the CI bullets under *Residual risk* for the infrastructure failure that fired twice on superseded heads and was then verified resolved twice. This is the twelfth sync of the same change, and only the second that changes content. Sync 5 carried the first review's scoping fix (50716 → **65124 bytes** / 1500 lines); syncs 6 through 11 were pure rebases, each verified byte-identical to its predecessor (`cmp`-clean, all six hashing to sha256 `2a9b19b37fbe1b0222ec56dddfbe88f3bbf2cb2fd4b74dda048d0780d370a919`, no conflict in any of them). **That identity chain deliberately ends here.** This sync carries the second review's durable-watermark gate and the seed-range fixture's batch ownership, so the patch is now **79123 bytes / 1863 lines** over **15** files, sha256 `31e97acb66480d99b873ebcb4f5d091009d50d9fdbb65c32f9631d8985c89bd7`. The delta from `21b43cc0c2` is **+271/−66** across exactly five files: `pkg/iscp/iteration.go` (the gate plus `GetJobSpecs`), `pkg/iscp/collect_changes_policy_test.go`, `pkg/iscp/iteration_test.go`, `pkg/vm/engine/test/change_handle_seed_range_test.go` and `pkg/vm/engine/test/change_handle_test.go`. The last two entered the file list only because the `GetJobSpecs` signature change reaches their existing call sites and `gostub` stubs. **No filtering, sinker, engine or BVT file changed**: `git diff 21b43cc0c2..HEAD -- pkg/vm/engine/disttae/ pkg/fulltext2/ pkg/vm/engine/change_handle_net_effect.go pkg/vm/engine/disttae/logtailreplay/ test/distributed/` is empty, and the BVT blob SHAs are unchanged (`.sql` `ddcc68433a6de25fe29f2d991572bb2a082b3ead`, `.result` `2d9a89425020a8783e7ed3374df1b7e8b577b493`). - **Every one of the eleven rebases was content-preserving, and each was checked rather than assumed.** Each compared its own *base..head* pair against the previous head's pair (`cmp` plus sha256, both patch files kept), which is the only sound form of the check: a two-dot diff taken across differing bases also contains the reverse of the newly gained upstream commits, so `git diff 59e2ba9c18..HEAD -- test/distributed/` looks non-empty while `git diff <base>..<head> -- test/distributed/` on each side is identical. Sync 12 has no such pair to compare — it is a real content change, audited by the file-level delta above instead. - **No conflicts occurred** in any of the eleven rebases, so no semantic resolution was needed. The three syncs in this turn gained four upstream commits, each audited separately against this PR's then-13 files (all `comm -12` intersections taken from the *same* base, since the naive `HEAD..origin/main` two-dot form also lists this PR's own files as reversed): - **Sync 9** — `d382fd5fa2` *fix: honor database qualifiers in correlated column binding (#29891)* and `f42af4dfcb` *fix(sql): unify replayable MySQL column type metadata (#29893)*: **159 files, +5111/-4153**, of which 125 are `test/distributed/cases/**` `.result` files regenerated by #29893 and 34 are sources under `pkg/sql/plan`, `pkg/container/types`, `pkg/cdc`, `pkg/tests` plus one Python client test. Zero file overlap. Symbol overlap is a single substring hit in a file this PR does not touch: `grep -E 'InitSQL|ConsumerInfo|CollectChanges|KeepTrailingDeletes|isRecoveryMode|ChangeHandle|logtailreplay|fulltext2|pkg/iscp'` over the upstream diff matches only the path and `---`/`+++` header lines of `test/distributed/cases/fulltext/fulltext2.result` (the literal word `fulltext2`), a different BVT case; `pkg/cdc/sinker_v2.go`, the nearest gained file to this PR's domain, changed 2 lines inside `cdcTargetColumnTypeMatches` and references none of those symbols. - **Sync 10** — `e6606fc542` *fix: remove lifecycle waits from embedded race fixtures (#29875)*: **58 files, +3039/-607**, all `.go`, **zero** `test/distributed` entries. Zero file overlap. The same symbol grep returns one hit, `t.Fatal("replacement reader did not reach CollectChanges")` in `pkg/tests/sqlintegration/ddl_test.go`; that is **`pkg/cdc`'s own** `CollectChanges` var (`pkg/cdc/util.go:762`), a distinct symbol in a package that does not import `pkg/iscp` (verified: no `matrixone/pkg/iscp` import anywhere in `pkg/cdc/*.go`), and the adjacent hunk in `pkg/cdc/table_change_stream.go:1443` is an unrelated local-shadow fix (`detector := s.tableDetector`). This PR's `iscp.CollectChanges` is comment-only anyway (see the `pkg/iscp/util.go` hunk: 3 added lines, all comment). - **Sync 11** — `6af999e7b8` *fix(stage): reject access to disabled stages (#29833)*: **16 files**, zero file overlap, **zero** symbol-grep hits. Its only two `test/distributed` entries are `cases/stage/remove_stage_files.{sql,result}`, not this PR's `git4data/branch/edge/` case. That is why the patch survived byte-for-byte all three times. Earlier syncs gained `a6eba2d7b5` (#29834), `e454407a1a` (#29861), `1988a97ffc` (#29831), `5f94c8f88a` (#29880), `f09d4788fd` (#29890) and sync 8's seven commits (`4e959d7dd6` #29871, `73149a3e90` #29872, `485bdf6b01` #29853, `c3d80e2310` #29855, `1f53fc85ff` #29870, `9dcd82d0a8` #29804, `61d8e2887f` #29884) since the review base `42d42546fd`, and did touch two `pkg/vm/engine/disttae` files and one `pkg/vm/engine/test` file — though not the `change_handle*.go` files this PR changes — so `disttae` and `engine/test` are re-run in full on every sync rather than assumed safe. - **Blast-radius claims re-verified on this head**, not carried over: `iscp.CollectChanges` still has exactly two callers (`pkg/iscp/iteration.go:238`, `pkg/iscp/executor.go:794`); in production code `engine.WithCollectChangesKeepTrailingDeletes` appears only at the gate `pkg/iscp/iteration.go:414` plus the two propagation points `pkg/vm/engine/disttae/change_handle.go:203` and `:600`; and `iscp.GetJobSpecs` has exactly one production caller (`pkg/iscp/iteration.go:112`) plus the seven test call/stub sites updated here. `pkg/cdc`, `pkg/publication`, `pkg/frontend/databranchutils` and `colexec/table_function/table_changes.go` keep their own wrappers. `go vet` is clean over all ten packages that import `pkg/iscp`. - **Why the rebase loop is bounded rather than open-ended.** Eleven rebases were needed because `main` kept moving while each head was in CI and in review, and the head a reviewer reads must be the head that can merge. Each got the same audit — byte-identical patch, zero file overlap, symbol-overlap grep, all six suites re-run — and each superseded run was left alone instead of rerun. This turn needed none: `main` is still `6af999e7b8` and `behind` is `0`, so the only push was the content change the review asked for. - **#29893 changes rendered column-type metadata, so its effect on this PR's BVT `.result` was checked rather than assumed.** It makes `desc` / `show columns` / `show create table` emit MySQL-replayable type text (`INT(11)`→`int`, `CHAR(10)`→`char(10)`, `DATE(0)`→`date`, `DECIMAL(10,2)`→`decimal(10,2)`, `bool`→`boolean`, `TIMESTAMP(6)`→`timestamp`) through the new `types.FormatSQLColumnType` (`pkg/container/types/sql_type.go`) and `formatColTypeForSQLMode` (`pkg/sql/plan/build_show_util.go`) — which is exactly why 125 unrelated `.result` files were regenerated. `branch_fulltext2_inherited_delete.sql` issues **no** `show create table`, `show columns`, `desc`/`describe` or `information_schema.columns` statement (its only `bool*` token is the fulltext `in boolean mode` search modifier), and #29893 changed **no** `explain` output anywhere: grepping its `test/distributed/cases/**` delta for `Table Function|explain|-> ` returns nothing. Both BVT blobs are therefore untouched and still equal the anchors `.sql` `ddcc68433a6de25fe29f2d991572bb2a082b3ead` / `.result` `2d9a89425020a8783e7ed3374df1b7e8b577b493`, so no `.result` regeneration was needed and none was done. Syncs 10 and 11 cannot affect them either: #29875 changed no `test/distributed` file at all, and #29833's only two are `cases/stage/remove_stage_files.{sql,result}`. - **Re-validated locally on the current head** `7590df0d88` (all six suites re-run after this content change, not carried over): ``` full suites (no -run filter), all ok rc=0, zero '--- FAIL': pkg/iscp 1.569s | pkg/vm/engine 0.760s | logtailreplay 2.634s disttae 8.448s | fulltext2 4.065s pkg/vm/engine/test (all of change_handle_test.go + the new seed-range test, -run subset) 58.617s new/changed tests, verbose: TestCollectChangesSeedRangeDeliversInheritedDelete PASS (0.17s) ends on require.Equal(readBaseline, readMP.Stats().NumCurrBytes) => 0 outstanding bytes on the dedicated read mpool TestSeedWindowAcrossAbandonedRunningRow PASS production encoder -> GetJobSpecs SELECT/decode -> gate watermark==From => keep=true ; watermark==To => keep=false TestCollectChangesCtxForJobs PASS (12/12 subcases) TestCollectChangesForwardsCallerPolicy PASS TestCollectChangesCtxForJobsKeepsCallerContext PASS self-checks: gofmt -l -s <changed .go files> only change_handle_test.go, whose two findings are byte-identical on origin/main (@@ -4378 / @@ -4484, pre-existing gostub continuation indentation) - left as upstream make err-check pass golangci-lint v2.14.0 (repo-pinned, rebuilt under go1.27.1) 0 issues go vet over all ten packages importing pkg/iscp clean (cagra/ivfpq plugin packages are build-tag excluded on this host and reference no changed symbol) molint (go vet -vettool=`which molint`, i.e. the Makefile static-check invocation) only its pre-existing checkrecover findings, every one outside this PR: fulltext2/storage.go:1126 and :1179 (LoadGeneration/QueryGeneration) and iscp/fulltext2_sqlwriter.go:102 (datalinkText) - neither file is in this PR's diff; iscp/iteration.go:1175 (runInitSQLTransaction) is the same recover() at origin/main:1107 shifted by this PR's +68 net lines, and every iteration.go hunk here is at :109-:907 license-eye header check 6184 files, valid 6008, invalid: 0, ignored: 176 ``` The BVT case was not re-run locally: `git diff 21b43cc0c2..HEAD -- test/distributed/` is **empty** and the blob SHAs match, so the case is byte-identical to the one that passed 32/32 locally twice and green in CI five times. CI re-runs the BVT suites on every push (see below). - **CI on `b69b054c35` (run `38114901262`): three failed jobs, one unrelated root-cause chain.** - `UT Coverage on Ubuntu/x86` (job `114397928362`) failed on exactly one test, in a package this PR does not touch: `pkg/embed TestCrossTargetUpgradeRecovery/manual-ready-steps-4.0.13`, `Received unexpected error: context deadline exceeded` at `pkg/embed/upgrade_recovery_test.go:105` (406.49s; package 718.574s; `build failures: 0`). Line 105 is a `require.NoError` on `db.ExecContext(ctx, ...)` whose `ctx` is that test's own `context.WithTimeout(t.Context(), 5*time.Minute)` created **before** the cluster starts, and the same log records the shared fixture `MO_UT_SETUP fixture=embedded-cluster cluster_id=10026 phase=service-start wait=6m38.103917279s` — the embedded-cluster admission wait alone exceeded the test's 5-minute budget, so the deadline fired before the recovery SQL ran. - `Matrixone Coverage execution / Coverage` (job `114406305513`) is purely derivative: step `Verify coverage prerequisites` got `prerequisites_ready=false` and reported `coverage merge blocked: a required producer did not publish a complete coverage profile`. - `CI Required` (job `114410946399`) is the aggregate gate: its log shows `"coverage_status": "failed"` and `Unhandled error: Error: matrixone-ut-coverage: failure`. - **Why it is not this PR:** `git diff 03c34f837b b69b054c35 -- pkg/embed` is empty; the byte-identical diff passed this exact check twice before (`38106659513`, `38112356887`); base commit `03c34f837b` (#29866) passed `UT Coverage` on its own run `38107824138` with the same `pkg/embed` content; and on run `38114901262` every check that does exercise this PR was green — `UT Test on Ubuntu/x86` SUCCESS, `SCA Test on Linux/arm64` SUCCESS, `multi cn e2e bvt test docker compose(PROXY)` SUCCESS, `multi CN e2e BVT (COMPOSE, PESSIMISTIC)` SUCCESS, shared build SUCCESS. - **Tracking:** no existing issue matches this root cause (searched `TestCrossTargetUpgradeRecovery`, `upgrade_recovery_test`, `MO_UT_SETUP embedded-cluster admission`, `UT Coverage coverage merge blocked producer`, incl. PRs; the nearest CI-load families #29124 and #27963 are closed and cover different tests), so none was created or commented, and no blocker marker was invented. - **Recovery:** head was verified current at the time (`origin/main == HEAD~1`, 0 behind), so the single allowed transient rerun was issued — `gh run rerun 38114901262 --failed` (rc=0, `attempt=2`, `UT Coverage` observed `in_progress` at 07:01:33Z). That attempt was then superseded by the rebase push described above; a later head creates a new run, and no second rerun of that run is permitted or planned. - **CI on the previous head `59e2ba9c18` (run `38122210005`) finished fully green** — `CI preflight`, shared build, `UT Test on Ubuntu/x86`, `SCA Test on Linux/arm64`, `UT Coverage on Ubuntu/x86`, `multi cn e2e bvt test docker compose(PROXY)`, `multi CN e2e BVT (COMPOSE, PESSIMISTIC)`, `Matrixone Coverage execution / Coverage` and `CI Required` all `SUCCESS`. So the `pkg/embed` coverage-chain flake documented above did **not** recur once the head was synced. No rerun was issued for that run, and none is planned for a run whose head has since changed. - **CI on head `a5a73f8e6f` (run [`38134847433`](https://github.com/matrixorigin/matrixone/actions/runs/38134847433), attempt 1) is terminal — `completed` / `failure` — and every check that exercises this PR passed.** Green on that head: `CI preflight`, `Build MatrixOne (shared)`, `pr-size-label`, `Check coverage eligibility`, `UT Test on Ubuntu/x86` (SUCCESS 12:41:25Z), `SCA Test on Linux/arm64`, `multi cn e2e bvt test docker compose(PROXY)`, `multi CN e2e BVT (COMPOSE, PESSIMISTIC)` and `Summary`. The three red jobs form one infrastructure chain documented two bullets below. That head was superseded by this rebase, so the stale run was **not** rerun (policy forbids rerunning a run whose head changed; its attempt stayed `1`), and the push of `caa62ac8ca` started run [`38141665483`](https://github.com/matrixorigin/matrixone/actions/runs/38141665483). The run started for the intermediate head `4cd18d9bb6` was likewise superseded by the newer head and never rerun. - **CI on the now-superseded head `caa62ac8ca` (run [`38141665483`](https://github.com/matrixorigin/matrixone/actions/runs/38141665483), attempt 1) hit the *same* infrastructure failure again; every check that exercises this PR was green.** `CI preflight`, `Build MatrixOne (shared)`, `pr-size-label`, `Check coverage eligibility`, `SCA Test on Linux/arm64`, `Summary` and **both BVT jobs** (`multi cn e2e bvt test docker compose(PROXY)`, `multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)`) are `SUCCESS`; That run has since terminated as `completed` / **`cancelled`** (attempt stayed 1): `UT Test on Ubuntu/x86` shows `cancelled` at 14:17:37Z only because the sync-8 force-push at 14:17:03Z superseded the head and GitHub cancelled the in-flight run, and the aggregator `CI Required` then closed `failure` at 14:17:43Z — so its three genuine reds are one coverage chain, not three causes. `UT Coverage on Ubuntu/x86` ([job 114476671613](https://github.com/matrixorigin/matrixone/actions/runs/38141665483/job/114476671613)) failed after 1m51s at the identical step `5 Checkout CI coverage helper` with the identical `gnutls_handshake() failed` / `could not fetch b1df6a61d240f46d6ad5926527ae53607e09f79c from promisor remote` / git exit 128 — same helper commit `b0f959479893a3ab54ff3d9422e135ae2e9c67b2`, same missing blob, and `8 Run coverage unit tests` again `skipped`, so no PR code ran (the `--filter=blob:none --depth=1` ref fetch itself succeeded; only the lazy blob fetch during `git checkout` failed). Its predicted derivative `Matrixone Coverage execution / Coverage` then also failed. **It is not this PR:** the same step succeeded in the same window for three other fork PRs on the same `pull_request_target` event (runs `38134778418` `c6c1cf7fd7` 11:14→11:44Z, `38135714724` `d53a7f7060` 11:29→11:58Z, `38136548424` `1600f51698` 11:43→12:11Z) and for this PR's own earlier head `59e2ba9c18` (run `38122210005`, same fork/branch/event). Both occurrences are recorded on [#27739](https://github.com/matrixorigin/matrixone/issues/27739) ([occurrence 1](https://github.com/matrixorigin/matrixone/issues/27739#issuecomment-6108518993), [occurrence 2](https://github.com/matrixorigin/matrixone/issues/27739#issuecomment-6109434538)). **Recovery:** that run was still `in_progress` (a pending run must not be rerun) *and* its head is no longer the PR head after this rebase (a run whose head changed must not be rerun), so **no rerun was issued for it** — its attempt stays 1. The rebase push starts a fresh run on `d36ea83ad5` that re-executes the coverage chain from scratch. - **The #27739 chain was verified green on two consecutive heads, `d36ea83ad5` and `5b432ef87a`.** Neither carried a byte that this head does not still carry in the affected packages — the coverage producer runs the repo's unit tests, and sync 12 changed only `pkg/iscp` and `pkg/vm/engine/test`, both re-run green locally on this head — so those two runs remain valid evidence that the checkout fault is intermittent infrastructure rather than something this PR triggers. Run [`38146548803`](https://github.com/matrixorigin/matrixone/actions/runs/38146548803) (`pull_request_target`, attempt 1) is terminal `completed` / **`success`** with **zero** failed or cancelled jobs — the first fully green run since `59e2ba9c18`. Every one of the eleven non-skipped jobs succeeded: `CI preflight` (14:17:46→14:17:55Z), `Build MatrixOne (shared)` (14:17:57→14:27:34Z), `UT Test on Ubuntu/x86` (14:18:08→15:37:41Z), `pr-size-label`, `Check coverage eligibility`, `SCA Test on Linux/arm64` (14:18:11→14:58:38Z), `UT Coverage on Ubuntu/x86` (14:18:18→14:48:20Z), `multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)` (14:27:36→15:20:16Z), `multi cn e2e bvt test docker compose(PROXY)` (14:27:37→15:08:41Z), `Matrixone Coverage execution / Coverage` (15:20:18→15:21:14Z) and `CI Required` (15:37:43→15:37:50Z). The step that had failed on both previous heads, `5 Checkout CI coverage helper`, completed `success` (job `114491203520`) and `8 Run coverage unit tests` actually executed, so the whole chain that was red twice is green end to end. **The #27739 blocker is therefore verified resolved and its entry was removed from the pinned CI-blocker marker** (`{"blockers":[]}`); no rerun produced this result — it came from the rebase push, and the run's attempt is 1. Nothing about the change under test differs from `caa62ac8ca` (byte-identical patch), which is exactly why the only variable was the runner: the fault is intermittent infrastructure, still open upstream at #27739, and nothing in this PR fixed or hid it. The sync-9 rebase to `5b432ef87a` superseded that run without changing a byte of the patch, and **run [`38155241350`](https://github.com/matrixorigin/matrixone/actions/runs/38155241350) on `5b432ef87a` then finished fully green as well** — terminal `completed`/`success`, attempt 1, all eleven non-skipped jobs `success`, including **`UT Coverage on Ubuntu/x86` (16:27:13→16:58:36Z)**, **`Coverage` (17:25:11→17:25:58Z)** and **`CI Required` (17:40:18→17:40:22Z)**. Two consecutive heads with the whole coverage chain green means the #27739 resolution no longer rests on one lucky runner. `main` then moved twice more within ~25 minutes, producing the sync-10 head `61f1f4f1bd` and the sync-11 head `21b43cc0c2`; run [`38162443582`](https://github.com/matrixorigin/matrixone/actions/runs/38162443582) was `in_progress` on `61f1f4f1bd` when sync-11 superseded it, and run [`38163240580`](https://github.com/matrixorigin/matrixone/actions/runs/38163240580) on `21b43cc0c2` was likewise still `in_progress` when this turn's content push superseded it — GitHub recorded both as `cancelled`, attempt 1, and per policy **neither was rerun** (a pending run must not be rerun, and a run whose head changed must not be rerun). The current head's run is [`38167943515`](https://github.com/matrixorigin/matrixone/actions/runs/38167943515) (created 2026-10-11T19:25:18Z, attempt 1); at the time of writing `CI preflight`, `pr-size-label`, `Check coverage eligibility` and `Build MatrixOne (shared)` are already `success` and `UT Coverage on Ubuntu/x86` is executing — i.e. it is past the `Checkout CI coverage helper` step that failed twice on the two superseded heads. **No rerun has been issued for any run in this PR's history.** - **The new BVT case really runs in CI.** `optools/run_bvt_group.sh` discovers cases with `find ... -name '*.sql'` (there is no manifest to register) and maps the `git4data` top-level directory to group 0. Job `114375708145` (`multi cn e2e bvt test docker compose(PROXY)`) logged `Run BVT group 0: 1004 scripts` with `test/distributed/cases/git4data/branch/edge/branch_fulltext2_inherited_delete.sql` in its include list, and reported `conclusion=success` with no failed step — so the case is exercised by CI, not only by a local `mo-tester` run (which passed 32/32 twice). ### Residual risk - **Scope of the option is bounded, not unconditional.** It is requested only for an `InitSQL`-seeded job generation whose durable consumption may still lag the range start — in practice the single seed range of a copied index, any retry of it, and any range a crash left selected-but-unconsumed. Steady-state maintenance of *every* index, cloned or not, keeps the default net effect, so insert-then-delete churn still cancels and **no append-only sink accumulates delete-only history**. The gate reads durable `mo_iscp_log` columns the executor already owns (`job_status` plus the `watermark` the scheduler itself reads back to pick the next `from`): no generation metadata is plumbed through `CollectChanges`, there is no per-algorithm dispatch, and no second filtering state machine. - **Residual extra tombstone, confined to the seed/retry window.** Inside that window a key both inserted and deleted emits a tombstone where it previously emitted nothing — deliberate at-least-once deletion and a no-op for every sinker (table above). For the append-only cuVS sinks it is at most one extra distinct pk in `cdc_tail` per cloned index generation, the same tradeoff already accepted for CDC restart via `isRecoveryMode`. Because it cannot grow with churn, `CuvsUpdatable` counting only inserts+upserts (`cuvs/idxcron/cuvs_updatable.go:259-260`) is no longer a reclamation gap on this path. - **A shared retry range can widen the opt-in by one range.** The seed range itself is never shared (`table_entry.go:163-174`), and an `InitSQL` job still in `JobStage_Init` is forced unshared (`:182-183`), but a seeded job's *retry* range can be shared, and one lagging member opts the whole read in for that single range. Bounded by the same retry lifetime, and the direction is at-least-once. - **A generation whose first range never commits stays opted in — by design.** Until `watermark` reaches a persisted `job_status.To`, the consumer state genuinely can predate the range start, so the retry must keep the tombstone or the bug returns. This covers three distinct paths, each of which would otherwise be silently wrong: no range selected yet (`To` empty), a range selected but abandoned before any sink work (`watermark` still at `From`, `ErrorCode` still `0` — the second review's counterexample), and a range that failed and is being retried (`ErrorCode != 0`, which stays armed even after a maintenance flush moves the column past it). The extra deletes are bounded by *that one range's* content per attempt, not by the index's lifetime. A permanent failure ends it outright (`iteration.go:976-994` sets `PermanentErrorThreshold` and flushes `ISCPJobState_Error`; `table_entry.go:148` then skips the job). A job that keeps failing *transiently* retries the same range forever under ISCP's existing at-least-once contract and re-emits its inserts on every attempt today; this change adds a delete side to that already-repeated frame. It is a stuck job that is already visible and already growing its tail, not silent growth on a healthy one. - **`GetJobSpecs` reads one extra column.** `watermark` is `VARCHAR NOT NULL` in the existing DDL (`pkg/frontend/predefined.go:307`) and is already selected by the replay snapshot, so there is no schema, migration, upgrade-entry or CDC-template change; the added cost is one more `varchar` decode per `mo_iscp_log` row per iteration, on a path that already unmarshals two JSON columns for the same rows. A row whose `watermark` is absent from the result would decode as the zero TS, which fails **towards** keeping the tombstone rather than towards dropping it. - **Forward fix only.** A branch index already corrupted before this change still holds the stale posting until it is rebuilt (`ALTER TABLE ... ALTER REINDEX ... FORCE_SYNC`) or its rows are re-deleted. No data migration or background repair is attempted. - Passing only after `REINDEX`, after cache warming, or by adding a base-table join would **not** prove the persisted index is correct — all three are explicitly excluded from the proofs above. - **Mergify may re-merge `main` into this branch.** `.github/mergify.yml` has an `Auto update branch` rule (`created-at>=00:10 ago` -> `update:`), which is what produced the earlier merge commit. If it fires again the linear history becomes a merge again. That is cosmetic, but any such update should be re-audited the way each of the eleven rebases was (diff-preservation check plus a re-run of the focused suites) rather than assumed safe, because this PR's neighbourhood is actively developed upstream: the **sixteen** commits gained since the review base `42d42546fd` landed in `pkg/bootstrap`, `pkg/catalog`, `pkg/cdc`, `pkg/cnservice`, `pkg/common/collation`, `pkg/common/runtime`, `pkg/container/types`, `pkg/embed`, `pkg/frontend`, `pkg/incrservice`, `pkg/monlp/llm`, `pkg/sql/*`, `pkg/stage/stageutil`, `pkg/taskservice`, `pkg/tnservice`, `pkg/txn/client`, `pkg/vm/message`, `pkg/vm/engine/disttae`, `pkg/vm/engine/tae/db/test` and `pkg/vm/engine/test`, two of which are packages this PR modifies (though not the `change_handle*.go` files it changes). That cadence — four commits in the ~2 hours of this turn alone — is why the audit is per-rebase and mechanical rather than a one-off judgement. - **The red chain was unrelated infrastructure, tracked at #27739; it fired twice on two superseded heads of this PR and was then verified resolved on two consecutive heads** (`d36ea83ad5` run `38146548803` and `5b432ef87a` run `38155241350`, both fully green — see the CI bullet above; the audit trail below is kept because the upstream fault is intermittent and still open). Run [`38134847433`](https://github.com/matrixorigin/matrixone/actions/runs/38134847433) at `a5a73f8e6f` (attempt 1) passed `CI preflight`, `Build MatrixOne (shared)`, `pr-size-label`, `Check coverage eligibility`, `UT Test on Ubuntu/x86`, `SCA Test on Linux/arm64`, both BVT jobs and `Summary`; `Matrixone UT Coverage execution / UT Coverage on Ubuntu/x86` ([job 114456689217](https://github.com/matrixorigin/matrixone/actions/runs/38134847433/job/114456689217)) failed in **74 seconds** at the `Checkout CI coverage helper` step, before any Go build or test command ran: ```text fatal: unable to access 'https://github.com/matrixorigin/CI/': gnutls_handshake() failed: The TLS connection was non-properly terminated. fatal: could not fetch b1df6a61d240f46d6ad5926527ae53607e09f79c from promisor remote The process '/usr/bin/git' failed with exit code 128 ``` This is a runner-side TLS transport failure while sparse-checking-out the shared `matrixorigin/CI` helper repository (`--filter=blob:none`, promisor blob fetch). It is independent of the PR diff: no test executed (`8 Run coverage unit tests` is `skipped`), no coverage profile was produced, and this PR touches no workflow or orchestration file. It is the same signature already tracked by [#27739](https://github.com/matrixorigin/matrixone/issues/27739) (*CI: UT Coverage checkout fails when fetching matrixorigin/CI promisor object*), with [#27843](https://github.com/matrixorigin/matrixone/issues/27843), [#28411](https://github.com/matrixorigin/matrixone/issues/28411) and [#28113](https://github.com/matrixorigin/matrixone/issues/28113) as related records; a reproduction record for this occurrence was added to #27739. The step that performs this checkout lives in the protected CI scope, so nothing here changes it. The other two red jobs are verified derivatives of it, not separate causes: `Matrixone Coverage execution / Coverage` ([job 114465205283](https://github.com/matrixorigin/matrixone/actions/runs/38134847433/job/114465205283)) was invoked with `prerequisites_ready: false` and exited in its first step with `coverage merge blocked: a required producer did not publish a complete coverage profile; no coverage verdict was calculated` (running `matrixorigin/CI/.github/workflows/coverage-merge.yaml@main`, no MatrixOne code), and the `CI Required` aggregator ([job 114472385247](https://github.com/matrixorigin/matrixone/actions/runs/38134847433/job/114472385247)) recorded `matrixone-ci: success`, `matrixone-compose-ci: success` and `matrixone-standalone-ci: success` next to `matrixone-ut-coverage: failure` (`coverage_ready: true`, `coverage_status: external_timeout_or_cancellation`) and `matrixone-coverage-merge: failure`, then threw `Error: matrixone-ut-coverage: failure` from `verifyResults` at `.github/ci/change-scope.cjs:90` — itself inside the protected CI scope. **Recovery, in order of policy:** the head was one upstream commit behind at occurrence 1, so that recovery was the sync-7 rebase rather than a rerun (a run whose head has changed must not be rerun). The fresh run on `caa62ac8ca` then re-executed the coverage chain and hit the **identical** failure (job `114476671613`, same helper commit, same blob `b1df6a61…`), so the head is not the variable: the patch is byte-identical to the one whose coverage job passed at `59e2ba9c18`. Occurrence 2's run was still `in_progress` when `main` moved by seven commits and the PR went `BEHIND` again, so the sync-8 rebase to `d36ea83ad5` superseded it — and a superseded run must not be rerun either, which is why **no rerun was issued for `38141665483`** (attempt stays 1) and none is planned. The rebase push starts a fresh run on the new head that re-executes the coverage chain from scratch; that new run, not a rerun, is the recovery. No test, expected result or required check is weakened to make the failure disappear, and the durable repair (retry/backoff on the promisor blob fetch, or dropping `--filter=blob:none` for this small helper checkout) is in the protected CI scope and belongs to CI owners. **This is now resolved and verified:** run `38146548803` on `d36ea83ad5` finished `completed`/`success` with `UT Coverage` -> `Coverage` -> `CI Required` all green, so the pinned CI-blocker comment was updated to a resolution record and its marker emptied (`{"blockers":[]}`) — no unresolved CI blocker remains. The upstream tracking issue #27739 stays open because the runner-side fault is intermittent and was not fixed by anything here. - **The earlier `pkg/embed` flake is fixed upstream and is in this head's base.** The only *test* failure ever seen on this change was the load-driven `pkg/embed TestCrossTargetUpgradeRecovery` context-deadline flake on the byte-identical head `b69b054c35` (admission wait 6m38s vs. that test's own 5-minute budget), which also blocked the derivative `Coverage` and `CI Required` jobs; it did **not** recur on `59e2ba9c18`, whose run finished fully green, nor on `a5a73f8e6f`, where `UT Coverage` failed for the unrelated TLS/promisor reason above without executing a single test. It was unrelated to this change and could not be fixed from it — the proper repair belonged to `pkg/embed`/CI-harness owners. **That repair has now landed upstream** as `5f94c8f88a` *fix(embed): exclude cluster startup from recovery workload budget (#29880)*, which is in this head's base: it drops `WithTestAdmissionContext` and reworks `newRecoveryClusterStarter` so cluster startup no longer consumes the recovery workload budget. If anything still recurs, the levers are a head sync with `main` or a maintainer rerun. No CI workflow/orchestration file under `.github/workflows/**` or `.github/ci/**` is modified by this PR. The `mo-tester` repository was only executed, never modified, committed or pushed. Approved by: @XuPeng-SH
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #29898 Follow-up to merged #29875 and its [remaining P1 review](#29875 (review)). ## What this PR does / why we need it: ### Preserve transaction-client dependency ownership during shutdown `New` snapshots transaction metadata under the lifecycle gate, then constructs an operator outside the gate. `Close` can complete and retire the service runtime between those steps. The operator previously looked up its logger through that runtime registry, causing a nil-pointer panic before closed-client admission could reject the transaction. Re-registering the same service ID could instead bind the old client to the replacement runtime's logger. Pass the logger already owned by the transaction client into the existing private operator constructor, matching snapshot construction. No additional lifecycle state, runtime fallback, synchronization or admission path is introduced. Close can still progress during construction and admission waits; unadmitted cleanup remains with the existing creation path. This removes a registry lookup rather than adding work. Deterministic tests cover retained, retired and replaced runtimes after metadata capture, plus real public `New` interrupted by Close before admission. They assert the original logger, `ErrClientClosed`, aborted/closed and sealed operator state, empty admission ownership and no RPC. Restoring only the old logger lookup in a compilable source overlay fails with the original nil panic and wrong-generation logger, respectively. ### Lock down the existing unsupported UNIQUE-expression contract (#29898) The report concerns v4.2.5. Current main already rejects the exact `CREATE UNIQUE INDEX ... ((LOWER(email)))` statement with `ErrNotSupported`, through the guard introduced by #29472. This PR adds precise planner and SQL regressions; it does not implement UNIQUE expression indexes or establish a v4.2.5 backport. Planner coverage asserts a nil plan and the error class, checks inline and both ALTER variants' existing rejection, and preserves successful ordinary UNIQUE creation. The SQL fixture verifies unchanged schema, rows, index metadata, generated columns and relation count after rejection; same-session recovery; and ordinary UNIQUE enforcement with unchanged rows after a duplicate insert. Existing positive functional-index coverage is retained. A weaker duplicate inline test is replaced by the typed assertion. ### Validation On Darwin arm64, Go 1.27.1, with verified CPU-release native dependencies: - Full `pkg/txn/client` and `pkg/sql/plan` UT: PASS, normal and race, `-count=1`. - Final test-only assertion refinement: focused normal/race PASS; unchanged package-wide evidence reconciled with the final diff. - Real `New` consumer: `TestLockTableLocksAllPrePipelineTargets` PASS. - Incremental configured lint, vet, formatting and diff checks: PASS. Pinned molint reports only four unchanged planner diagnostics, confirmed by a byte-identical base-source overlay log. - Exact SQL BVT: 59/59 PASS, zero failed/ignored/abnormal, normal result comparison. One bounded repeat verifies database teardown/recreation on the same owned instance: 59/59 PASS. - Old-lookup negative controls: both fail semantically as expected. - `gpt-6.1-sol / xhigh` design gates and final overall review: PASS. SQL verification used a fresh one-CN main-base binary; the SQL production guard is unchanged by this delivery. Transaction changes were validated directly through normal/race owning tests and the real consumer. Remote CI remains pending after publication. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29885
Fixes #29882
Fixes #29881
Fixes #29894
Related to #29562. The overall 600-second Linux UT racing target still needs CI measurements.
What this PR does / why we need it:
Reduce embedded UT waits through the existing lifecycle owners:
WithTestingtiming owner with a 5-second TN bind timeout and 100ms CN heartbeat cadence before scenario overrides.Close the CI failures exposed by runtime retirement and remote native-error ordering:
NewandRestartTxn; release the gate before admission waits and operator locks.MessageBoarduses one authoritative atomic closed flag, with existing mutex ownership of messages and drain state.Also close the three reported UT failures at their existing owners:
Test_CheckpointChaos2waits for actual checkpoint executor completion before checking rolled-back objects. Existing fault wait/notify barriers prove that caller cancellation alone leaves temporary objects, then verify rollback, subsequent publication and restart in the same fixture.BASHPIDwith an explicit branch. This removes the nested fallback substitution that produced Bash 5.2.21 TERM trap parser errors, while preserving the Bash 3.2 fallback. No runner/workflow change is required.Additional validation for these fixes:
/bin/bash; all selected phases pass. This is local platform validation, not a remote CI result.fresh_truncate/cancelSQL path normal/race, full DML consumer normal/race, and bounded individual regression stress. Earlier 41-file evidence is retained for its unchanged closures.Validation on Darwin arm64, Go 1.27.1, repository CGo runner, uncached normal and race modes:
61d8e2887f0; all 18 existing molint diagnostics match the previously verified baseline. Final test cleanup changes receive delta checks.Historical whole-embed race measurements compare baseline
90a822ec7b6with implementation73b325fc7ee:All four historical runs retain 116 roots / 375 outcomes (114 passing roots and two existing skips). Mean CPU decreases 8.65%, RSS 7.96% and peak footprint 26.14%; the first pair's RSS increases about 6%. These are historical local measurements, not a claim that the rebased CI-repair revision achieves the same reduction or the Linux target.
Rebased onto
61d8e2887f0; final head77f9ecad91cd6a6e4d035900682bb01d214474cf. Design and overall review use verifiedgpt-6.1-sol / xhigh; the remaining updater lifetime finding and #29894 are closed. No workflows or runner configuration are changed. Required CI for the updated head remains pending.