Skip to content

fix(hakeeper): keep stores alive during replica recovery - #33010

Merged
XuPeng-SH merged 9 commits into
mainfrom
fix/hakeeper-recovery
Nov 28, 2026
Merged

XuPeng-SH merged 9 commits into
mainfrom
fix/hakeeper-recovery

Conversation

@XuPeng-SH

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

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Code Refactoring

Which issue(s) this PR fixes:

issue #33008

This is the main-branch counterpart of the recovery fix merged into 4.2-dev in #33009.

What this PR does / why we need it:

A lost LogStore and an incomplete replica report could make HAKeeper repeatedly shut down surviving LogStores and TNs. Remove the global teardown and its latch. LogService and TN consume historical shutdown commands while continuing to handle sibling commands and retaining existing TN batch acknowledgement.

HAKeeper selects one ordinary membership change per shard from valid reports. Fresh and retried changes require a retained reporting voter and a majority in the current and projected configurations. Configured replicas can still be started to restore quorum. A Start can reopen existing Raft files when the replica is authorized. An orphaned initial bootstrap retains its exact manifest, and a newer removal prevents the old identity from restarting. Pending local replicas keep their metadata and exported snapshots while cleanup observes their ownership. Catalog permits retain their existing admission and recovery paths.

Effective writes now return ErrServiceUnavailable if TN reports no shard. Read-only and net-zero writes retain their behavior.

Recovery and delivery boundaries

  • A tentative startup absence from gossip does not authorize snapshot cleanup or retirement. A newer authorized Start can reopen the original replica; a confirmed Kill remains terminal. An incomplete initial configuration is not evidence for a Kill, even if a local replica report arrives before its own initial Raft AddNode.
  • Dynamic bootstrap reuses the original manifest, replica IDs and durable queue until each target reports the corresponding voter. A replacement disk, a conflicting cohort or a later configuration fences the old genesis command. This does not reconstruct a command that was already lost. An initial-cluster Start still eligible for the original genesis can reach a replacement disk before its first replica report. This is the inherited initial-cluster behavior.
  • Queued membership changes use the scheduler’s existing majority checks against current replicated reports and the leader’s committed tick policy. Before that policy is known, the command stays queued and independent work can still be delivered. The idle heartbeat adds no RPC or Raft proposal. Safe handoff after delivery and at the Raft commit boundary remains tracked in [Bug]: Safely restore HAKeeper voting redundancy after permanent replica loss #33062 and [Bug]: Data-shard Raft reconfiguration can strand the new quorum #33067. [Bug]: LogService startup can skip a valid replica when only a stale gossip peer answers #32919 tracks broader startup classification.
  • Historical heartbeat and tick entries retain replay semantics. Forward upgrades with a full shutdown were validated from both v4.2.8 and v4.2.9. Rolling mixed-version operation and downgrade after writing the new entries remain unvalidated.

Validation

The latest v4.2.9 replay review is covered by the following checks on the source tree delivered in cffd1e557913.

  • Persisted snapshot and Raft tail. Built v4.2.9 from tag commit 6c05e42f9f66. A real disk-backed NodeHost produced a snapshot at index 4 containing pending legacy ShutdownStore and StartReplica, followed by a committed old-format tick. The next build opened a SHA-256-matched copy, replayed the snapshot and tail, ignored the historical shutdown, and started the sibling data shard through heartbeat delivery. The candidate committed LSN 3 and read it after restarting on the same files.
  • Full-stop SQL upgrade. Using the same data directories and service IDs, a stock release-source LogService/TN/CN cluster committed a SQL row and shut down. The candidate read that row, inserted a second row, and shut down. Both rows were present after the next full restart. HAKeeper and data-shard replica IDs stayed at 131072 and 262145.
  • Recovery and cleanup. Removed the unused TN constructor shutdown-channel argument end to end. All 11 HAKeeper packages and the LogService protobuf package passed with -race -short -count=1. Twenty-five focused tests passed under go test -race -count=1, including disk-backed recovery with a configured voter offline, loss of both bootstrap replies, fencing stale genesis after membership changes, legacy TN batch acknowledgement, and constructor unwind. Incremental static analysis passed.
  • The release and candidate were built on Darwin arm64 from Go 1.26.4 and Go 1.27.1, respectively. The full-stop SQL topology used one LogStore, one TN and one CN. Multi-voter recovery was exercised separately with real local Raft nodes.

Previous validation on 533c293 and earlier revisions:

  • Published 533c293 integrates main@df908551 without rewriting the Work branch. The exact tested source tree passed all 11 HAKeeper packages plus LogService protobuf under race, 12 focused initial-membership/real-removal controls, and 8 TN heartbeat and 6 Disttae controls. Disk-backed regressions show a reopened voter can resume writes and peer reads with another voter offline; both lost dynamic replies can be retried with their original IDs. Old controls fail at the corresponding assertions.
  • The v4.2.8 source snapshot and Raft log tail preserved legacy state and queued commands through replay, activation and restart. Broad LogService passed on this recovery code before the last HAKeeper-only refinement with a TCP-only fixture for this sandbox. A stock Unix-socket-only check was not validated here. Remote CI is separate.

Earlier Work validation (before the final recovery refinement):

  • Real Raft recovery tests exercise retained voting and non-voting replicas, native bootstrap before metadata publication, recovery of a configured HAKeeper voter, later removal overriding an older membership report, and a stable majority with an eligible replacement.
  • Go 1.27.1 replayed a snapshot and Raft tail generated by v4.2.8 source. Mixed LogStore and TN queues preserved sibling work, a regular tick committed, and a restart replayed the resulting state.
  • In a full-stop upgrade from preserved v4.2.8 cluster data, the candidate read both released rows, committed a new row, and read all three after another full restart.
  • Local race validation covered the HAKeeper closure, LogService, TN, disttae, protobuf helpers, and both TAE logstore fixture consumers. The CI SCA selector expanded to the full graph. Formatting, diff checks, err-check, molint and golangci-lint passed.
  • An earlier full integration-service race run reported transient shard not found during CN startup. Focused diagnostic runs passed twice. A separate full run reported error 20702 (lock table bind changed) in TestTaskSchedulerExpiresLostRunnerWithoutReplay. The clean main control reproduced the same assertion and error, and the case passed in isolation on this candidate. The final integration retry passed with that one case excluded.

@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 e0d6eb0. GitHub does not let the author formally request changes on their own PR, so I am recording the decision as a comment.

The removal of sticky teardown addresses the original shutdown loop, and the regression covers recovery after the missing voter reports again. The remaining findings affect whether the newly enabled recovery path makes progress and whether an unhealthy shard delays unrelated work. I verified them with an exact-head coordinator probe and, for the command-handler delay, real local Dragonboat nodes. There were no earlier substantive review comments on this PR.

Separately, syshealth.Healthy is now used only by the test cluster, while its old health calculation differs from the production repair policy. Please consider retiring that legacy policy or making the test helper's narrower meaning explicit so the test fixture does not become a second health authority.

Comment thread pkg/hakeeper/rsm.go Resolved
@XuPeng-SH

XuPeng-SH commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: e0d6eb0f508d47489f064792b05054804cafeb6b

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: e0d6eb0f508d47489f064792b05054804cafeb6b

Assessment: request_changes

Removing cluster-wide teardown addresses the failure in #33008. The fix belongs in the existing LogService checker and HAKeeper delivery state machine. Three findings from the prior review still apply. The readiness check discards the voter information that routing needs, leaves non-voter configuration changes outside its guard, and only hides obsolete shutdown work in acknowledged queues. The added tests cover the original missing-report recovery and preserve valid batch IDs. The review probes cover the three remaining cases. There are no documentation changes.

Model: gpt-6.2-sol / xhigh

