Skip to content

[4.2-dev] fix(hakeeper): keep stores alive during replica recovery - #33009

Merged
XuPeng-SH merged 16 commits into
4.2-devfrom
fix/4.2-hakeeper-recovery
Nov 25, 2026
Merged

XuPeng-SH merged 16 commits into
4.2-devfrom
fix/4.2-hakeeper-recovery

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #33008

What this PR does / why we need it:

An expired LogStore and incomplete replica reports could make HAKeeper repeatedly stop surviving LogStores and TNs. Remove global teardown scheduling and ignore historical shutdown commands while continuing to execute their siblings.

Require a reporting majority of configured voters to schedule or retry membership changes. A returning store with an empty report cannot satisfy this requirement. Recovery Starts remain eligible. The checker starts identities from the retained set when it proposes removals, and the existing operator controller prevents a Start for the exact identity and epoch of a removal still in flight.

Recover an orphaned Dragonboat bootstrap only after confirming its current replica identity. HAKeeper binds ordinary Start replies to its known membership using the existing epoch field. The outgoing confirmation is transient. The startup membership probe also checks retained bootstraps that have lost their LogStore metadata. The command handler respects a newer local membership observation. Data-replica startup and cleanup share the existing store mutex so a pending local replica retains its metadata and exported snapshots.

During initial LogService bootstrap, HAKeeper can redeliver the retained Start after a crash between the native bootstrap write and the MatrixOne metadata write. A matching prefix of the original ordered AddNode entries does not exclude voters that have not appeared yet. Once membership is complete, the ordinary current-member check applies. The receiver checks the original recipient and passes the complete initial-members map to Dragonboat for native validation.

During HAKeeper startup, a retained Dragonboat bootstrap with missing MatrixOne metadata can reopen the configured initial voter when all observed absences are exact prefixes of the original ordered voter list. A later observed removal still blocks the reopen, and scheduled Starts retain the existing absence epoch. This addresses the current orphan-bootstrap review. The related case with local metadata already present is tracked in #32919.

Reject effective writes while TN reports no shard. Preserve the existing persisted formats. Membership safety when the available majority changes during reconfiguration is tracked by #33062 and #33067.

Validation

  • A real disk-backed three-voter HAKeeper test passed on the 4.2-dev base, failed before the fix, and passed on the candidate. It restored quorum from the original Dragonboat files after one voter was stopped. A committed removal control kept the retired voter stopped despite another stale prefix reply. Peer responses were injected at the membership RPC boundary. The fixture uses private Unix RPC sockets, waits for mutual discovery before starting voters, and verifies the surviving quorum before issuing the removal request. The updated fixture passed three focused race repetitions constrained to one CPU, and the full LogService race suite passed.

  • The candidate replayed the official v4.2.9 Raft snapshot and tail, ignored the legacy shutdown, executed the sibling Start, and committed a log write.

  • A real disk-backed v4.2.9 HAKeeper on release source 6c05e42 persisted a pending ShutdownStore and sibling Start in Raft snapshot index 3, then committed a tick in the Raft log. The candidate loaded a fresh copy after full stop, recovered that tick, delivered the ordered mixed batch over the heartbeat RPC, ignored the shutdown, executed its sibling and committed a log write.

  • Real three-voter cluster with a registered spare. After permanent voter loss and a 12-second test-only expiration setting, Raft applied removal and addition. The new HAKeeper voter reported after 22.3 seconds. SQL committed and read back a second row.

  • Full-stop restart from copied official v4.2.9 cluster data recovered all six replicas and passed old-row reads and new SQL writes.

  • Regression cases cover a retired bootstrap across Kill and a second NodeHost restart, a configured HAKeeper orphan restarting after quorum falls, current-role confirmation, a returning store with an empty report, unrelated shard recovery, and existing membership operator ownership.

  • Full owning-package race validation and focused normal-mode regressions passed. The retired-voter scenario passed 9 focused race repetitions and non-voter disk reopen passed 69. Incremental go vet, molint, and golangci-lint passed.

  • Real disk-backed reproduction of the initial bootstrap crash window. The previous head refused the retained epoch-zero Start. The candidate rejects conflicting or ordinary orphan Starts, reopens the authorized native bootstrap, persists the missing metadata, commits a data-shard log write, and acknowledges the retained command. Three-voter prefix and removal controls verify the same delivery policy. The final disk test passed 39 focused race repetitions. The owning packages, focused normal tests and incremental static checks all passed.

  • Mixed-version rolling upgrade and the original 4.1.4 incident dataset were outside these probes. The receiver relies on its reconstructed startup observation and HAKeeper's committed membership. If every source still has an older view, it cannot infer an unseen Raft removal.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

