Repository navigation
test: add regression guard for pipeline terminal loss under lock wait backpressure - #30369
Conversation
… backpressure Regression UT for issue matrixorigin#24971: on a single embedded CN, a REPLACE INTO ... SELECT plan with a merge/connector edge above Lock must recover correctly when its consumer side is blocked on a row lock held by another session. After the blocking lock is released, the query must finish successfully with all rows written and all locks released, and a later statement on the same key must not be blocked. Shortens the terminal-signal send timeout in-test (same pattern as compile/remoterun_test.go and colexec/connector/types_test.go) so the whole case runs in ~17s.
…verride - Move the test to pkg/tests/issues/isolated and start the cluster via embed.StartTestCluster so it goes through cluster admission instead of bypassing it with a bare NewCluster. - Drop the PipelineSignalSendTimeout override: production code no longer reads it; the hold window is now a backpressure scenario parameter that also asserts the lock wait stays live for the whole window. - Document the layering: the channel-full terminal contract is guarded by the component-level tests in pkg/sql/colexec/connector; this test guards the end-to-end recovery outcome.
|
As a follow-up to the review point on terminal-phase coverage: below is the failure contrast of the same SQL-level scenario on the unfixed version, run locally before this PR was written. It shows the guarded failure mode is real at the SQL level on the old protocol, and that the new UT fails exactly there if the behavior regresses (B never finishes after the blocking lock is released). Setup: same shape as the UT in this PR — single embedded CN, synthetic Observed on v4.1.2 (times relative to B starting):
On current main (and on v4.2.0, the first release containing #25273), the identical scenario produces no cleanup warnings at all: the producer is parked in the data phase ( So the layering is: the channel-full terminal contract (durable End, receiver-side synthesis, spool abort) is guarded by the component-level tests in |
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? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 488168a3adfac20ae6dc246f30dbc7247646f99f
Assessment: request_changes
Reviewed the complete test-only delta and its cluster, lock, pipeline, and cleanup owners. Reusing existing owners is reasonable, but the committed scenario does not match the documented terminal-loss trigger. No production runtime paths change.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
pkg/tests/issues/isolated/issue_24971_test.go:120: Validation requirement: the delayed scenario releases A after 8 seconds, whereas the supplied unfixed-version reproduction requires two successive 30-second terminal-cleanup timeouts before releasing A.
Impact: The supplied negative control does not establish that this regression guard detects the original failure. It instead documents that early release succeeds on the unfixed protocol. Use controlled timeout or phase injection and demonstrate fail-before/pass-after with the exact committed scenario.
Evidence: Author comment 6210225557 reports terminal enqueue timeout at approximately 30s, direct-signal timeout at approximately 60s, and successful completion when A is released before those timeouts. The test uses hold windows of 0s and 8s without shortening cleanup timeouts; process_spoolr.go retains PipelineSignalSendTimeout = 30*time.Second. The comment at lines 161–162 claiming the hold exceeds terminal-send timeouts is therefore unsupported.
Validation:
-
Frozen head and clean source verified; all 368 added lines and surrounding owners reviewed. git diff --check and gofmt passed.
-
Artifacts retained under /home/xupeng/.local/state/mo-bot/jobs/94a9669606dfb4d587c4494e/attempt-1. Reconciled preflight.log with checks/1792146538010608401-4.json and review-static.log with checks/1792146658296743595-4.json; both exited 0 with the assigned source fingerprint.
-
Native recovery verified the retained provider's provenance and matching native source trees. Current-revision preparation through make cgo timed out during Go 1.27.1 download after repeated TLS failures: native-build.log and checks/1792146853030574953-4.json, exit 124.
-
Frozen evidence records successful Ubuntu UT and Linux SCA checks. local_validation is empty; no retained author execution receipts establish the exact negative-control scenario.
Limitations:
-
No local Go tests executed because toolchain bootstrap failed. This is an environment limitation, not a product-test failure or the reason for requesting changes.
-
The historical failure was assessed from the supplied reproduction narrative, not independently rerun. Exact-scenario regression discrimination remains required.
-
The added cluster and 8-second hold increase test cost; the author's approximately 13-second runtime was not independently measured.
The delayed sub-case released the blocking lock after 8s, which on the unfixed protocol is just the already-green early control: terminal End loss requires two successive cleanup timeouts (spool enqueue ~30s, then direct signal ~30s). Hold the backpressure for 2*process.PipelineSignalSendTimeout plus margin, so a regression back to losing the terminal signal is caught by query B never finishing. Fail-before/pass-after verified with the exact committed scenario: - PASS on main (75s): B finishes, all rows written, locks cleared, later statement unblocked. - FAIL on v4.1.2 (pre-matrixorigin#25273): after the two 30s cleanup timeouts, B holds the row locks and never returns until killed. Also relax the MySQL readTimeout so a client-side connection timeout cannot mask the server-side hang during negative checks.
…ixone into issue-24971-regression-main
|
@XuPeng-SH Addressed the P2 in Fail-before / pass-after with the exact committed scenario (same test, same shape, only the cluster bootstrap differs because v4.1.2 has no
On the v4.1.2 run the two 30s cleanup warnings appear inside the hold window ( One fix applied during negative-checking: the original run failed early with a client-side |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes on 88a31fd01aee3de1bc7add1a6134b65c21822e3d (base ac9dbfeeec2caba32f06c998cb0132d416d72000). Reviewed all 376 added lines and the existing cluster-admission, connector/spool, receiver, lock-observation, and test teardown owners. Production code and docs have no delta.
The earlier 8-second negative-control finding has been substantively addressed: the new comment supplies an exact-scenario old-protocol failure/current-head pass, and the committed hold now exceeds both 30-second cleanup timeouts. I am not repeating that old finding. The remaining blocker is the resulting ordinary-UT cost/control design.
[P2] Replace the production-duration hold with a controlled regression trigger.
delayedWindow := 2*process.PipelineSignalSendTimeout + 10*time.Second makes every successful normal UT spend at least 70 seconds holding an admitted embedded cluster, with repeated lock-table scans. Independent current-head measurement: immediate control 0.20s, delayed control 70.15s, root 74.81s (package 76.635s, excluding compilation). This is a deterministic increase to each default UT/coverage/race invocation, not build time or admission contention. A longer hold only observes that B remains a lock waiter; it still does not establish a producer-side terminal/backpressure phase.
The repository already owns configurable cleanup timeouts (pkg/vm/process/process_spoolr.go) and deterministic full-channel End/receiver/spool tests (pkg/sql/colexec/connector/types_test.go, including tests that scope PipelineSignalSendTimeout to 10ms). Please use a safely scoped timeout/phase control for this isolated SQL scenario, with restoration after cluster shutdown, or retain a small SQL recovery case and put real-duration qualification in the appropriate slow/stability suite. Preserve the exact fail-before/pass-after distinction after changing the control; merely reverting to the old 8-second sleep would not fix it. Record the minimum batch/cardinality requirement and measured fixture cost. The 70-second production timeout is not itself the SQL correctness contract.
Validation: verified native build passed; exact committed test passed normally and under -race -count=1 with both subcases selected. Race package elapsed 107.955s; no race reported. Since this one race run already exceeds the 30s adaptive repetition budget, N=1. CI Ubuntu UT/Linux SCA are also green. No old-binary reproduction was independently rerun; the author-supplied negative control remains attributed as such.
Other closure checks: query-result publication is synchronized by closing done; fixture admission and cluster Close remain with embed; SQL/lock/follower success oracles are useful; no production performance change. Cleanup kill-query/kill-connection paths and connection/defer ordering were traced. These successes do not remove the avoidable default-suite waiting cost.
Scope process.PipelineSignalSendTimeout to 2s before the cluster starts and restore it after cluster shutdown via cleanup ordering, following the connector/edge tests that scope the same variable. The override is inert on the current protocol (production no longer reads it), but a regression back to the old read-it-and-drop-it cleanup path honors the scoped value, so the End loss lands inside the 6s hold window and the guard fails fast instead of paying 2x30s per successful run. Fail-before/pass-after re-verified with the exact committed control: - main: PASS 12.24s normal, 13.33s under -race (was 75s/108s). - v4.1.2 (pre-matrixorigin#25273): FAIL with the guarded assertion; both cleanup warnings show timeout=2s inside the hold window. Also record the observed working cardinality (16,384 rows) and the measured fixture cost in the test comments.
|
@XuPeng-SH Addressed the P2 in
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approve 4eccd37. No remaining blocking findings after reviewing the complete 398-line test, its SQL/lock/pipeline owners, and all prior review comments.
The earlier findings are substantively addressed: the delayed case now uses a 2s cleanup-timeout scope and a 6s hold, with author-reported exact-control fail-before/pass-after evidence. I checked that the historical connector really reads the scoped variable for both cleanup sends. The override is installed before cluster startup and restored after cluster Close via LIFO cleanup; this package has no parallel tests, and current production code does not read that variable. The 70s ordinary-UT cost is gone.
The test reuses embed admission, real SQL connections and lock-service observation. Its SQL recovery/completeness/lock-release/follower oracles complement the existing deterministic full-channel terminal tests without adding a production state machine. Increment: production 0, tests +398, separate documentation 0.
Independent local validation on the exact head, darwin/arm64, Go 1.27.1, GOMAXPROCS=4, through mo-cgo-test:
- Named normal regression PASS: root 11.77s; immediate 0.11s, delayed 6.13s.
- Named race measurement PASS: root 11.71s. Adaptive N=floor(30/11.71)=2; same-process -race -count=2 PASS, roots 11.84s and 11.67s. Both subcases ran each time; no race report.
- Cluster admission and port leases released after every run; source tree clean; diff-check and gofmt passed. Current-head Ubuntu UT and Linux SCA checks are successful.
The historical failing binary was not independently rerun in this review; that negative control is attributed to the author's linked results. Coverage here is the single-CN SQL recovery scenario, with protocol-specific failure coverage owned by the existing component tests. No production performance path changes.
Merge Queue Status
This pull request spent 54 minutes 23 seconds in the queue, including 53 minutes 53 seconds running CI. Required conditions to merge
|
|
独立合并后功能验证完成,未用合并/CI 状态代替执行。 main
4.2-dev
命令:仓库 限制:当前协议中 hold 窗口证明 SQL data-phase backpressure 与恢复结果,不声称在此时观察到了 terminal send;channel-full terminal 契约由上述组件测试分别证明。本轮没有重建 v4.1.2/pre-#25273 作为 fail-before 负对照,没有扩大为全拓扑/全仓库/GPU 验证。#24971 当前已关闭,按已处理保留状态,不重复转测。 |
What type of PR is this?
Which issue(s) this PR fixes:
issue #24971
What this PR does / why we need it:
Adds an end-to-end regression UT that locks in the recovery behavior fixed for the pipeline terminal protocol (#25273 and its follow-ups).
Background: on the pre-#25273 protocol (e.g. v4.1.2), a DML pipeline whose consumer side was blocked on a row lock could lose its terminal (End) notification during cleanup backpressure. Once the blocking lock was released, the query stayed stuck in
PipelineSignalReceiverwhile still holding its acquired row locks, so later writers on the same keys queued behind it until the session was killed. This amplified lock chains and memory buildup in production.The test lives in
pkg/tests/issues/isolatedand starts its cluster viaembed.StartTestCluster, so it goes through cluster admission instead of bypassing it. On a single embedded CN it builds the vulnerable shape: aREPLACE INTO ... SELECTwhose plan has a merge/connector edge (Sink Scan) above Lock. Session A holds a row lock; session B runs the REPLACE; after a backpressure window in which B is asserted to still be in the lock wait, A rolls back. Assertions:Layering note: the channel-full terminal contract itself (End recorded as durable edge state, receiver synthesizes an End that did not fit, spool abort on undeliverable terminals) is guarded by the component-level tests in
pkg/sql/colexec/connector/types_test.go, notablyTestConnectorResetRecordsEndWhenDataChannelIsFull,TestConnectorResetDurableEndWakesReceiverAfterBufferedData, andTestConnectorResetAbortsSpoolWhenTerminalSignalCannotBeDelivered. From SQL there is no observable terminal-send barrier: on the current protocol the producer is parked in the data phase (WaitPipelineSignalCapacity) while the consumer waits on the lock, so no terminal send occurs during the hold window by design. This test therefore guards the end-to-end recovery outcome, and intentionally does not assert the absence of cleanup warnings (the abort fallback is also a valid outcome).Tests you have done (required):
go test -v -count=1 -run ^TestIssue24971LockWaitBackpressureRecovery ./pkg/tests/issues/isolated— PASS (~13s)go vet ./pkg/tests/issues/isolated— pass