Session: 01a1ed86-9b09-7303-8d78-76024e7bf652 · slot 3 · generation 0

  • P1 pkg/hakeeper/checkers/logservice/parse.go:278: A five-voter LogService shard has members a, b, c, d and e. Stores a and b have expired and c, d and e still report their voters.
    Impact: Both removals are routed to expired stores, so the shard cannot restore redundancy even though it has quorum. Operator expiry just repeats the same routing while the outages persist.
    Evidence: The isolated Coordinator.Check probe got remove a → b and remove b → a (membership-probe.log, receipt 1795232293140553381-5). check.go:300 passes the unfiltered membership to the builder, whose retained-peer selector sorts UUIDs at pkg/hakeeper/operator/builder.go:229. Give the existing selector the live, reporting, incarnation-matching voters retained by that change, and refresh the destination of failed attempts.

  • P2 pkg/hakeeper/checkers/logservice/parse.go:286: A shard with three voters has one expired voter and one live store whose voter is missing from its report. A configured non-voting replica is due to be added, and the store receiving that add also needs to start a replica for another shard.
    Impact: A configuration proposal that cannot commit without quorum can delay unrelated starts and subsequent heartbeats on the same store. Adds have a five-second synchronous timeout, and unsuccessful work can recur on subsequent checker runs.
    Evidence: The isolated coordinator probe put the non-voting add at position 0 and the unrelated start at position 1 on the same store (membership-probe.log, receipt 1795232293140553381-5). The checker orders add/remove before start at check.go:473. LogService applies each heartbeat batch serially at pkg/logservice/service_commands.go:33 and :301, and the non-voting add calls Dragonboat synchronously at pkg/logservice/store.go:808. Apply one readiness rule to voting and non-voting membership changes while allowing starts for already-configured replicas.

  • P3 pkg/hakeeper/rsm.go:952: A preparing or acknowledged queue is restored with an unacknowledged shutdown-only batch, and the store receives no later deliverable work.
    Impact: Polling and heartbeats return an empty batch without a usable acknowledgment ID. The obsolete entry stays in replicated state and in subsequent snapshots, including for a store that never needs scheduling again.
    Evidence: Both preparing and enabled cases kept the entry through another snapshot and restore (shutdown-retention-probe.log, receipt 1795232331227884676-5). The ordinary heartbeat already removes empty pending entries at rsm.go:834. Prune obsolete shutdown work at the replicated queue owner, covering restored snapshots and replayed schedule updates. Preserve the batch ID and per-command IDs of remaining valid work.

Validation:

  • Verified clean frozen head, merge base, full patch, target policy snapshot and whitespace. The patch matches after restoring its final newline. The pinned target had no overlapping edits to the changed paths. See source-check.log and receipt 1795232022872874239-5.

  • Private /tmp and loopback preflight passed (preflight.log, 1795232032139193333-5). The host Go version and the initial missing native headers caused setup failures (hakeeper-tests.log and hakeeper-auto.log, 1795232036806504577-5 and 1795232121677663689-5). Go 1.27.1 bootstrap and an isolated native build recovered both. Native inputs and artifact hashes are retained beside native-build.log (1795232217279929019-5).

  • All 11 packages under ./pkg/hakeeper/... passed (hakeeper-native.log, 1795232274931653075-5). Four targeted LogService client tests covering reverse proxy, TN heartbeat, schedule polling and log heartbeat passed (logservice-client.log, 1795232302396316573-5). Both used this job's test-exec.

  • Diagnostic-only Go overlays exercised the real Coordinator.Check and HAKeeper snapshot, lookup and heartbeat entry points. The two scheduling assertions and both shutdown-queue cleanup assertions failed as described in the findings. See membership-probe.log and shutdown-retention-probe.log, receipts 1795232293140553381-5 and 1795232331227884676-5.

  • The frozen head has successful shared build, x86 unit tests, static analysis and both active multi-CN BVT lanes. The candidate retains the shutdown command and schedule-state field numbers from the locally tagged v4.1.4 and v4.1.6 sources and can read raw protobuf snapshots. Pinned policy supports shutdown upgrades.

Limitations:

  • The fresh scheduling probes measure command selection and ordering. The prior exact-head review reported a Dragonboat timeout for the non-voter case. This review did not repeat that timing experiment or run a full Kubernetes outage or a shutdown upgrade with released binaries. The QA cause of the missing voter report remains unverified.

  • Snapshot tests construct the legacy command representation in the current state machine. They cover delivery after recovery and the retained queue. They do not establish how often the incident occurred in deployed clusters.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: dcf217c285afae689706b17723dc525b5899ae69

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: dcf217c285afae689706b17723dc525b5899ae69

Assessment: request_changes

The PR removes the cluster-wide shutdown loop and reuses the existing scheduler, command queues, and catalog reservations. Both disk-backed recovery tests passed together under the race detector. One safety gap remains. HAKeeper can deliver a queued voter removal after its own replicated reports show that the resulting configuration would lack quorum.

Model: gpt-6.2-sol / xhigh

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

  • P1 pkg/hakeeper/rsm.go:822: A three-voter HAKeeper queues removal of B while A and C report. Before the next delivery heartbeat, B returns and C stops. HAKeeper records both updated reports at the same Raft configuration index.
    Impact: A and B can commit the removal under the old configuration. Removing B leaves A as the sole available voter in a two-voter shard, preventing HAKeeper from committing heartbeats or scheduling further recovery.
    Evidence: The exact-head probe showed that current reports fail the projected-quorum check at pkg/hakeeper/log_membership.go:107, yet both legacy and acknowledgment-enabled queues delivered the removal. Stable-report controls passed, and the unrelated replica start was delivered in all cases. The LogService submits the removal at the unchanged index through pkg/logservice/store.go:835. Recheck queued membership changes against the current replicated reports before delivery or reservation, while allowing independent starts to proceed. See voter-delivery-race.jsonl and checks/1795402950377361117-7.json.

Validation:

  • Passed 265 race-enabled tests across all 11 HAKeeper packages and the LogService protobuf package. See hakeeper-race.jsonl and checks/1795402960857272756-5.json.

  • Passed 19 focused race-enabled tests covering grouped disk recovery, stable three-to-two-to-three repair, catalog cancellation, shutdown acknowledgment, and empty TN inventory. See services-race.jsonl and delivery-controls-race.jsonl.

  • A race-enabled MySQL client probe verified that INSERT and CREATE TABLE return service unavailable with empty TN inventory, neither change persists, and writes resume after inventory is restored. See empty-tn-sql-race.jsonl and checks/1795403173289334435-6.json.

  • Verified the frozen patch, native prerequisites, and retained wire fields against v4.2.8 and the tagged hotfixes. Matched nine checks to receipts in validation-reconciliation.json and accounted for all 41 discussion entries.

Limitations:

  • The stale-removal probe exercised replicated delivery. The resulting quorum loss follows from the ordered Raft deletion path and voter counts.

  • The full-stop upgrade and released Raft-tail replay are author-reported. Frozen upgrade CI was skipped.

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex automated review

I reviewed the diff of PR head dcf217c against origin/main (46 files), the issue #33008 acceptance criteria, all 19 existing reviews (the latest on this exact head), the 3 inline threads, and all 20 issue comments, re-fetched fresh before concluding; the head and all review state are unchanged. The change removes the latched cluster-wide teardown from the coordinator and syshealth, retires every ShutdownStore producer, and treats queued historical shutdown commands as applied-but-ignored on LogService and TN so batches still acknowledge and drain without dropping other commands (pkg/hakeeper/rsm.go getCommandBatchFiltered, pkg/logservice/service_commands.go, pkg/tnservice/store_heartbeat.go). All new Log membership operators flow through the new hakeeper.LogMembershipTargets, which requires a reporting, incarnation-matching retained-voter executor and a majority in both current and projected configurations; the gate is applied at checker selection, at single-change-per-shard selection, and again when pending operators are replayed alongside a TN retry. Starts for unaffected shards stay independent, start commands are validated against configured member identity, role, and store incarnation when a Log heartbeat response is prepared, existing Raft data is reopened via join=false when the NodeHost knows the node, and write transactions now return ErrServiceUnavailable instead of silently succeeding with no TN write request when the chosen TN reports no shard, with read-only and net-zero-write transactions unchanged. I traced these paths, the operator controller's active-step tracking, the epoch fence in RemoveFinishedOperator, and the disttae error handling, and found them correct and consistent with the documented scope and limitations; earlier reviewer feedback on retained-peer routing, non-voting membership gating, shutdown-only batch retention, start-after-stop and cancellation races, and catalog owner retention is resolved in this head, and the added tests cover the missing-report regression, disk-backed recovery, shutdown replay, and both delivery modes. No dangling references to the removed teardown symbols remain outside generated protobuf code.