@mergify

mergify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Recommendation: REQUEST CHANGES on cbf28df. This is my own PR, so GitHub permits a comment rather than a formal request-changes review.

I repeated the coordinator probes and the real Raft command-handler check against this exact 4.2-dev head with Go 1.26.4. Both recovery and cross-shard isolation problems found in #33010 also occur here. The legacy command-delivery implementation in this branch removes filtered shutdown commands from its queue on heartbeat, so the separate acknowledged-delivery retention issue on main does not apply here. There are no previous substantive review comments on this PR.

The old syshealth.Healthy policy also remains solely for the test-cluster helper and differs from the production repair policy; consider retiring it or documenting its narrower test meaning.

@XuPeng-SH

XuPeng-SH commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: cbf28dfa3af7f84860d5f0d9c52c798b56a0fe9e

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: cbf28dfa3af7f84860d5f0d9c52c798b56a0fe9e

Assessment: request_changes

Removing global shutdown and reusing the per-shard checker is the right recovery model. Two paths still break that model. Voting removals can be routed to expired stores despite a reporting majority, and non-voting membership commands can delay independent shard starts. The 4.2-dev heartbeat path removes legacy shutdown commands from the queue. The remaining syshealth predicate serves the test-cluster helper.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

  • P1 pkg/hakeeper/checkers/logservice/parse.go:231: A five-voter shard has expired stores a and b, reporting stores c, d and e, and spare capacity. Three reports admit the shard to membership repair.
    Impact: Neither removal reaches a live executor. The checker repeats the same routing after operator expiry, so the shard cannot restore redundancy while the two stores remain offline. A further voter loss can leave it without quorum.
    Evidence: check.go:300 creates one removal per expired voter. operator/builder.go:229–241 sorts the retained UUIDs and selects the first, sending each removal to the other expired store. operator/controller.go:150 and :301 account for expiry and dispatch. Exact-head review comment 4649479797 reports the same targets after forced expiry. The preexisting routing is a dependency of the new recovery path. Choose a live, reporting retained voter as executor, preserve Raft configuration-change ordering, and cover retry after multiple failures.

  • P2 pkg/hakeeper/checkers/logservice/parse.go:227: A shard has an expired voter, too few reporting voters, and work to add or remove a non-voting replica. Another shard has a start scheduled on the same recipient store.
    Impact: The non-voting membership command can block the shared heartbeat worker until its Raft timeout, delaying the other shard’s start and the next heartbeat. Multiple pending commands can compound the delay.
    Evidence: parse.go:235–239 still emits non-voting candidates when the voting gate is closed, and pending.go:29 reuses those candidates. check.go:473 orders membership work ahead of starts. service_commands.go:32 and :265 process commands serially, and store.go:577 waits synchronously for the Raft add. Exact-head review comment 4649479804 reports a 4.997-second delay in Dragonboat. Apply the same per-shard eligibility to non-voting membership changes or isolate them from starts and unrelated work.

Validation:

  • Verified the clean frozen source, merge base, supplied patch and git diff --check. Receipt checks/1795232072813304503-2.json and scope.stdout; exit 0.

  • Verified private /tmp and loopback preflight. Receipt checks/1795232072763622855-2.json and preflight.stdout; exit 0.

  • Traced the checker, operator expiry and destination selection, serial LogService command consumer, and legacy HAKeeper command queue. Reused the exact-head coordinator retry and real Dragonboat observations in reviews:6001560614 and its two inline comments.

  • The frozen CI snapshot reports successful Linux build, Ubuntu unit tests, coverage, SCA, multi-CN proxy and pessimistic BVT, and CI Required.

Limitations:

  • The local isolated HAKeeper race retry did not complete. The build reported missing xxhash.h, roaring.h and usearch.h, and check-run exited 124 at 230 seconds. See checks/1795232389380344301-2.json and hakeeper-race-retry.stdout/.stderr. The initial attempt was interrupted during module downloads. Neither attempt yielded a local product-test result.

  • No fresh full cluster restart or released-binary upgrade test was performed. The 4.2-dev stale-command conclusion is based on the frozen branch’s legacy delivery and unchanged persisted representation. The linked main counterpart has no supplied body.

