Repository navigation
fix: eliminate reconnect and checkpoint timeout flakes - #26011
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
BLOCKING deep-review result: one lifecycle issue must be fixed before this PR leaves draft. I verified the final merge resolution, stream lock ordering and generation isolation, backend terminal-state closure, inactive-pool compaction, and the stronger backup checkpoint postcondition. The morpc package, focused lifecycle tests under race (-count=5), affected backup tests, and go vet all pass, but the operation deadline can still be lost while retiring a closed backend. GitHub does not permit the PR author account to submit REQUEST_CHANGES on its own PR, so this is filed as a blocking COMMENT review.
78688c0 to
227977e
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 227977ec4e0a72b91a24ff9f0a4172833b3808c9: no blocking findings.
I revalidated the previous P1 and the subsequent lifecycle hardening end to end:
Send,Ping, andNewStreamdetach only the exact failed backend and never wait forBackend.Closeon the foreground RPC path. Cleanup ownership is transferred before pool capacity is released, is capped at 64 per client, and saturation keeps terminal backends consuming capacity instead of allowing unbounded goroutine/backend churn.Client.Closeseals create/cleanup admission, invalidates queued generations, snapshots the pool, and joins retired cleanup, targeted reset, and admitted factory I/O. Backend generation identity prevents stale publication/ABA, and compacted slice tails are cleared.remoteBackend.Closehas a terminal admission seal plus a completion barrier, concurrent callers join physical teardown, write-queue waiters observe shutdown, active streams terminate before transport teardown, and stopped backends cannot be reactivated.- Stream terminal/close paths reject late send/receive/delivery, publish exactly one usable terminal notification to a previously acquired receive channel, and avoid the
rb.mu/s.muinverse lock order. - The backup tests now wait on the real
ForceCheckpoint(ctx, target)postcondition and assert the resulting ICKP coverstarget; they no longer depend on a weaker fixed-delay idle poll.
Validation on this exact head:
- focused lifecycle/concurrency tests:
go test -race -count=20 ./pkg/common/morpc -run <19 changed lifecycle tests> - full package:
go test -race ./pkg/common/morpc - backup protection tests:
go test -count=3 ./pkg/backup -run 'TestBackupProtection(...)' - backup protection race run:
go test -race ./pkg/backup -run 'TestBackupProtection(...)' go vet ./pkg/common/morpc ./pkg/backup
All passed. The remaining no-context nature of BackendFactory.Create/Backend.Close means an explicit total Client.Close can still wait on a stuck implementation; that is the existing synchronous destruction contract, while the operation path is now bounded and non-blocking with respect to cleanup.
GitHub does not allow the PR author account to approve its own PR, so this formal COMMENT review records a code-review pass rather than APPROVE.
|
@LeftHandCold please help to review |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No actionable regressions found. The prior blocking teardown-latency finding is fixed, lifecycle closure is consistent across retirement, creation, reset, concurrent close, and stream termination, and checkpoint tests now assert the required coverage postcondition. Current-head CI is green.
LeftHandCold
left a comment
There was a problem hiding this comment.
Deep review completed on exact head 50d404c. No blocking findings.
I traced the MORPC backend/client/stream lifecycle end to end: exact-backend retirement, bounded asynchronous cleanup ownership, concurrent Client.Close and targeted reset, in-flight factory generation admission, remoteBackend teardown joining, stream terminal delivery and lock ordering, write-queue shutdown, activity-state publication, and slice-tail reference release. The cleanup/wait/growth invariants are closed without changing the healthy backend selection behavior. I also verified the backup test change waits for the actual ForceCheckpoint coverage postcondition and does not alter production checkpoint/WAL/GC ordering.
Fresh validation on this head passed: focused MORPC lifecycle tests under -race -count=10; full pkg/common/morpc under -race; full pkg/backup under -race; backup protection tests -count=3; TestSpeedupAbortAllTxn under -race; go vet for MORPC, backup, and issue tests; go build for MORPC and backup; git diff --check.
|
Tick the box to add this pull request to the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #26008
Fixes #25997
What this PR does / why we need it:
TestSpeedupAbortAllTxnexposed a MORPC lifecycle failure, not merely a slow test. A closed backend could remain counted againstmaxBackendsPerHost, reconnect could keep selecting terminal capacity, failed locked stream creation could leak the backend lock, andStream.Close/backend shutdown did not give an already-blocked receiver a reliable terminal event. Cleanup was then made asynchronous, but a deeper review found that concurrentClosecallers, targeted reset, and in-flight factory creation were not all part of the same completion boundary.This PR makes the lifecycle explicit and joinable:
NewStreamreturns lock ownership to the client;remoteBackend.Closedistinguishes sealed admission (stateStopped) from completed physical teardown (closeDone), so every concurrent caller joins the same owner;Stream.Closemodes publish anilterminal to an existing receiver;The backup protection failures had a separate test-contract bug. They used a five-second force-checkpoint helper and then polled runner/WAL idleness, which is neither the required checkpoint-coverage postcondition nor a stable ordering guarantee under CI contention. The tests now call the context-aware
ForceCheckpointwith a bounded 30-second deadline and assert that the completed incremental checkpoint covers the requested timestamp.Review decisions
closeConncontrols only whether the shared transport is also closed; local stream closure always terminates an already-obtained receive channel.activeStreamsunder the backend mutex and enters stream state only after releasing it, preserving the lock order used by unregister.CloseBackendForremains responsive to unrelated in-flight factory I/O, but its own detached teardown is registered so a concurrent total client Close can join it.Validation on latest
main(e6f5587c):-race -count=100pkg/common/morpc:-race -count=1pkg/txn/rpc:-race -count=1TestSpeedupAbortAllTxn:-race -count=1on the final tree (and-count=5before the final lifecycle extension)pkg/backup:-race -count=1-count=10TestSnapshotMeta:-count=50go buildfor MORPC and backupgo vetfor MORPC, backup, and issue testsgit diff --check