Test limitation: this checkout's thirdparties/install is not built, so compiling the affected packages fails before reaching this change: with CGO_ENABLED=1 go build fails on missing jemalloc.h and usearch.h headers, and with CGO_ENABLED=0 pkg/common/mpool references cgo-only malloc symbols. Per review policy I did not build those prerequisites, so I could not execute the Go tests locally and I do not attribute those environment failures to the PR; the conclusion rests on static analysis plus the in-PR validation receipts recorded on this exact head (265 race-enabled HAKeeper tests plus focused LogService/TN/disttae race runs), not on my own runs.

One safety gap remains open on this head, but it was raised by the standing reviewer and the author has not yet addressed it, so per the no-duplication rule I do not re-emit it as a finding: HAKeeper can still deliver an already-queued voter removal after newer committed reports show the projected configuration would lack quorum (pkg/hakeeper/rsm.go, heartbeat delivery in getCommandBatchFiltered only filters starts, and operator-level replay revalidation does not guard the already-scheduled command). The author documents this race class as pre-existing and tracked in #33062/#33067; the standing reviewer's request-changes position on that point stands independently of this review, which adds no new findings on top of it.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: dcf217c285afae689706b17723dc525b5899ae69

New discussion was assessed; the previous review remains unchanged.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 2d0efa4fad9f9739deaf468fa2d0190af30b5d33

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: 2d0efa4fad9f9739deaf468fa2d0190af30b5d33

Assessment: request_changes

The PR removes latched cluster-wide shutdown and reuses the scheduler, command queues, and catalog reservations. One safety gap remains during a supported shutdown upgrade. The first guarded heartbeat can count an expired voter and release a queued removal that would strand HAKeeper without quorum. The disk-backed recovery test also remains intermittent in grouped race runs.

Model: gpt-6.2-sol / xhigh

Session: 01a20682-9189-75a0-839a-f36d8b2372a5 · slot 1 · generation 3

  • P1 pkg/hakeeper/rsm.go:886: A three-voter HAKeeper queues removal of B while A and C report. B returns, C's last report expires, and the Raft configuration index stays unchanged. After a full shutdown upgrade, A's first guarded heartbeat arrives before the first timeout-policy tick commits.
    Impact: A and B can commit the removal under the old configuration. That leaves A as the sole available voter in a two-voter configuration, so HAKeeper cannot commit heartbeats or schedule further recovery.
    Evidence: The snapshot replay probe delivered B's removal in both legacy and acknowledged queues. With a committed policy tick, both controls withheld the removal and still delivered the independent Start. The ordered delete at pkg/logservice/store.go:823 accepts the unchanged configuration index. Retain queued membership changes and their IDs until the replicated timeout policy is available, then recheck them while allowing independent starts and cleanup to proceed. See ../attempt-1/cold-expiry-history-probe.log and receipt 1795410600185245783-2.json.

  • P3 pkg/logservice/recovery_33008_test.go:41: Run TestRecoverExistingReplicaWithoutRetiredStore in the grouped LogService race selection or alongside TestDeliveredExistingHAKeeperStartRestoresQuorum with the inherited 10 ms Raft RTT.
    Impact: Initial membership setup can time out before the test exercises configured-replica recovery, making the race suite intermittent and leaving the recovery assertions untested in failed runs.
    Evidence: The exact-head test timed out at the membership wait on line 78 in both grouped runs and passed alone. A diagnostic overlay changed only the two fixtures' RTT to 50 ms, and both tests passed together twice. Stabilize the fixture's Raft timing while preserving its bounded waits and recovery assertions. See raft-recovery-retry-race.log, raft-recovery-isolated-race.log, and raft-timing-overlay-race.log.

Validation:

  • All 12 HAKeeper and LogService protobuf packages passed under the race detector. Focused delivery, cancellation, and transaction checks passed in LogService, TN, and disttae.

  • Verified retained heartbeat, tick, and command-queue wire fields against v4.2.8 and the two relevant hotfix tags. Matched the frozen source, commands, exits, and logs in review-validation.md.

  • Accounted for all 45 frozen discussion entries in discussion-assessment.json. The related commit-time membership risks remain scoped to issues #33062 and #33067.

Limitations:

  • The probe reproduced unsafe command delivery. The quorum loss follows from the ordered removal path and voter counts.

  • The author reports released snapshot and Raft-tail replay and a full-stop SQL rehearsal. Independent validation covered the wire identities and the guarded delivery path.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: e9f884a4c4a653d71d15e5b5c27f4e713c48ff8c

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: e9f884a4c4a653d71d15e5b5c27f4e713c48ff8c

Assessment: request_changes

The PR removes the cluster-wide shutdown loop and reuses the scheduler, heartbeat delivery, and Raft tick to guard membership changes. The earlier pre-policy quorum finding is resolved. A retained bootstrap command can still block recovery after lost heartbeat responses, and the disk-backed regression still times out during grouped race runs.

Model: gpt-6.2-sol / xhigh

Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1

  • P2 pkg/hakeeper/rsm.go:698: A dynamic shard queues bootstrap commands for A, B, and C. HAKeeper consumes A’s and B’s commands, but both responses are lost before those stores start their replicas. C stops heartbeating with its command still queued.
    Impact: C’s queued claim blocks bootstrap retries for the whole shard, including retries for the same approved configuration. A and B could form a majority, but the shard remains unavailable while C’s claim persists, including across snapshot recovery.
    Evidence: The exact-head race probe restored the snapshot and retried A and B with the original replica IDs and member map. Both legacy and ID-bearing queues delivered zero commands to A and B and retained C’s command. Keep an approved bootstrap retryable until its target reports the matching replica, while continuing to reject competing initial configurations.

  • P3 pkg/logservice/recovery_33008_test.go:97: Run TestRecoverExistingReplicaWithoutRetiredStore with the other disk-backed LogService recovery tests under the race detector.
    Impact: The fixture can time out during initial data-shard setup, leaving the configured-replica recovery assertions untested in the grouped run.
    Evidence: The grouped run timed out waiting for exact membership at line 97, and the same test passed in isolation. The earlier fixture finding therefore remains open. Stabilize the bounded setup phases and verify the grouped run with the recovery assertions intact.

Validation:

  • Verified the frozen patch, pinned policy, whitespace, native inputs, and generated protobuf descriptor. Compared persisted field identities with v4.2.8 and the two relevant hotfix tags. Isolation preflight passed.

  • The grouped race run passed the pre-policy queue and historical replay controls, live dynamic bootstrap preservation, and configured HAKeeper quorum recovery. The new bootstrap retry probe failed in both queue modes. The disk recovery fixture failed during grouped setup and passed in isolation.

  • All 13 selected LogService, TNService, and disttae consumer race tests passed, including cancellation, shutdown acknowledgment, and empty-TN write handling. Matched seven receipts to retained logs and reconciled all 47 discussion entries in the continuation directory.

Limitations:

  • The lost-response probe exercised the replicated state machine. The full-stop v4.2.8 upgrade, released Raft-tail replay, and benchmark results are author-reported. Commit-time membership handoff remains scoped to issues #33062 and #33067.

@XuPeng-SH

XuPeng-SH commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 503777ceff9f482444c0052213336282a8c1ec2c

"interrupted"

@XuPeng-SH

XuPeng-SH commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 6f6aaeecfec4e7b90e6f5f2d11862dbfa145cb7d

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: 6f6aaeecfec4e7b90e6f5f2d11862dbfa145cb7d

Assessment: request_changes

The recovery fix reuses the existing scheduler, heartbeat delivery, and Raft startup paths. Its new membership and retirement tracking supports stale-command rejection, but cleanup can turn an uncertain startup absence into a fence that blocks an authorized replica restart.

Model: gpt-6.1-terra / max

Session: 01a216bc-adbc-7142-8f93-6b94a5827118 · slot 0 · generation 16

  • P2 pkg/logservice/store_metadata.go:328: A configured data replica is skipped at startup because the only responding gossip peer has an older membership view. Truncation cleanup runs before HAKeeper delivers a Start confirmed at a newer membership epoch.
    Impact: Cleanup replaces the tentative absence with an unconditional retired marker. The later authorized Start is rejected for the lifetime of the LogService process. If that voter is needed for quorum, the shard can remain unavailable until restart or replacement.
    Evidence: The exact-head real-NodeHost probe injected the stale membership reply, ran cleanup, and supplied a newer-epoch Start; the replica did not reopen. The retained control, which restored the base's data-shard skipped-marker deletion, passed. See ../attempt-1/gossip-start-overlay.log and ../attempt-1/gossip-start-control-overlay.log, with receipts 1795677747899446999-2.json and 1795677745859223231-2.json. Keep tentative startup absence distinct from explicit retirement so current authorization can recover the replica while genuine Kill/retirement fences remain effective.

Validation:

  • Reused exact-head isolation preflight and race results for all 11 HAKeeper packages, nine selected LogService recovery tests, and focused TN and Disttae tests. Commands, source fingerprints, exits, and logs are reconciled in review-validation.md.

  • The candidate and control recovery probes were matched to their retained logs and receipts. All 50 discussion keys are accounted for exactly once in discussion-assessment.json.

Limitations:

  • The probe used an injected stale gossip response and a simulated confirmed Start; it did not reproduce a natural gossip delay in a complete cluster. The preexisting startup-classification issue is tracked in #32919.

  • The author reports a v4.2.8 full-stop upgrade and released snapshot/tail replay. Those rehearsals were not independently repeated. The local v4.2.9 tag was unavailable, so its exact contents were not independently verified.

  • Earlier reviewers disputed whether #33008 also requires rechecking already-issued membership changes at delivery. The PR retains that preexisting behavior; a product-owner decision is needed on that boundary, while commit-time handoff is tracked in #33062 and #33067.

  • In the frozen CI snapshot, the shared build was in progress, unit tests were queued, and upgrade CI was skipped.

@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.

6.2-sol-max post-push review: no blocking finding on 533c293. This commit preserves the previous Work branch as first parent, includes main@df908551, and has the same source tree as the locally tested candidate.

The previous false-retirement finding is resolved: a tentative startup absence no longer authorizes cleanup, a newer authorized Start can reopen the original replica, and explicit retirement remains terminal. Durable bootstrap delivery reuses the existing commands and IDs across lost replies; a new disk or a later committed configuration cannot consume an old genesis. Incomplete initial membership cannot dispatch a stale Kill, while a later confirmed removal remains eligible. Queued membership changes now recheck the existing current/projected-majority rule before delivery. The later Raft-commit window remains out of scope.

The exact source tree passed all HAKeeper and LogService protobuf race suites, 12 initial-membership and actual-removal controls, plus focused disk-backed LogService, TN and Disttae verification. Replayed real v4.2.8 snapshot and Raft-tail bytes; no rolling upgrade or downgrade claim. The broader LogService run used isolated TCP fixtures because this sandbox cannot bind Unix sockets. Idle/ordinary task heartbeat allocations were unchanged in the local microbenchmark; an actual validated Remove costs six extra allocations (360 B). No end-to-end throughput claim. Remote CI is still running.

@XuPeng-SH

XuPeng-SH commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 533c29368d55b8f954103906e100e1e7b2d7a596

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: 533c29368d55b8f954103906e100e1e7b2d7a596

Assessment: request_changes

The recovery design reuses the existing scheduler and command queues, with retained bootstrap manifests and a replicated expiry policy addressing lost replies and replay. The earlier tentative-retirement and stale-delivery findings are addressed. One required release-upgrade validation gap remains.

Model: gpt-6.1-terra / max

Session: 01a216bc-adbc-7142-8f93-6b94a5827118 · slot 0 · generation 16

  • P2 pkg/hakeeper/rsm.go:1778: A full-cluster shutdown upgrade from v4.2.9 to this main-branch revision replays a persisted HAKeeper snapshot and Raft tail containing pending shutdown and sibling commands.
    Impact: The supplied evidence does not establish that the current standard 4.2 release's persisted state replays and recovers correctly on this target. This is a required validation gap, not a demonstrated production failure.
    Evidence: The pinned upgrade contract requires a real artifact from the applicable verified release to be opened on the target, or equivalent evidence. The PR reports v4.2.8 replay and full-stop recovery for main; linked issue #33008 reports v4.2.9 replay and recovery for the different 4.2-dev counterpart. The exact v4.2.9 tag and a v4.2.9-to-this-head replay are absent from the supplied artifacts. Provide or reuse traceable v4.2.9 full-stop upgrade evidence on this target, including the snapshot and tail with pending shutdown and sibling work, recovery, and reads and new writes.

Validation:

  • Private /tmp and loopback preflight passed; receipt checks/1795686087991723301-2.json.

  • Race tests passed for 11 HAKeeper packages and the LogService protobuf package with -short; log hakeeper-race.log and receipt checks/1795686374370540128-2.json.

  • Six focused LogService recovery tests using local Raft nodes passed under the race detector; log logservice-recovery-race.log and receipt checks/1795686690019896978-2.json.

  • Focused TN heartbeat and transaction-write tests passed under the race detector; log tn-write-race.log and receipt checks/1795687080742013435-2.json.

  • Native build inputs matched the reviewed source index, and git diff --check passed. The command, source, exit and log audit is recorded in review-validation.json.

Limitations:

  • The reported v4.2.8 main-branch and v4.2.9 4.2-dev release runs were not independently reproduced from retained logs in this review.

  • A reviewer diagnostic probe found that acknowledged delivery can retain an obsolete initial-bootstrap entry for a permanently absent store. No material impact beyond the retained entry was established; the probe and its failing expectation are retained in bootstrap-retirement-probe.log.

@XuPeng-SH

XuPeng-SH commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: cffd1e55791360513323606db5dde2028afda3c2

{"message": "This content was flagged for possible cybersecurity risk. If this seems wrong, try rephrasing your request. If you\u2019re doing authorized security work that requires more cyber permissive safeguards, apply for Daybreak access via https://platform.openai.com/settings/organization/status-and-access before retrying.", "codexErrorInfo": "cyberPolicy", "additionalDetails": null, "misalignment": null}

@XuPeng-SH

XuPeng-SH commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: e9aa3d6b6572a48a1ea244123b11d0ed58cdcc71

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: e9aa3d6b6572a48a1ea244123b11d0ed58cdcc71

Assessment: approve

The recovery changes address the reported shutdown loop and the prior concerns about tentative replica retirement, lost bootstrap replies, and stale queued membership changes. The design reuses the scheduler and replicated command state; retained bootstrap manifests and committed timeout policy support retry and deterministic replay. The separate post-delivery Raft reconfiguration boundary remains tracked in issues #33062 and #33067.

Model: gpt-6.1-terra / max

Session: 01a21a72-1486-7ab1-8684-6ee66672b7e4 · slot 0 · generation 20

Validation:

  • At the assigned head, preflight and focused HAKeeper, LogService, TN, and Disttae tests passed using the supplied isolated executor. The LogService selection included disk-backed replica recovery and lost bootstrap replies with local Raft voters.

  • An independent RSM probe exercised timeout-policy transitions, and git diff --check passed. Commands, source fingerprints, exit statuses, and retained logs are reconciled in validation-audit.json.

  • A grouped LogService recovery selection also passed under race instrumentation at the earlier 533c293 head. The relevant recovery implementation is unchanged, although some upstream dependencies subsequently changed.

  • All 56 discussion keys are accounted for in discussion-assessment.json.

Limitations:

  • The v4.2.9 snapshot/tail replay and full-stop SQL upgrade were reported by the author at cffd1e5; they were not independently rerun at the assigned head. The later upstream integration changed transaction serialization.

  • The timeout-policy probe exercised the replicated state machine rather than an actual leader election. It showed that the previously committed expiry policy remains effective until the new term's first policy tick, consistent with the PR's stated committed-policy boundary.

  • The frozen local refs did not establish whether a post-v4.2.9 hotfix exists.

This branch had an error being deployed

1 failed deployment
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