Skip to content

mon/OSDMonitor: fix the stretch mode a 2-zone pool create enables - #47

Merged
aainscow merged 3 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-04-stretch-from-create
Oct 7, 2026
Merged

aainscow merged 3 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-04-stretch-from-create

Conversation

@aainscow

@aainscow aainscow commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Fourth PR split out of #43. It makes two fixes to the stretch mode that a --num-zones 2 pool create enables, and adds the design text for a pool created in degraded stretch mode.

  • doc/dev: ec_stretch_cluster: describe a pool created in degraded stretch mode. Section 11.4.3 describes the replicated pool that "mon/OSDMonitor: keep size and bucket target for a pool created in degraded stretch mode" (from mon: carry the stretch fixes proposed for main into stretchy-C #44) creates. The EC example table in section 11.6 is corrected: the transitions never change peering_crush_bucket_target, only the bucket count and the mandatory member.
  • mon/OSDMonitor: keep degraded stretch mode when a stretch EC pool is created.
    • Before: a --num-zones 2 create with a zone down went through try_enable_stretch_mode(), which reset degraded_stretch_mode to 0. Degraded mode ended without the healthy transition. The other pools kept the degraded values, and the lost zone's monitor stayed marked down, so losing the other zone left no quorum.
    • Now: the cluster's stretch state is written only when stretch mode is not already enabled. The new pool gets the degraded bucket count and mandatory member that the other pools have.
    • Test: TEST_ec_pool_create_in_degraded_stretch_mode in mon-stretch-ec-pool-create-degraded.sh. Without the fix it fails at its first check.
  • mon/OSDMonitor: enable stretch mode only once a pool create has passed every check.
    • Before: prepare_new_pool() committed monitor stretch mode before it validated the pool's stretch settings. A 2-zone create that failed a later check, such as unequal datacenter weights or FastEC support, left the monitors in stretch mode with a tiebreaker and connectivity elections.
    • Now: the settings are validated where they were, but applied at the end of prepare_new_pool().
    • Tests: TEST_failed_stretch_pool_create_leaves_mons in mon-stretch-failed-create-mons.sh, which fails without the fix, and TEST_failed_stretch_pool_create_leaves_no_pool in mon-stretch-failed-pool-create.sh, which relies on Jamie Pryde's rollback from mon: carry the stretch fixes proposed for main into stretchy-C #44.

Testing

  • This branch is stretchy-C ce9fcea with these three commits. On it, a full ninja -k 0 -j20 built with no errors or warnings, and unittest_mon_monmap passed 4/4 and unittest_osd_monitor passed 17/17.
  • The standalone tests need mon/OSDMonitor: read default_crush_zone_failure_domain by its name #48 underneath: without it, a --num-zones 2 create aborts the monitor. With PR 48 and this PR, mon-stretch-failed-create-mons.sh, mon-stretch-failed-pool-create.sh and mon-stretch-ec-pool-create-degraded.sh passed.
  • After review, both failed-create tests check the error they expect. TEST_failed_stretch_pool_create_leaves_no_pool names the existing replicated_rule, so it reaches the monitor stretch mode check after the pool is allocated, instead of failing earlier while building the stretch rule. TEST_ec_pool_create_in_degraded_stretch_mode checks that the new pool joins degraded stretch mode.
  • Without this PR's fix, TEST_failed_stretch_pool_create_leaves_mons failed: stretch mode was enabled. Without Jamie Pryde's rollback, TEST_failed_stretch_pool_create_leaves_no_pool failed, with the monitor aborting in ceph_assert(i != pool_name.end()). TEST_ec_pool_create_in_degraded_stretch_mode fails at its first check without its fix, from when the test was written.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

🤖 Generated with Claude Code

@github-actions github-actions Bot added core documentation Improvements or additions to documentation mon tests labels Oct 7, 2026
…tch mode

A replicated pool created in degraded stretch mode keeps its size and
bucket target and gets the degraded bucket count and halved min_size
that the existing stretch pools have, so the healthy transition
restores it with them, as "mon/OSDMonitor: keep size and bucket target
for a pool created in degraded stretch mode" (carried above) does.
Say so in section 11.4.3.

The stretch mode transitions never change peering_crush_bucket_target;
only the bucket count and the mandatory member change. Correct the
degraded and recovery rows of the EC example table in section 11.6 and
its bucket_max note.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-stretchy-C-pr43-04-stretch-from-create branch from edc8020 to 3f08d21 Compare October 7, 2026 11:59
…created

Creating a pool with --num-zones 2 configures it through
try_enable_stretch_mode(), which also wrote the cluster's stretch state
and set degraded_stretch_mode to 0. With a zone down this ended
degraded mode without the healthy transition: the other stretch pools
kept a bucket count of 1 and the surviving zone as mandatory member,
and the lost zone's monitor stayed in stretch_marked_down_mons, so it
could never lead. If the other zone then failed, the remaining monitor
and the tiebreaker could not form a quorum.

Write the cluster's stretch state only when stretch mode is not already
enabled. A pool joining a degraded stretch mode gets the degraded
bucket count and the surviving mandatory member that the other pools
have, so it can go active on the surviving zone and is restored with
them. Section 11.4.2 of the design says that a 2-zone pool created
while stretch mode is enabled configures only the new pool.

TEST_ec_pool_create_in_degraded_stretch_mode in
mon-stretch-ec-pool-create-degraded.sh creates a second stretch EC pool
with one zone down. It checks that the new pool joins degraded stretch
mode, with a bucket count of 1 and the surviving datacenter as its
mandatory member, and that the cluster stays in degraded mode. It then
brings the zone back, and checks that both pools are fully stretched
again and that losing the other zone still leaves a quorum. Without the
fix it fails at the first check. ec_stretch_cluster_without_dc2 in
mon-stretch-helpers.sh, which sets the test up, now checks the result
of its 'ceph osd down'.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…d every check

prepare_new_pool() committed monitor stretch mode before it validated
the pool's stretch settings. When that validation failed, for example
because the two datacenters differ in weight, or when a later check
failed, such as FastEC support for a multi-zone erasure pool, the
create failed but the monitors stayed in stretch mode with a tiebreaker
and connectivity elections.

Validate the monitor and pool stretch settings where they were, but
apply them at the end of prepare_new_pool(), after the remaining
checks. A failed create no longer leaves the monitors or the OSDMap in
stretch mode.

TEST_failed_stretch_pool_create_leaves_mons in
mon-stretch-failed-create-mons.sh makes a 2-zone EC create fail on the
weight check ("Failed to validate pool stretch mode") and expects the
monitors to stay out of stretch mode; it fails without the fix. A
later 'ceph osd set noout' orders the check after any monmap change
the failed create proposed. TEST_failed_stretch_pool_create_leaves_no_pool
in mon-stretch-failed-pool-create.sh covers the pool side of a failed
stretch create: a --num-zones 2 replicated create that fails because
stretch mode cannot be enabled for the monitors ("Failed to validate
monitor stretch mode"), after prepare_new_pool() has allocated the
pool, must leave the next pool create working. The create names the
existing replicated_rule, so it does not stop earlier at building a
stretch rule, which needs OSDs. That relies on "mon: Roll back
pending_inc on prepare_new_pool failure", carried from main: without
it, the next create aborts the monitor.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-stretchy-C-pr43-04-stretch-from-create branch from 3f08d21 to f165978 Compare October 7, 2026 13:50
@aainscow
aainscow marked this pull request as ready for review October 7, 2026 14:01
@aainscow
aainscow merged commit f2f2787 into stretchy-C Oct 7, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core documentation Improvements or additions to documentation mon tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant