Repository navigation
fix(logservice): bound stalled RPCs and stale HAKeeper startup - #32147
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? |
|
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: 67956b338b7639f1fd4edda6ed7781f5ccfac9b1
Assessment: request_changes
The production fixes coherently reuse MORPC read windows, generation-scoped endpoint reset and bounded membership checks. The new proxy fixture has a teardown race that can hang its tests.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
- P2
pkg/logservice/client_test.go:526: Cleanup runs after Accept returns but before the outbound DialTimeout finishes and registers its connections.
Impact: The late sockets miss cleanup's close snapshot. Client EOF ends only the forwarding goroutine; serverConn.Read can remain blocked, so wg.Wait depends on the remote peer closing. The enclosing service cleanup runs after this callback returns. Seal connection registration during shutdown and close late dial results, or join the accept/dial producer before draining connections; add this interleaving to the fixture test.
Evidence: Connections are registered at lines494-495 after DialTimeout, while cleanup drains the map before joining. A phase-controlled probe of the exact helper passes the already-tracked control and fails the pending-dial case; closing the missed target then releases teardown. See proxy-inputs.json and proxy-test-resume.log.
Validation:
-
Read the complete six-file delta, all discussion and linked issue context, and transport/WAL/heartbeat/bootstrap consumers. Both discussion keys are assessed.
-
Isolation preflight passed. Exact-helper probe: one passing control and one deterministic cleanup counterexample. All six changed Go files parse and pass gofmt.
-
Head-matched CI metadata reports successful UT/SCA/BVT/coverage; the author reports focused, owning-package, race and dependent-driver passes. Local receipts and retained logs are correlated in execution-ledger.json.
Limitations:
-
Local product tests did not compile: required Go1.27.1 bootstrap timed out, and native prerequisites are absent. No local product or race pass is claimed.
-
The reduced probe tests the proxy helper with injected phases, not a LogService cluster. Raw author/CI logs were unavailable; the three-voter chaos scenarios were not rerun.
|
Addressed the requested proxy teardown fix in b55d6e0. Cleanup now seals connection registration under the same mutex used by the accept loop and closes already tracked sockets; a dial that returns after shutdown closes both of its sockets without starting a forwarding goroutine. A channel-controlled regression test covers that exact late-dial interleaving. Validation passed: the focused regression test, race-mode focused tests including the blackholed Append case, and the complete |
|
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: b55d6e0c743822b640b9a17b8e9d9caca4cdee6d
Assessment: approve
The prior proxy teardown hang is resolved by sealing registration and closing late sockets before joining. Production fixes coherently reuse existing read-window, generation-reset and membership-check owners; no actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Completed the six-file and linked-issue/discussion review. The only delta from reviewed head 67956b3 is client_test.go; unchanged production/consumer coverage is reused. Closure reasoning is retained in closure-review.md.
-
The exact-helper/current-regression probe passed normally, once with race detection and through 100 race repetitions. T=0 at JSON timer resolution, B=30s, N=100. Receipts: checks/1793789692725889336-2.json, 1793789779562680191-2.json and 1793789850016565493-2.json; logs: proxy-normal.log, proxy-race-once.log and proxy-race-stress.log. proxy-inputs.json binds the extracted functions to the frozen source.
-
Read-only scope, patch, gofmt/parser, input/result and five-key discussion audit passed: checks/1793790100663564897-2.json; scope-audit.log.
-
Frozen exact-head CI reports 13 successful, 14 skipped and two neutral checks, including UT/SCA/coverage and compose successes. Current author-reported focused regression, blackholed-Append race and complete owning-package passes are reused within their stated scope.
Limitations:
-
The standalone fixture probe used Go1.26.6 and an equivalent require.NoError adapter; no full Go1.27.1 LogService or dependent-driver suite was independently rerun. Raw author/CI logs were unavailable.
-
The three-voter chaos scenarios were not rerun. Randomized endpoint rediscovery still provides no strict 30-second worst-case recovery guarantee, as disclosed in the PR.
❌ Left the queue · checks failed1 h 30 min in the queue, with no time running CI. So far
The failure is in this pull request. It failed tested alone on top of Reason The merge conditions cannot be satisfied due to failing checks
To get back in the queue
Merge conditions not met when it left the queue
Requeue requested — the merge queue status continues in this comment ↓. 2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
🚫 Left the queue · pull request dequeued2 h 13 min in the queue, with no time running CI. So far
Reason Pull request #32147 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
To get back in the queue
Merge conditions not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
…HAKeeper restart (#32149) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes #32148 Fixes #32144 Fixes #32159 Fixes #32151 Fixes #32161 Fixes #32235 Related to #32133 ## What this PR does / why we need it: - Give each LogService `Read` attempt a seven-second child deadline. If an established data connection stops answering after the request is sent, reset that connection and retry the same LSN while the caller context remains live. Read can be repeated safely; writes retain their existing unknown-result behavior. Connection failures from MORPC also take this retry path, so this works alongside #32147's shared backend read window. - Bound each `GetTruncatedLsn` attempt to seven seconds. A stalled read resets its LogService connection and retries while the caller is live; the WAL driver now keeps one overall replay deadline and cancels retry backoff promptly. This lets `ReplayForWrite` try another available replica when its first truncate-watermark read stalls. `Append` and `Truncate` write semantics are unchanged. - During service restart, before starting each retained data replica, remove only canonical exported snapshot final directories that still contain Dragonboat's completion flag. A crash between final-directory rename and flag removal no longer leaves an untracked directory that blocks export at the same index. Valid exports and temporary directories remain available; filesystem cleanup errors fail startup visibly. - When an exported snapshot finishes after its request times out, mark that replica for later disk reconciliation. Each truncation tick discovers complete final directories, includes them in import and quota decisions, and removes excess newest snapshots while keeping the oldest import candidate. Incomplete directories and I/O errors remain retryable; unaffected replicas do not scan. - Reject a `Truncate` target at or beyond the Raft index of the truncate command when the state machine applies it. The persisted watermark cannot advance past entries already committed, so later acknowledged appends remain readable. The API keeps the `ErrInvalidTruncateLsn` error class. - On ordinary HAKeeper cold restart, select the highest locally persisted replica ID that the peer membership check has not rejected. HAKeeper allocates replacement IDs monotonically; older local records are skipped so Dragonboat starts only one replica for shard 0. If a replacement is running, bootstrap does not replay the configured initial ID, even when its metadata record was removed. - Add regressions for an established connection that stops answering, interrupted snapshot export, future truncate followed by append/read, a full three-voter cold restart with historical HAKeeper metadata, and an accepted snapshot request that times out before its final directory appears. ### Validation - Native `make -j4 cgo`: passed on each original branch; native inputs are unchanged in the combined branch. - Focused regressions for all four issues and complete `pkg/logservice` plus `pkg/common/moerr` packages: passed on the combined branch. - Focused race repetitions and complete `pkg/logservice` race package for the original Read/snapshot changes: passed on the original #32149 head. The combined branch preserves those code paths. - `go vet` for LogService and its WAL driver passed on the original #32149 head. The combined branch includes a separate `go vet` result for LogService and `moerr`. - For #32161, the real Dragonboat post-admission timeout regression, late-completion/quota and scanner-error controls, complete `pkg/logservice` normal and race packages, focused race repetitions, and `go vet ./pkg/logservice` passed on that head. - For #32235, a real LogService client with an established response-dropping connection recovered the expected truncate watermark through a healthy address. A short caller deadline stopped the blackholed request. `ReplayForWrite` retried a transient watermark error, and cancellation stopped the driver after one attempt. Complete `pkg/logservice` and WAL-driver packages passed in normal and race modes; focused race repetitions passed (client 3, replay 20, cancellation 20); `go vet` passed for both packages. - Temporary overlay of #32147's shared eight-second MORPC backend read window, followed by the focused Read regression: passed on the original #32149 head; the overlay was removed afterward. - On head `790bca9921`, upstream/main through `65b721e1b9` supplies #32147. The focused prior CI failures passed locally; the LIKE index case passed three consecutive runs after its deterministic test correction. Complete `pkg/logservice` and WAL-driver package tests, build, and vet passed against the MatrixOrigin Dragonboat dependency. The new MatrixOne CI is pending. ### Relationship and limits The merged upstream/main includes #32147, which bounds the underlying data connection's read window for all operations. This PR adds `Read` and `GetTruncatedLsn` retry semantics without duplicating that patch. The child deadline is not a hard bound on every possible blocked send path inside MORPC; the reproduced failures stall after a small request is sent. A healthy `Read` or `GetTruncatedLsn` lasting more than seven seconds can be retried. Reconnect still uses existing randomized endpoint selection, so a single failed attempt does not guarantee a healthy endpoint on the next pick. The regressions use a single server behind a response-dropping proxy; the three-voter network-namespace chaos scenarios for `Read` and WAL replay have not been rerun on this branch. The pending-proposal transport fix for #32133 is in [matrixorigin/dragonboat#20](matrixorigin/dragonboat#20), which is still open and is not included in this PR. This PR uses the existing MatrixOrigin Dragonboat version. The three-voter network-namespace failure scenario has not been rerun, so #32133 is not claimed fully resolved. The WAL driver's `clientPool.Get()` remains context-unaware when the pool is empty, outside #32235's reproduced case with available pooled clients. Crash-marker cleanup remains a startup path; late valid exports are reconciled while the process runs on later truncation ticks. An affected replica continues to scan after an ambiguous request because the completion can arrive after any scan; disk quota can be exceeded transiently before the next tick. When no peer can answer during HAKeeper cold restart, the choice among locally persisted replicas relies on monotonic replica IDs. The new three-voter regression verifies that this restores quorum with the issue's duplicate-metadata shape. The installed local `golangci-lint` was built with Go 1.26 and cannot lint this Go 1.27.1 repository; CI will run the configured lint check. Approved-by: XuPeng-SH <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32133
Fixes #32134
Fixes #32135
What this PR does / why we need it:
Sendor an explicit cancellation leaves the shared generation intact. The next heartbeat performs normal endpoint discovery.L/Killhas already removed it from local metadata. Probe it before stored data shards, without persisting the synthetic candidate. A cold bootstrap without an authoritative membership reply still starts.Validation
make -j4 cgo(matching native artifacts): passed.mo-cgo-test -count=1 -timeout=240s ./pkg/logservice: passed.mo-cgo-test -race -count=1 -timeout=240s ./pkg/logservice: passed.GOWORK=off go buildandgo vetforpkg/logserviceandpkg/vm/engine/tae/logstore/driver/logservicedriver: passed.mo-cgo-test -count=1 -timeout=120s ./pkg/vm/engine/tae/logstore/driver/logservicedriver: passed.The extra work is limited to MORPC's existing read-window tracking on data connections and one startup membership candidate for bootstrap-configured stores. The startup check remains best effort when no peer gives an authoritative membership reply. HAKeeper reconnect still shuffles endpoints, so this change does not claim a strict 30-second worst-case recovery if each new attempt first selects an isolated address. The three-voter network-namespace chaos scenarios from the issues have not been rerun on this branch; CI is pending.