@XuPeng-SH
XuPeng-SH force-pushed the fix/4.2-hakeeper-recovery branch from cbf28df to f99949e Compare November 21, 2026 04:19
XuPeng-SH added a commit that referenced this pull request Nov 21, 2026
Port the recovery behavior from #33009 and suppress legacy shutdown commands across all main command delivery paths.
@XuPeng-SH

XuPeng-SH commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: b357bb93fd957554b0a1750c1bbdc8752bfd17f3

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: b357bb93fd957554b0a1750c1bbdc8752bfd17f3

Assessment: request_changes

Removing global teardown and reusing the existing scheduler avoids the earlier per-command query and queue, but the stale-start fence and quorum guard leave recovery gaps. These are additional boundaries of concerns raised in the previous review. The five-voter executor-selection issue is inherited, and the separate incrservice claim was withdrawn.

Model: gpt-6.1-terra / max

Session: 01a20eeb-75f7-7401-b423-95568690acce · slot 1 · generation 7

  • P2 pkg/logservice/store.go:402: A retired replica was skipped at startup, stale cleanup or Kill removed its MO metadata while leaving Dragonboat bootstrap state, the LogStore restarted, and a delayed Start for the old identity was delivered.
    Impact: The new process has no skipped-zombie entry, so it reopens the retired identity with join=false. That identity occupies the local shard slot and can prevent its committed replacement from starting until the stale replica is cleared and the replacement retried.
    Evidence: startReplicas rebuilds the fence only from the remaining metadata, while service_commands.go:111 uses the retained NodeHost state to reopen it. The same-head three-NodeHost probe removed voter 3, observed the skip, applied Kill, restarted and injected the stale Start: voter 3 reopened and replacement 4 returned shard already exist; the old join=true control rejected voter 3 (../attempt-1/review-probes.log, ../attempt-1/checks/1795545842759731573-2.json). Independent scheduler probes also emitted Start and Remove for the same replica, including an ordinary three-voter expired-store case (review-overlap-expanded.log, checks/1795547527886301199-2.json). Preserve or reconstruct the retirement decision across cleanup and restart, and prevent conflicting starts while retaining quorum-independent restart of configured replicas.

  • P2 pkg/hakeeper/checkers/logservice/parse.go:183: A previously expired voter store returns with an empty report, another live store also lacks its local voter, and only one of the three voters is available while an independent shard needs a Start on that reporting store.
    Impact: No configured store is now expired, so the guard permits a no-quorum membership operation. The serial heartbeat worker can execute it before the other shard's Start and block for the Raft timeout, delaying independent recovery and subsequent heartbeats.
    Evidence: The exact-head coordinator probe emitted AddNonVotingReplica for the unavailable shard before StartReplica for the independent shard on the same store; the expired-store control passed (../attempt-1/review-probes.log, ../attempt-1/checks/1795545842759731573-2.json). The unchanged handler uses a five-second timeout (pkg/logservice/store.go:600), and the earlier real-Dragonboat review observed a 4.997-second no-quorum add. Defer known no-quorum membership work or otherwise keep it from blocking independent starts, including after stores return with incomplete reports.

  • P2 pkg/logservice/service_commands.go:57: A supported full-stop upgrade replays released HAKeeper state containing an obsolete ShutdownStore command alongside another pending command.
    Impact: The issue's required released-data replay of this changed command interpretation remains unverified, so the supplied evidence does not establish that recovery preserves the sibling command and completes after this upgrade boundary.
    Evidence: Issue 33008 explicitly requires an upgrade using released persisted Raft log and snapshot data with relevant pending commands. The author reports a v4.2.9-data reopen and SQL recovery, but the supplied report does not identify pending shutdown and neighboring commands. The current LogService and TN tests inject those commands directly, and the supplied upgrade CI jobs were skipped. Provide matching existing evidence or exercise the released snapshot and log with a pending shutdown and sibling command, verifying ignored shutdown, sibling execution and recovery.

Validation:

  • Private /tmp and loopback preflight passed; the retained native input ledger matched the assigned checkout (preflight.log and native-inputs-check.log; checks/1795546982079003594-2.json and checks/1795547017528239346-2.json).

  • The isolated TestRecoverExistingReplicaWithoutRetiredStore passed (recovery-isolated.log; checks/1795547159350251617-2.json). The TN legacy-command test and disttae DML, DDL and no-write checks passed (tn-disttae-focused.log; checks/1795547448262794530-2.json).

  • Two scheduler probes confirmed conflicting Start and Remove commands, with a zero exit status (review-overlap-expanded.log; checks/1795547527886301199-2.json). The earlier exact-head quorum and three-NodeHost diagnostic probes failed their stated invariants, with their controls recorded in the same log (../attempt-1/review-probes.log; ../attempt-1/checks/1795545842759731573-2.json). Probe inputs were retained and their hashes recorded or checked (review-overlap-inputs.sha256, probe-inputs-check.log; checks/1795547545427908476-2.json and checks/1795547122598339124-2.json).

  • The frozen diff passed git diff --check in the earlier attempt (../attempt-1/diff-check.log; ../attempt-1/checks/1795545996911120894-2.json). All 46 discussion keys are accounted for in discussion-assessment.json (review-record-check.log; checks/1795547706092249521-2.json).

Limitations:

  • The stale Start was injected after real Raft removal, cleanup and restart; the full distributed queue-delivery timing was not reproduced. A separate scheduler probe establishes that conflicting commands can be emitted.

  • An earlier combined focused run failed during initial election and later timed out overall; the isolated recovery rerun passed. This review did not complete a full owning-package race run.

  • The author-reported v4.2.9 full-stop recovery did not document the required pending-command state. The checkout has no v4.2.9 tag; release provenance and any applicable later hotfixes were not independently verified. In the frozen CI snapshot, the shared build had passed, primary unit and coverage jobs were in progress, and upgrade jobs were skipped.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 342a7fdfd52a92ad8e501e61c147b8e14b54e7f0

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 342a7fdfd52a92ad8e501e61c147b8e14b54e7f0

Assessment: request_changes

The recovery design appropriately reuses the existing scheduler and Raft membership, but the new orphan guard can prevent an initial LogService bootstrap from recovering after a crash. The earlier empty-heartbeat and ordinary stale-Start concerns are addressed in the current source; the previously reported five-voter executor-selection issue predates this change.

Model: gpt-6.1-terra / max

Session: 01a20f45-e8c1-71d1-b4be-5d82b90b9189 · slot 0 · generation 11

  • P2 pkg/logservice/store.go:403: A LogService crashes during initial data-shard bootstrap after Dragonboat saves its bootstrap record but before MatrixOne saves the replica metadata, while HAKeeper remains available and the shard has not yet reported.
    Impact: The retained bootstrap Start always has epoch zero and is rejected because the Raft record exists but the MatrixOne metadata does not. If this is the only data-shard voter, bootstrap cannot obtain a shard report, the normal recovery scheduler is never entered, and cluster bootstrap eventually fails.
    Evidence: openDataReplica starts Dragonboat before addMetadataLocked at store.go:575-578. Initial commands are marked Bootstrapping in pkg/hakeeper/bootstrap/bootstrap.go:91-105, and pkg/hakeeper/rsm.go:537 excludes them from epoch confirmation while retaining them until a replica report. The source-derived bootstrap-probe.log reproduces the rejection; its ordinary confirmed-Start control passes. Permit an authorized active bootstrap retry to reopen its persisted replica while preserving protection against obsolete Starts, and cover this restart boundary with a disk-backed regression test.

Validation:

  • Private /tmp and loopback preflight passed: preflight.log and checks/1795573041379522649-3.json.

  • The frozen merge-base-to-head diff passed git diff --check: diff-check.log and checks/1795573938407593834-2.json.

  • An isolated probe using exact extracted source functions passed the ordinary-Start control and failed the initial-bootstrap recovery assertion: bootstrap-control.log, bootstrap-probe.log, and receipts checks/1795574201541802201-2.json and checks/1795573878979012336-2.json.

Limitations:

  • The probe uses stubbed registry and metadata types; the retained disk-backed overlay was not executed.

  • The focused HAKeeper package retry timed out while downloading dependencies before compilation, so it is neither a test pass nor a product-test failure: hakeeper-retry.log and checks/1795574197911677575-2.json. An earlier interrupted download attempt produced no terminal receipt.

  • The PR reports v4.2.9 snapshot/log replay and race runs, but their raw artifacts were not supplied for independent inspection.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: fc2ac4a451ac4ebd21f9b8e07d807374cc32ca91

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: fc2ac4a451ac4ebd21f9b8e07d807374cc32ca91

Assessment: request_changes

The change removes the global teardown and reuses the existing scheduler and Raft membership state. However, its one-shot startup fence can prevent a needed HAKeeper voter from restoring quorum after a stale gossip observation. The new disk-backed bootstrap test also has deadlines that fail under the assigned runtime's slow storage.

Model: gpt-6.1-terra / max

Session: 01a20ed3-c62c-76c0-ab72-cd3b54900431 · slot 2 · generation 2

  • P2 pkg/logservice/store.go:339: A three-voter HAKeeper has only voters 2 and 3 available, and voter 3 restarts while voter 2's reachable gossip view still shows the valid earlier membership prefix {1,2}.
    Impact: Voter 3 is classified as a zombie and remains stopped. Once voter 2's view catches up, HAKeeper still cannot elect a leader or deliver a Start command because it lacks quorum, so recovery waits for another voter or operator intervention.
    Evidence: startReplicas applies this classification once, and BootstrapHAKeeper also honors the skip. A three-NodeHost race probe injected the older peer reply, confirmed that advancing the modeled view did not restart voter 3, and restored a linearizable membership read by explicitly reopening the same retained replica (stale-hakeeper-probe-final.log; checks/1795578091800980905-3.json). Reconsider skipped replicas when a newer membership view confirms them without requiring HAKeeper command delivery, while retaining the fence for removed identities.

  • P3 pkg/logservice/recovery_33008_test.go:394: Disk initialization, reopening, or an individual Raft proposal takes longer than the test's shared 30-second context or 300-millisecond proposal deadline.
    Impact: The new regression test fails before it can reliably verify recovery, even when the candidate behavior succeeds, making the test sensitive to slow storage or scheduling delays.
    Evidence: The stock race test exhausted its context in two runs on the assigned runtime (focused-race.log and bootstrap-rerun.log). An overlay changing only the test deadlines passed the same recovery assertions (bootstrap-extended-final.log; checks/1795578305333824133-3.json). Use bounded phase and proposal deadlines that allow disk-backed startup and commits to complete.

Validation:

  • Private /tmp and loopback preflight passed; native prerequisites were built from inputs copied and verified against the frozen source.

  • The focused race run passed the HAKeeper command-filtering, coordinator-recovery, and zombie-fence tests; the overall command failed because the stock disk-bootstrap test timed out (checks/1795577798773469311-3.json).

  • The deadline-adjusted bootstrap diagnostic passed (checks/1795578305333824133-3.json). The stale-gossip three-NodeHost diagnostic passed its stall and recovery-control assertions (checks/1795578091800980905-3.json).

  • The TN no-shard race test passed for DML, DDL, and no-write cases (checks/1795578585719408217-3.json).

  • Compared the persisted protobuf with the available v4.2.9 and v4.2.8 hotfix source trees. The official v4.2.9 release specifies a full-cluster shutdown upgrade.

Limitations:

  • The stale membership response was injected at the peer-query boundary; the diagnostic used real Raft nodes but did not reproduce the gossip delay over the network.

  • The linked issue reports released-state replay, but its original replay artifacts and logs were not supplied in local validation.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 291489860eeec1d7829c934ff46e30e435a9f3bd

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 291489860eeec1d7829c934ff46e30e435a9f3bd

Assessment: request_changes

Removing global teardown and reusing the existing scheduler is a focused recovery design, but the new orphan-record scan can prevent an initial HAKeeper voter from restoring quorum. A related stall for replicas whose MatrixOne metadata is present was raised previously and already exists in the base; this finding concerns the newly scanned metadata-less case.

Model: gpt-6.1-terra / max

Session: 01a210f5-236b-7a40-a956-fdee040ef313 · slot 3 · generation 2

  • P2 pkg/logservice/store.go:468: An initial HAKeeper voter crashes after Dragonboat saves its bootstrap record but before MatrixOne saves the replica metadata. On restart, another voter is unavailable and the reachable peer's gossip still reports an earlier initial-membership prefix that omits this voter.
    Impact: The new orphan scan marks the retained voter as a zombie. BootstrapHAKeeper then skips it, and no path reconsiders the decision when gossip catches up. The remaining voter cannot elect a leader or deliver a Start command, leaving the cluster unavailable despite the recoverable replica being present.
    Evidence: The base scans only MatrixOne metadata, so it does not fence this orphan before BootstrapHAKeeper attempts the configured initial start. On the assigned head, an isolated race probe using three Dragonboat NodeHosts injected the missing metadata and stale peer response; repeated bootstrap calls left quorum unavailable, while explicitly reopening the same retained replica restored quorum. See orphan-hakeeper-probe.log and checks/1795585114560765930-2.json. Recognize a valid initial-membership prefix or reconsider the orphan when a newer view confirms it, while retaining the fence for genuinely retired replicas.

