Repository navigation
fix(hakeeper): retry pending TN start operators - #30445
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: 551cf104d8f48217db4e59d5ad07054a136c499d
Assessment: request_changes
Reviewed the complete delta and affected producer, delivery, receiver, and recovery paths. Retention belongs in the existing RSM queue, and the implementation adds bounded control-plane work without SQL-path changes. However, a reproduced snapshot-replay regression breaks replicated-state consistency even when all restarted replicas run the candidate.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
- P1
pkg/hakeeper/rsm.go:883: Upgrade two legacy-mode HAKeeper replicas whose old snapshots bracket a heartbeat that consumed an ordinary TN StartReplica. Recover both using the candidate and replay the remaining committed entries.
Impact: The replica replaying the heartbeat retains the start, while the replica restoring the later snapshot has no command. They reach the same committed index with different queues, and the existing ACK preparation barrier preserves that divergence. Command delivery consequently depends on which replica serves it. The documented version-coherent rollout assumption does not prevent this recovery failure. Introduce a deterministic activation/migration boundary that preserves historical replay semantics for both changed legacy paths.
Evidence: The diagnostic generated snapshots with the merge-base RSM. TestReviewUpgradedSnapshotReplayConverges passes with that RSM but fails with the candidate: pending queues are 1 versus 0 at index 2; after identical preparation, tick, and heartbeat entries, responses contain batch 4 with one command versus an empty batch. Retained probe-head.log, probe-base-control.log, overlays, snapshots, and recovery-evidence-manifest.json are under the assigned attempt directory.
Validation:
-
Verified the clean frozen head and all five changed files. Reconciled retained author patch fingerprints with the complete delta and the earlier four-file delta.
-
Audited retained successful race logs for HAKeeper/operator/TN checker, eleven TN consumer tests, 100 startup repetitions, and the extended poll-handoff test. These do not cover recovery from differently positioned old snapshots.
-
Isolation preflight passed. Built native prerequisites through make cgo from archived frozen inputs; verified those input bytes remained unchanged.
-
Executed isolated Go 1.27.1 recovery probes. Snapshot generation passed; base recovery control passed; candidate recovery failed. Check receipts 1792196915957597362-13.json, 1792196944737763061-13.json, and 1792196931665261693-12.json match the retained commands, overlays, logs, and outcomes.
Limitations:
-
The regression is demonstrated through production RSM snapshot/update entry points, not a live multi-node upgrade.
-
Frozen CI was pending. Empty retained native/vet/molint logs lacked independently available exit receipts and were not counted as passes.
-
Performance assessment was structural; no benchmark was run. Source remained unchanged.
|
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: 6bf0a556cbb66675be1ba1da38a0e46a52082c87
Assessment: request_changes
Reviewed all five changed files and affected producer, delivery, receiver, and recovery paths. Retention belongs in the existing RSM queue, with bounded control-plane overhead and no SQL-path changes. However, the previously reported snapshot-replay inconsistency remains reproducible with unchanged implementation inputs.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P1
pkg/hakeeper/rsm.go:883: Upgrade legacy-mode HAKeeper replicas whose old snapshots bracket a heartbeat that consumed an ordinary TN StartReplica. Recover both using the candidate and replay their remaining committed entries.
Impact: The earlier snapshot plus replay retains the start, while the later snapshot contains no command. Replicas reach the same committed index with different queues, and subsequent ACK preparation preserves that divergence. Command delivery depends on the serving replica even when every restarted replica runs the new binary. Gate both changed legacy retention paths behind a deterministic activation/migration boundary that preserves historical replay semantics.
Evidence: The retained probe uses production SaveSnapshot, RecoverFromSnapshot and Update entry points. Base replay passes; candidate replay produces pending counts 1 versus 0 at index 2. Identical preparation, tick and heartbeat entries then produce batch 4 with one command versus an empty batch. All five changed files, the complete pkg tree, module files and native inputs match the probed revision; the base RSM matches this merge-base. Evidence is retained in attempt-1/reused-evidence/probe-head.log, probe-base-control.log, recovery_probe_test.go and recovery-evidence-manifest.json.
Validation:
-
Verified the clean frozen head, complete delta, rejection gates, supersession rules, fresh-report completion, ACK handoff, snapshot handling and existing tests. Current snapshot tests do not cover historical replay from old snapshots.
-
Reconciled retained probe commands, overlays, source fingerprints, exit receipts and log contents: snapshot generation passed (1792196915957597362-13.json), base control passed (1792196944737763061-13.json), candidate recovery failed (1792196931665261693-12.json).
-
Verified 192 archived native input files against frozen Git objects and retained build inputs, plus the successful native build receipt and artifact hashes.
-
Current evidence audit passed under check-run: checks/1792198743935214380-4.json, evidence-audit.log and evidence-audit.json under /home/xupeng/.local/state/mo-bot/jobs/f0c23c8eda0ad1a366c29604/attempt-1. The superseded audit assertion failure was retained separately.
Limitations:
-
Reused completed probes with identical relevant inputs; no new Go test execution or live multi-node upgrade was performed.
-
Frozen CI remained pending. The linked issue's full body was not supplied; its behavioral contract was assessed from the PR description and source.
-
Performance assessment was structural; no benchmark was run. Source remained unchanged.
|
mo-bot review · Commit: PR closed or head changed |
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Refs #30443. Parallel main fix: #30445. ## What this PR does / why we need it: A lost committed heartbeat response or a later unrelated legacy scheduling batch can discard a TN startup command. The controller owns its unfinished operator but previously dispatched only fresh operators, delaying recovery until the initial-shard timeout. Retry the existing singleton TN-add operator on each healthy checker pass. Its checker owns placement reservations and termination by reported startup, target loss, cancellation, or teardown; it does not allocate another replica for a pending shard. Different-ID reports cancel stale intent. Other operator kinds retain their existing expiry policy. A TN retry also preserves currently desired Log work that the Log checker suppressed as already executing. The owner-local projection reuses the existing parser for voting/nonvoting add, remove, start, and bootstrap candidates. It checks current epochs, working targets, add-slot bounds, and partial bootstrap progress; main also reuses its existing storage-incarnation exclusion. It does not replay retained TN removals or unrelated one-shot commands. Existing Log/TN pointers are admitted and emitted once per retry cohort using temporary linear pointer sets; ordinary fresh batches keep their normal admission cost. The RSM matches the target base byte for byte. Historical heartbeat consumption and snapshot replay are preserved. No Raft, protobuf, activation protocol, persistent queue, timer, worker, or SQL-path change is introduced. The additional candidate parsing/temporary pointer sets run only when a registered TN start requests a retry. ### Validation Base: `e2c99334fd23b9260728695e29befd35ab26b454`; Linux/amd64, Go 1.26.4, matching branch native inputs. - Relevant owning packages passed normal UT and `go test -race -count=1`: coordinator/checkers, Log checker, operator; unchanged HAKeeper/TN-checker behavior retains matching-source prior normal/race evidence. - Real Coordinator → RSM → Log heartbeat regression covers pending TN, an already-running TN control, already-consumed Log response, and completion after a real report. The V2 mixed-service loss was reproduced before correction; clean 4.2 base passed its control. - Candidate tests cover all seven suppressed Log step kinds, stale membership/epoch/role, expired/missing targets, add-slot bounds, partial bootstrap, current-step progression, and terminal operations. Repeated cohorts retain one registration per pointer; obsolete TN removal is excluded. Main additionally checks changed storage incarnation and mixed Preparing/Enabled command identity. - Real LogService start/bootstrap/add/nonvoting-add/remove fixtures passed normal and race with duplicate deliveries. Existing matching-source TN receiver evidence covers duplicate/different-ID starts and cancellation/close. - Incremental SCA: **0 new issues** across all seven affected packages. `go vet` and `molint` passed for changed owning packages/receiver. Frozen historical snapshots still use unchanged RSM production code; prior recovery/replay evidence remains valid. - Unfiltered lint has four existing `prealloc` suggestions in unchanged `operator/builder.go`; the identical diagnostics were reproduced on the clean target base. They are not incremental findings. - Independent design and final overall review: `gpt-6.1-sol` / `xhigh`. Retries require eventual delivery and viable targets. Existing epoch checks and replica identity make eligible control-plane retries idempotent; this is not an exactly-once guarantee. The fix preserves the extra TN-retry batch, without redesigning historical replacement between unrelated fresh batches. Performance evidence is structural and bounded command/operator assertions; no SQL benchmark or live rolling-upgrade test was run. The original CI incident's precise lost-response mechanism remains unproven. CI was not rerun or waited on.
|
独立合并后实测:main 四个调度归属包完整普通/race、历史 RSM/ACK 控制、真实 TN/LogService 接收端及激活/取消/关闭控制实际通过。13 项精确 TN/Log/operator 回归分别 完整 SHA、工具链、命令、范围与限制:#30443 (comment) 已将 #30443 转给 Ariznawlll,并回读确认。此结论依赖健康 Coordinator 周期重发;不把未更改的 legacy RSM 历史消费语义误称为直接心跳保留,也不声称证明现场 CI 丢包原因、真实网络故障注入或混合二进制滚动升级。 |
What type of PR is this?
Which issue(s) this PR fixes:
Refs #30443. Parallel 4.2-dev fix: #30444.
What this PR does / why we need it:
A lost committed heartbeat response or a later unrelated legacy scheduling batch can discard a TN startup command. The controller owns its unfinished operator but previously dispatched only fresh operators, delaying recovery until the initial-shard timeout.
Retry the existing singleton TN-add operator on each healthy checker pass. Its checker owns placement reservations and termination by reported startup, target loss, cancellation, or teardown; it does not allocate another replica for a pending shard. Different-ID reports cancel stale intent. Other operator kinds retain their existing expiry policy.
A TN retry also preserves currently desired Log work that the Log checker suppressed as already executing. The owner-local projection reuses the existing parser for voting/nonvoting add, remove, start, and bootstrap candidates. It checks current epochs, working targets, add-slot bounds, and partial bootstrap progress; main also reuses its existing storage-incarnation exclusion. It does not replay retained TN removals or unrelated one-shot commands. Existing Log/TN pointers are admitted and emitted once per retry cohort using temporary linear pointer sets; ordinary fresh batches keep their normal admission cost.
The RSM matches the target base byte for byte. Historical heartbeat consumption and snapshot replay are preserved. No Raft, protobuf, activation protocol, persistent queue, timer, worker, or SQL-path change is introduced. The additional candidate parsing/temporary pointer sets run only when a registered TN start requests a retry.
Existing Preparing/Enabled ACK delivery remains the transport owner. Repeated mixed Log/TN proposals preserve equivalent pending command identities and queue bounds. Exact ACK retires TN work; a later retry receives a new identity until a real report arrives, and stale ACK cannot retire it.
Validation
Base:
65bcea5d24610dde1a21bb9f4dea1efd82a8ce50; Linux/amd64, Go 1.27.1, matching branch native inputs.go test -race -count=1: coordinator/checkers, Log checker, operator; unchanged HAKeeper/TN-checker behavior retains matching-source prior normal/race evidence.go vetandmolintpassed for changed owning packages/receiver. Frozen historical snapshots still use unchanged RSM production code; prior recovery/replay evidence remains valid.gpt-6.1-sol/xhigh.Retries require eventual delivery and viable targets. Existing epoch checks and replica identity make eligible control-plane retries idempotent; this is not an exactly-once guarantee. The fix preserves the extra TN-retry batch, without redesigning historical replacement between unrelated fresh batches. Performance evidence is structural and bounded command/operator assertions; no SQL benchmark or live rolling-upgrade test was run. The original CI incident's precise lost-response mechanism remains unproven. CI was not rerun or waited on.