blockmaster: --expected-slots-per-volume flag (was hardcoded 3)

cmd/blockmaster/main.go hardcoded ExpectedSlotsPerVolume: 3 in the
TopologyControllerConfig. The TopologyController's
validateVolumeTopology rejects every observation snapshot whose
slot count differs from this value, returning an error from
SubmitObservedState that propagates back to the observation host
without a master-log line.

Result with a 2-node smoke topology (m01-primary + m02-replica):
master is silent, no assignments minted, volumes timeout at
durable open with frontend.ErrNotReady — the symptom QA hit
during G5-4 cross-node bring-up.

Fix: add --expected-slots-per-volume CLI flag, default 3
(production RF=3 unchanged). 2-node smoke clusters pass
--expected-slots-per-volume 2.

Long-term refactor (separate ticket): the validator should
compare snapshot slot count against the topology's per-volume
slot count, not a single global config — that's the real
per-volume RF model.

Refs: sw-block/design/v3-phase-15-g5-m0102-bringup-answer.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 4.7 committed 2026-04-26 10:37:13 -07:00
1 parent 6ce708bb64
commit 02fdb71c7d
1 file changed
+6 -4
+6 -4
View File
@@ -19,9 +19,10 @@ import (
)
type flags struct {
authorityStore string
listen string
topology string
authorityStore string
listen string
topology string
expectedSlotsPerVol int
// printReadyLine: test-only flag that emits a single
// structured JSON line to stdout after the gRPC listener is
// bound, so L2 subprocess tests can parse the ready event.
@@ -35,6 +36,7 @@ func parseFlags(args []string) (flags, error) {
fs.StringVar(&f.authorityStore, "authority-store", "", "durable authority store directory (required)")
fs.StringVar(&f.listen, "listen", "127.0.0.1:0", "gRPC listen address (e.g. 127.0.0.1:9180)")
fs.StringVar(&f.topology, "topology", "", "path to accepted-topology YAML (required for assignment to mint)")
fs.IntVar(&f.expectedSlotsPerVol, "expected-slots-per-volume", 3, "RF/expected slot count per volume; the controller rejects observation snapshots whose slot count differs (default 3, set to 2 for 2-node smoke clusters)")
fs.BoolVar(&f.printReadyLine, "t0-print-ready", false, "internal test-only: emit one structured JSON line on stdout after listener bound")
fs.SetOutput(os.Stderr)
if err := fs.Parse(args); err != nil {
@@ -79,7 +81,7 @@ func run(f flags) int {
Listen: f.listen,
Topology: topo,
Freshness: authority.FreshnessConfig{FreshnessWindow: 30 * time.Second, PendingGrace: 1 * time.Second},
ControllerConfig: authority.TopologyControllerConfig{ExpectedSlotsPerVolume: 3},
ControllerConfig: authority.TopologyControllerConfig{ExpectedSlotsPerVolume: f.expectedSlotsPerVol},
}
h, err := master.New(cfg)
if err != nil {