Validation:

  • Private /tmp and loopback preflight passed: preflight.log and checks/1795584104962568346-2.json.

  • The revised TestInitialLogBootstrapReopensBeforeMetadataWasSaved passed under race on the assigned head: bootstrap-race.log and checks/1795584880524973776-2.json.

  • The orphan HAKeeper probe passed its stall assertions and its explicit-reopen control: orphan-hakeeper-probe.log and checks/1795585114560765930-2.json.

  • Reused predecessor HAKeeper and coordinator per-package race passes after checking the relevant source inputs were unchanged. The predecessor's combined run exited nonzero because its older bootstrap fixture timed out.

  • The assigned diff passed git diff --check, and all 52 discussion keys were accounted for.

Limitations:

  • The orphan probe injected the stale peer response and metadata-loss state; it used real Raft nodes with an in-memory filesystem and did not reproduce the crash or gossip delay over a production network.

  • The v4.2.9 snapshot/log replay and SQL recovery are author-reported in the supplied PR and issue evidence; they were not independently rerun.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 8a30bcb32c787b973f1540ea94083c2d92265d71

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 8a30bcb32c787b973f1540ea94083c2d92265d71

Assessment: request_changes

The recovery design reuses the existing scheduler and Raft membership state, but the new three-node regression fixture has two reliability defects that can fail validation before it exercises recovery. A stale-prefix concern investigated during review also occurs on the frozen base and is not reported as a new product regression.

Model: gpt-6.1-terra / max

Session: 01a21155-55c0-79f0-b683-78fb22f78abd · slot 1 · generation 13

  • P3 pkg/logservice/recovery_33008_test.go:599: The initial two HAKeeper voters experience scheduling or gossip delays during a race-mode run.
    Impact: The test can time out during its first election, before it checks orphan recovery or the removal fence, making the validation unreliable.
    Evidence: The fixture starts the voters without waiting for peer discovery and waits 25 seconds for membership. An isolated exact-head race run failed with 'voter 2 has no quorum' after repeated Raft tick backlogs; an identical retry passed. See orphan-race-retry.stdout and orphan-race-repeat.stdout, with receipts 1795587869690384731-2.json and 1795588418615093334-2.json. Add a discovery readiness barrier and use an election window that tolerates the test environment while preserving the recovery assertions.

  • P3 pkg/logservice/recovery_33008_test.go:537: Another socket acquires the fixture's TCP RPC port after a service closes and before the test reopens it.
    Impact: NewService fails to bind the reused port, so the test fails before completing its restart assertions.
    Evidence: getServiceTestConfig selects an unreserved TCP port, and this fixture closes and reopens services with the same configuration at lines 608 and 631. QA previously reported this exact EADDRINUSE failure pattern in the earlier recovery fixture; the other disk-backed fixtures now use useRecoveryRPCSocket, but this new one does not. Use the existing isolated RPC socket helper or otherwise retain reliable ownership of the RPC endpoint across restart.

Validation:

  • Private /tmp and loopback preflight passed, and the frozen diff passed git diff --check; receipts 1795587287495633723-2.json and 1795588526561818803-2.json.

  • The focused coordinator repair test and both HAKeeper membership-delivery tests passed under race; hakeeper-focused.stdout and receipt 1795588523587980847-2.json.

  • The new orphan-recovery test failed once during initial election and passed an identical isolated race retry; both logs and receipts are retained in the diagnostic directory.

  • All 54 discussion keys were reconciled in discussion-assessment.json. The command-to-log mapping is in review-validation.md.

Limitations:

  • The three-node stale-prefix overlay timed out without a terminal test result. A source-derived model reproduced the prefix decision, but the base comparison shows that the metadata-less initial-voter behavior already existed.

  • The v4.2.9 snapshot and log replay, full-stop upgrade, and SQL recovery are author-reported and were not independently rerun. The frozen build, Ubuntu unit-test, and Coverage jobs were still in progress.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 8f5e9806673abdc7ec0229f49bfdeeea77eac3d1

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 8f5e9806673abdc7ec0229f49bfdeeea77eac3d1

Assessment: approve

