Repository navigation
refactor: group Raft identity, topology and consistency flags (M2 part 6) - #1442
Merged
Merged
Conversation
Move --address, --raftId, --raftEngine and --raftDataDir into raftFlags; the Raft group, shard range, Raft-to-protocol address maps and the HT-FIFO partition map into topologyFlags; and --commitTSFence and --readWatermarkAdvance into consistencyFlags. The runtime-input resolvers take *serverFlags; the KEK pre-nonce guard, admin listener, raft gRPC servers, server runner and snapshot offload receive the values they need. The bootstrap and join flags stay package globals for a later part. No flag name, default or help text changes. Signed-off-by: bootjp <contact@bootjp.me>
Signed-off-by: bootjp <contact@bootjp.me>
|
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 7 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. |
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. |
Base automatically changed from
design/root-package-decomposition-m2e
to
main
November 12, 2026 15:20
bootjp
added a commit
that referenced
this pull request
Nov 12, 2026
…2) (#1443) Design: docs/design/2026_11_12_partial_root_package_decomposition.md M2 part 7, stacked on #1442. Retarget it to `main` once #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 from `main_bootstrap_launch.go` - `raftBootstrapConfig` gains `peerConfigDir` and `joinAsLearner`, set in `resolveRuntimeInputs`. They reach: - `loadProtectedBootstrapDomain` / `validateProtectedBootstrapDomain` / `loadGroupBootstrapSpec`: these take the dir explicitly. - The shard-group builder's protected-spec and protected-TSO checks. - `buildRuntimeForGroup`. - `buildDedicatedTSOGroup` / `buildProtectedDedicatedTSOGroup`: these gain a `joinAsLearner` parameter after `bootstrap`. - `serversInput.raftJoining` replaces the `--raftJoinMembers` read in the server runner. It is computed by `raftBootstrapFlags.joining()`, with the same trim semantics. - Tests: - The protected-bootstrap e2e fixtures (single-group, multi-node, TSO, rotation, offline encryption, recovery race, external rotation) pass the peer-config dir through `raftBootstrapConfig` and their start helpers. They no longer overwrite a process global. - The `require.Empty(*raftBootstrapPeerConfigDir)` leak guards are gone; there is no global left to leak. - The two launch tests now run `t.Parallel`. - `main_flags.go` has no package flag globals left. The design doc marks M2 implemented, and CLAUDE.md states the rule as settled. ## Behavior change None: - Flag names, defaults and help text are unchanged: `-help` output is identical to the base. - `bootstrap` is still `--raftBootstrap || anyBootstrapServers()`. - The protected path still turns on exactly when the peer-config dir is non-empty. ## 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` → `loadProtectedBootstrapDomain` and `shardGroupBuilder{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. - `-help` output: identical to the base binary. - Test list: identical apart from the new `TestRuntimeInputsCarryBootstrapFlagsIntoBootstrapConfig` and `TestRaftBootstrapFlagsJoining`. - Jepsen: not run. Nothing in replication, MVCC or OCC changed. The protected-bootstrap e2e suites above cover the touched start-up path. ## Self-review 1. **Data loss**: no write or apply path changes. Protected groups still refuse to open without the domain when a peer-config dir is set. 2. **Concurrency**: the values are immutable after parsing. Removing the global means bootstrap tests no longer race on shared state, and the launch tests can run in parallel. 3. **Performance**: start-up only. 4. **Consistency**: the commit-ts fence start-up check, protected-domain loading, the spec-presence checks and learner join all read the same parsed values as before. 5. **Test coverage**: new tests cover the flags → `raftBootstrapConfig` mapping and `joining()`. All protected-bootstrap e2e fixtures now build their config explicitly.
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 6. It is stacked on #1441, so retarget it to
mainonce #1441 merges. It moves the node identity, cluster topology and consistency rollout-gate flags out of package globals.Changes
raftFlags(main_runtime_config.go):--address,--raftId,--raftEngine,--raftDataDir.topologyFlags(main_runtime_config.go):--raftGroups,--shardRanges,--raftRedisMap,--raftS3Map,--raftDynamoMap,--raftSqsMap,--sqsFifoPartitionMap. The HT-FIFO comment moved onto the struct.consistencyFlags(main_commit_ts_fence.go):--commitTSFence,--readWatermarkAdvance.resolveNetworkRuntimeInputsandresolveValidatedRuntimeInputsnow take*serverFlags, so the parameter lists stop growing with each part.resolveRuntimeInputstakes the raft, topology and listener values.loadKEKAfterPreNonceStartupGuards: Raft ID and data dir.prepareAdminFromFlags: Raft ID.startRaftServers: Raft ID andreadWatermarkAdvance.distributionStartupInput: data dir.serversInput: node address and consistency flags.--raftBootstrap,--raftBootstrapMembers,--raftGroupPeers,--raftJoinMembers,--raftJoinAsLearner,--raftBootstrapPeerConfigDir). The protected-bootstrap e2e fixtures read or overwrite them deep inside group construction, so they get their own part.Behavior change
None. Flag names, defaults and help text are unchanged:
-helpoutput is identical to the base.Risk
Low. The values are read-only after parsing. Every former global read now gets the same value through a parameter or struct field.
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.TestRaftTopologyConsistencyFlagsDefaultsAndParsingandTestRuntimeInputsRequireRaftID.TestRuntimeInputsRejectCommitTSFenceBeforeOpeningStoresno longer overwrites a global and runst.Parallel.Self-review
readWatermarkAdvanceis still decided once per server build.--raftIdcheck. The commit-ts fence test now builds its flags explicitly.