Repository navigation
refactor: group Raft bootstrap and join flags (M2 part 7, completes M2) - #1443
Merged
Merged
Conversation
Move --raftBootstrap, --raftBootstrapMembers, --raftGroupPeers, --raftJoinMembers, --raftJoinAsLearner and --raftBootstrapPeerConfigDir into raftBootstrapFlags. The peer-config dir and the learner expectation travel in raftBootstrapConfig to protected-domain loading and the shard-group builder, including both dedicated TSO group builders. The protected-bootstrap e2e fixtures pass the peer-config dir instead of overwriting a process global; the launch tests now run in parallel. The root package no longer registers any flag as a package global. No flag name, default or help text changes. Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Base automatically changed from
design/root-package-decomposition-m2f
to
main
November 12, 2026 15:44
bootjp
added a commit
that referenced
this pull request
Nov 12, 2026
## Root cause `TestSQSFIFODelayMultiGroupPrimaryReplyLoss` asserted `f.groups[2].Engine.Status().AppliedIndex >= index` right after the HTTP call returned. In the etcd engine, `Status()` returns a cached snapshot that `refreshStatus()` updates only after the whole Ready batch has been processed. The apply path calls `setApplied(index)` and then `resolveProposal(...)` (`engine_normal_apply.go`, `publishNormalApply`), so the Commit waiter, and the HTTP response, can return before the cached status reflects the entry. CI (`test shard (adapter)`, `-race`) hit this on #1443: cached applied 39 vs commit index 40. The FSM had applied the entry. Only the status snapshot lagged. ## Fix Assert against the engine's atomic `AppliedIndex()` (`raftengine.LeaseProvider`), which advances before the proposal resolves. The check is still exact, with no polling and no timeout, and it proves the same thing: the dropped primary COMMIT was applied on group 2. The later reads in the test (`Store.GetAt` on group 2 for the primary key and the rewritten message records) read the Pebble store directly. That store is written by the FSM before `setApplied`, so they never depended on the cached status and need no change. ## Behavior change / risk Test-only. No production code changes. ## Test evidence - `go test -race -count=50 -run 'TestSQSFIFODelayMultiGroupPrimaryReplyLoss$' ./adapter/`: ok (115s, 50/50) - `golangci-lint run ./adapter/`: 0 issues ## Self-review 1. Data loss: test-only, n/a. 2. Concurrency: removes a read of a lagging cache. The atomic is published before the proposal resolves, so this is ordered. 3. Performance: n/a. 4. Consistency: the assertion is unchanged in strength: applied index >= the commit index of the primary. 5. Coverage: same assertions, now deterministic. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **テスト** * FIFO遅延メッセージの複数グループ処理に関するテストで、適用状態の確認方法を更新しました。 <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Design: docs/design/2026_11_12_partial_root_package_decomposition.md
M2 part 7, stacked on #1442. Retarget it to
mainonce #1442 merges. This is the last M2 part: after it, the root package registers no flag as a package global.Changes
raftBootstrapFlags(main_raft_peers.go) holds:--raftBootstrap--raftBootstrapMembers--raftGroupPeers--raftJoinMembers--raftJoinAsLearner--raftBootstrapPeerConfigDir, which moved here frommain_bootstrap_launch.goraftBootstrapConfiggainspeerConfigDirandjoinAsLearner, set inresolveRuntimeInputs. They reach:loadProtectedBootstrapDomain/validateProtectedBootstrapDomain/loadGroupBootstrapSpec: these take the dir explicitly.buildRuntimeForGroup.buildDedicatedTSOGroup/buildProtectedDedicatedTSOGroup: these gain ajoinAsLearnerparameter afterbootstrap.serversInput.raftJoiningreplaces the--raftJoinMembersread in the server runner. It is computed byraftBootstrapFlags.joining(), with the same trim semantics.raftBootstrapConfigand their start helpers. They no longer overwrite a process global.require.Empty(*raftBootstrapPeerConfigDir)leak guards are gone; there is no global left to leak.t.Parallel.main_flags.gohas no package flag globals left. The design doc marks M2 implemented, and CLAUDE.md states the rule as settled.Behavior change
None:
-helpoutput is identical to the base.bootstrapis still--raftBootstrap || anyBootstrapServers().Risk
Low to moderate. The values are read-only after parsing. The one thing to check is that every production path into group construction carries
bootstrapCfg. It does:run()→buildShardGroupsWithEncryptionWiring→buildShardGroups→loadProtectedBootstrapDomainandshardGroupBuilder{bootstrapCfg}. That is the only production path.Test evidence
go test -race -count=1 .: ok (229s).golangci-lint: 0 issues.scripts/check-production-imports.sh: ok.-helpoutput: identical to the base binary.TestRuntimeInputsCarryBootstrapFlagsIntoBootstrapConfigandTestRaftBootstrapFlagsJoining.Self-review
raftBootstrapConfigmapping andjoining(). All protected-bootstrap e2e fixtures now build their config explicitly.