No actionable regression was found. The change removes global teardown and reuses the existing scheduler and Raft state; the transient epoch, bootstrap-prefix and cleanup guards address distinct recovery boundaries. The previously discussed stale-gossip limitation is present on the frozen base and remains separately tracked.

Model: gpt-6.1-terra / max

Session: 01a21155-55c0-79f0-b683-78fb22f78abd · slot 1 · generation 13

Validation:

  • Private temporary-directory and loopback preflight passed; receipt checks/1795591332360929092-2.json and preflight.log.

  • Native prerequisites were built with the repository make targets and their source inputs verified; receipts checks/1795591394771603826-2.json, checks/1795591411816538384-2.json and checks/1795592511582041707-2.json.

  • The combined focused Go command exited 1 because TestRecoverExistingReplicaWithoutRetiredStore exhausted its deadline. Its other selected LogService tests passed, as did the selected HAKeeper, scheduler, TN and transaction package tests; receipt checks/1795591887870364355-2.json and focused-go.log.

  • The author-identified v4.2.9 source commit and the candidate have identical proto/logservice.proto files; the released Start command writer was also inspected. Receipts checks/1795592778668799806-2.json and checks/1795592778668805538-2.json.

Limitations:

  • TestRecoverExistingReplicaWithoutRetiredStore reached its shared 90-second deadline during setup, before the recovery assertion, while packages were compiling concurrently. Two isolated retries timed out during compilation and did not start the test; receipts checks/1795592352983513576-2.json and checks/1795592985869442900-2.json. The host showed sustained high disk I/O pressure, so these results do not establish a product failure or a test pass.

  • The PR reports full owning-package race validation and a full-stop v4.2.9 snapshot, WAL and cluster-recovery exercise. Those runs were not independently reproduced here, and their logs were not supplied in local_validation. The release artifact and applicable hotfix inventory were not independently verified from the frozen checkout.

@XuPeng-SH

XuPeng-SH commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: c848fe0682b9b7abaa0f0c69b00552df0d4b52a1

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: c848fe0682b9b7abaa0f0c69b00552df0d4b52a1

Assessment: approve

No actionable regression was found. The change removes global teardown and reuses the existing scheduler and Raft membership state for recovery. Its transient fencing and metadata locking address distinct restart and cleanup cases without changing the persisted format. The previously discussed stale-gossip and executor-selection limitations predate this PR.

Model: gpt-6.1-terra / max

Session: 01a21136-dc54-7ba1-aace-4039c02570be · slot 2 · generation 3

Validation:

  • Isolation preflight passed. Native prerequisites were built from inputs verified against the frozen checkout; see preflight.log, native-inputs-final.log and receipts under checks/.

  • Focused HAKeeper delivery, coordinator recovery, TN legacy-command and transaction write-guard tests passed; see focused-owner-tests.log and checks/1795596642001544350-2.json.

  • Five selected LogService cases passed, covering nonvoter reopen, both initial-bootstrap recovery paths, stale-replica cleanup and the retired-replica fence. The combined command exited 1 because the remaining three-store recovery case timed out; see focused-logservice-tests.log and checks/1795596893383904308-2.json.

  • The three-store recovery assertions passed with a diagnostic overlay that changed only test deadlines; see recovery-overlay.log, recovery-timeout-overlay-final.diff and checks/1795597341771607009-2.json.

  • The candidate's LogService protobuf matches v4.2.9 and the latest identified v4.2.8 hotfix. The hotfix HAKeeper state-machine comparison differs only in this PR's delivery change; comparison logs and receipts are retained in the diagnostic directory.

  • The frozen diff passed whitespace checks, and all 58 discussion keys are accounted for in discussion-assessment.json.

Limitations:

  • Two unmodified runs of TestRecoverExistingReplicaWithoutRetiredStore timed out: one during initial heartbeat setup and one after the restored voter rejoined and elected a leader. The host reported sustained severe I/O pressure. The timeout-overlay pass is not a stock-test pass.

  • The author reports full race validation and a full-stop v4.2.9 snapshot, log-tail and SQL recovery exercise with pending legacy commands; those runs were not independently reproduced and their raw logs were not supplied.

  • In the frozen CI snapshot, primary build and unit checks were still in progress and upgrade jobs were skipped.

This branch was previously deployed

1 inactive deployment
ci — c848fe06 Deployed Nov 25, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/enhancement kind/refactor Code refactor size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants