Repository navigation
Conversation
Since multigres/multigres#1349, multiorch only initializes a shard whose initial cohort can lose any one pooler and still meet its durability policy. The resolver defaulted a single-cell pool to 2 poolers and a two-cell pool to 1 per cell, so those shards never got a primary. Default replicasPerCell to ceil(3 / cells), warn in the webhook when an explicit layout meets the policy but cannot bootstrap (judged by upstream consensus.CohortSurvivesAnyMemberLoss), and update the docs and tests that described 2 poolers as enough. Fixes multigres#684 Signed-off-by: Wan Nur Shafiqah <[email protected]>
shanurwan
force-pushed
the
fix/failure-safe-default-poolers
branch
from
November 26, 2026 04:30
c5afc28 to
de81fde
Compare
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.
Fixes #684.
Since multigres/multigres#1349, multiorch only initializes a shard whose initial cohort can lose any one pooler and still meet its durability policy. The resolver still defaulted a single-cell pool to 2 poolers and a two-cell pool to 1 per cell, so on main
config/samples/minimal.yamland a two-cell cluster with default pools never get a primary (initialized poolers (2) satisfy the durability policy but aren't failure-safe). Details and the repro are in #684. The e2e framework already works around this: 4b74406 ("test(e2e): use failure-safe minimal cohort") gives the synthetic default pool 3 replicas. This PR makes the product default match.Changes
pkg/resolver/shard.go,failure_safe.go): a pool withoutreplicasPerCellgetsceil(3 / cells): 3 in one cell, 2 per cell across two cells, and the existing 1 per cell from three cells up.pkg/resolver/validation.go): the existing durability warnings are unchanged. A new one fires only when none of them did and the layout still could not bootstrap. It asks upstreamconsensus.CohortSurvivesAnyMemberLossdirectly, so uneven layouts are judged the way multiorch judges them.failure_safe_test.go): checks, for both policies and 1–5 cells, that the default is failure-safe by the upstream function and that one fewer per cell is not. If the rule changes upstream again, this test fails instead of new shards silently staying uninitialized.pkg/cluster-handler/controller/multigresclusterintegration tests move from 2 to 3, andtest/suite's child-CR thrash scenario now expectsMinFailureSafePoolers - 1replicas fromMinimalClusterinstead of 1.test/suite's shard-lifecycle scenario sets 2 replicas explicitly and keeps itsshard-lifecycle-two-member-pool-never-rollspin; I only changed the comments that called 2 the resolver's default. That pin says it expires "if the single-cell default moves off 2", so with this change a default single-cell pool is no longer that shape: the same scenario's later resource change, on three members, rolls without a pin. An explicitreplicasPerCell: 2still cannot roll.docs/durability-policy.md,config/samples/README.md,docs/development/pod-management-design.mdanddocs/development/reconcile-gating.mdstill described 2 poolers as enough. CHANGELOG gets a Bug Fixes entry and a Breaking entry (below).Upgrade behaviour
Clusters admitted through the webhook without templates have
replicasPerCellstored in the spec, so they keep their current count. A pool resolved from a ShardTemplate withoutreplicasPerCellpicks up the new default on operator upgrade. On K3s with a patched build, such a cluster scaled from 2 to 3 poolers and its stuck shard went Healthy in about 30 s. Already-healthy clusters of that kind also gain a pooler and a PVC, hence the Breaking entry.Testing
go test(unit),go test -tags=integrationwith envtest 1.35, andtest/suite(run with-v, as the Makefile does): all pass; the suite's existing KnownDefect pins report as before. golangci-lint v2.14.0 on the touched packages: 0 issues. e2e (kind) not run.Before/after on K3s v1.35.10 (single node), default pools, no templates:
FATAL: database is temporarily unavailableFATAL: database is temporarily unavailableOn main, multiorch logs
initialized poolers (2) satisfy the durability policy but aren't failure-safein both cases.Notes for review
durabilityPolicyProtoinfailure_safe.gomirrorsbuildDurabilityPolicyinpkg/data-handler/topo. I kept it local to avoid a new import between the resolver and data-handler; happy to move it to a shared package instead.--allow-unsafe-initial-cohort, but upstream marks it test-only, so this PR does not use it.