Skip to content

mon: carry the stretch fixes proposed for main into stretchy-C - #44

Merged
aainscow merged 15 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-01-carry-main
Oct 7, 2026
Merged

aainscow merged 15 commits into
stretchy-Cfrom
wip-stretchy-C-pr43-01-carry-main

Conversation

@aainscow

@aainscow aainscow commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Carries four fix series that are proposed for main into stretchy-C. The stretchy-C monitor fixes split out of #43 build on them, and follow in separate PRs.

The commits are the ones proposed for main. Each of Alex's commits gains a first paragraph saying where it is carried from, and that it drops when stretchy-C is rebased onto a main that has it. Jamie Pryde's fix is byte-identical; the test before it carries the note for both.

The later PRs need:

  • "qa/standalone: split activate_mon out of run_mon" and the degraded-mode create fix, for the test of a stretch EC pool created in degraded stretch mode.
  • Jamie's rollback, for the test of a failed 2-zone pool create, which otherwise crashes the monitor.
  • "mon/OSDMonitor: refuse stretch set and unset while stretch mode is enabled", which the refusal of both commands while multi-zone pools exist builds on.
  • "mon/OSDMonitor: refuse to stretch an erasure coded pool", before the follow-up that removes the EC refusal of "mon: Prevent osd pool stretch set for EC".

When stretchy-C is next rebased onto a main that has these, twelve drop by patch-id. Three must be dropped by hand:

  • "mon/OSDMonitor: keep size and bucket target for a pool created in degraded stretch mode" has the same lines as main's version, but different hunk context.
  • "doc: stretch pools must be replicated" and "doc: stretch pool commands fail while stretch mode is enabled" edit stretchy-C's story 4a in the design doc, which says "num_zones > 1" where main says "zones > 1".

Testing

  • This branch is stretchy-C abaef77 with these 15 commits. They were rebased unchanged from stretchy-C 0ef148d (git range-diff shows every commit identical); abaef77 adds Callum James's six commits.
  • On this branch, a full ninja -k 0 -j20 built with no errors or warnings. unittest_mon_monmap passed 2/2 and unittest_osd_monitor passed 17/17.
  • The rest of the testing below was done before the rebase, on 0ef148d.
  • Eleven of the 15 commits match their main version by patch-id. The other four are the three listed above and the failed-create test, which is not on main.
  • The standalone tests ran once, one script at a time, at the tip of the whole split (this PR and the 11 that follow it). All 15 qa/standalone/mon-stretch scripts passed, among them mon-stretch-commands.sh (4 tests) and mon-stretch-pool-create-degraded.sh from this PR.
  • mon/osd-pool-create.sh passed 19/19, including this PR's TEST_failed_pool_create_leaves_no_pool. crush/crush-stretch.sh (9 tests), mon/osd-crush.sh (9 tests) and ceph-helpers.sh's test_run_mon and test_activate_mon passed. There were no cores.

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
aainscow and others added 15 commits October 7, 2026 12:02
…aying half size

Carried from ceph/ceph PR 72381 (branch
wip-stretch-degraded-pool-create); drop when stretchy-C is rebased onto
a main that has it.

A replicated pool created while the cluster is in degraded stretch mode
is given half the stretch pool size and a peering_crush_bucket_target
of 1. The return to healthy stretch mode restores only the bucket count
and min_size, so once the lost site is back the pool has size 2 and
min_size 2: the stretch rule puts both replicas in one zone, a bucket
count of 2 cannot be met, and every PG stays clean+peered.

Create a pool in degraded stretch mode, write to it, bring the site
back and expect the pool to match the other stretch pool and go clean.
This fails on the size check.

Fixes: https://tracker.ceph.com/issues/81390
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…raded stretch mode

Carried from ceph/ceph PR 72381 (branch
wip-stretch-degraded-pool-create); drop when stretchy-C is rebased onto
a main that has it.

Entering degraded stretch mode lowers each stretch pool's bucket count
to the surviving bucket count, sets the mandatory member and halves
min_size. Size and peering_crush_bucket_target are left alone, and
trigger_healthy_stretch_mode() undoes exactly those changes.

A pool created during degraded mode also had its size and bucket target
halved, which nothing restores. Apply only the changes the existing
pools get, so the healthy transition brings the new pool back to the
full stretch size with the others.

Fixes: https://tracker.ceph.com/issues/81390
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-failed-pool-create, together with Jamie
Pryde's "mon: Roll back pending_inc on prepare_new_pool failure" from
ceph/ceph PR 71130, which follows unchanged; drop both when stretchy-C
is rebased onto a main that has them.

prepare_new_pool() adds the new pool to pending_inc before it has
finished checking the request. If a later check fails, for example a
crimson erasure pool whose profile does not support EC optimizations,
the pool stays in pending_inc without a name. The next proposal then
asserts in OSDMap::get_pool_name() from OSDMap::check_health():

  osd/OSDMap.h: 1437: FAILED ceph_assert(i != pool_name.end())

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Any error return in prepare_new_pool() after the new pool has been
inserted into pending_inc.new_pools and pending_inc.new_pool_max has
been incremented, but before pending_inc.new_pool_names is set, leaves
pending_inc in an inconsistent state: the pool ID is present in
new_pools but absent from new_pool_names.

On the next encode_pending() call, apply_incremental() adds the unnamed
pool to tmp.pools but not to tmp.pool_name. check_health() then
iterates pools and calls get_pool_name() on the unnamed ID, hitting
ceph_assert(i != pool_name.end()) and crashing the monitor.

Fix with a make_scope_guard() that erases the pool from
pending_inc.new_pools and decrements pending_inc.new_pool_max on
scope exit. The guard is dismissed once new_pool_names is set, so any
error return between pool allocation and name assignment automatically
triggers rollback without requiring explicit cleanup at each site.

Fixes: https://tracker.ceph.com/issues/79574
Signed-off-by: Jamie Pryde <[email protected]>
Assisted-by: IBM Bob 2.0.2
Signed-off-by: Alex Ainscow <[email protected]>
Carried from ceph/ceph PR 72378 (branch wip-monc-ping-uaf); drop when
stretchy-C is rebased onto a main that has it.

ping_monitor() deletes its temporary messenger while its ConnectionRef
is still in scope, so the last reference goes when the function returns
and ~AsyncConnection then reads async_msgr->cct from the freed messenger.
With cephx, "ceph ping mon.X" segfaulted in 164 of 180 attempts on a
vstart cluster:

  SubsystemMap::should_gather
  AsyncConnection::~AsyncConnection
  MonClient::ping_monitor
  librados::RadosClient::ping_monitor

Release the connection before shutting the messenger down. After this,
180 pings had no crashes.

Fixes: https://tracker.ceph.com/issues/81400
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

run_mon always runs ceph-mon --mkfs before it starts the daemon, so a
test that kills a monitor and starts it again on its existing data has
to repeat the arguments run_mon gives ceph-mon.

Move the command that starts the daemon into activate_mon, as
activate_osd does for OSDs, and call it from run_mon after --mkfs.
test_activate_mon restarts a monitor with an extra option.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

Stretch mode on main supports replicated pools only: enable_stretch_mode
refuses a cluster with erasure coded pools, and pool creation refuses
them once stretch mode is on. 'ceph osd pool stretch set' does not check
the pool type, so it turns an erasure coded pool into a stretch pool,
and 'ceph osd pool stretch unset' then applies whatever size it is
given, for example size 6 to a k=2 m=1 pool.

Add mon-stretch-commands.sh for the stretch pool and stretch mode
commands, with a test on 3 mons and no OSDs that expects stretch set on
an EC pool to fail and the pool's size and min_size to stay as created,
and a replicated pool as the control. Only stretch set is checked: with
a fixed monitor no EC pool can be made a stretch pool, so the size check
of stretch unset cannot be set up, and the test only expects unset to
find no stretch pool.
TEST_stretch_set_ec_pool fails on the current code.

Fixes: https://tracker.ceph.com/issues/81427
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

Stretch mode on main supports replicated pools only, but 'ceph osd pool
stretch set' accepted an erasure coded pool, and 'ceph osd pool stretch
unset' then applied any size to it (a k=2 m=1 pool became size 6).

stretch set now refuses an erasure coded pool with -EINVAL, worded as
enable_stretch_mode words the same refusal.

stretch unset can then only meet an erasure coded pool that an older
mon stretched. Refusing it outright would leave no way to clear the
stretch values, so it accepts such a pool only with size k+m and
min_size between k and k+m, which also repairs a size the old stretch
set changed, and refuses anything else with -EINVAL.

Fixes: https://tracker.ceph.com/issues/81427
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

Say in doc/rados that 'ceph osd pool stretch set' refuses erasure-coded
pools, and what 'ceph osd pool stretch unset' needs to clear an
erasure-coded pool that an older release made a stretch pool.

The EC stretch cluster design said that stretch set works for any pool
type and that stretch unset needs no EC-specific changes. Say that
stretch set refuses EC pools and which EC pools stretch unset accepts,
and that allowing EC pools with zones > 1 must relax that refusal and
let the unset size check allow zones x (K+M).

Fixes: https://tracker.ceph.com/issues/81427
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…ch mode

Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

'ceph osd pool stretch set' and 'ceph osd pool stretch unset' configure
an individual stretch pool, which doc/rados/operations/stretch-mode.rst
offers as the alternative to stretch mode. Stretch mode manages the
pools' stretch values itself: enable_stretch_mode sets them, and the
degraded and healthy transitions change them. The monitor nevertheless
accepts both commands while stretch mode is enabled. For example, stretch
set run in degraded stretch mode gives the pool the healthy bucket count,
so its PGs stay peered until the lost zone returns.

Add a test to mon-stretch-commands.sh that enables stretch mode with 3
mons and 4 OSDs in two zones and expects stretch set and stretch unset
to fail and to leave the pool's bucket count, crush rule and size alone.
Stretch set succeeds on the current code.

Fixes: https://tracker.ceph.com/issues/81428
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…abled

Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

'ceph osd pool stretch set' and 'ceph osd pool stretch unset' configure
an individual stretch pool, the alternative to stretch mode, but the
monitor accepted both while stretch mode was enabled. Stretch mode sets
the pools' stretch values itself and changes them in its degraded and
healthy transitions, and a pool changed by hand does not follow them:
stretch set in degraded stretch mode gave the pool the healthy bucket
count, so its PGs stayed peered until the lost zone returned.

Refuse both commands with -EINVAL while stretch mode is enabled.

Fixes: https://tracker.ceph.com/issues/81428
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

Say in doc/rados that 'ceph osd pool stretch set' and 'ceph osd pool
stretch unset', which configure individual stretch pools, fail while
stretch mode is enabled.

Say the same in the EC stretch cluster design, and that allowing EC
pools with zones > 1 must relax this refusal as well.

Fixes: https://tracker.ceph.com/issues/81428
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…iming to act when it cannot

Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

'ceph osd force_healthy_stretch_mode' only ends recovery stretch mode,
but in healthy or degraded stretch mode it does nothing and still
replies "Triggering healthy stretch mode" with success, so an operator
who runs it before the cluster is recovering believes it took effect.

Add a test to mon-stretch-commands.sh that expects the command to fail
in healthy and in degraded stretch mode, and to return the cluster to
healthy stretch mode once it is recovering. Zone pze is lost by killing
its mon and OSDs and restored by starting them again with activate_mon
and activate_osd. The command succeeds in healthy stretch mode on the
current code.

Fixes: https://tracker.ceph.com/issues/81429
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
…tch mode

Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

'ceph osd force_healthy_stretch_mode' only ends recovery stretch mode.
In healthy or degraded stretch mode, or without stretch mode, it did
nothing and still replied "Triggering healthy stretch mode" with
success.

Refuse it with -EINVAL and say that the cluster is not in recovery
stretch mode, before asking for --yes-i-really-mean-it.
force_recovery_stretch_mode has no such check to follow.

Fixes: https://tracker.ceph.com/issues/81429
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Carried from branch wip-mon-stretch-command-fixes for ceph/ceph main;
drop when stretchy-C is rebased onto a main that has it.

Say that 'ceph osd force_healthy_stretch_mode' fails unless the cluster
is in recovery mode.

Fixes: https://tracker.ceph.com/issues/81429
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-stretchy-C-pr43-01-carry-main branch from 1c78333 to 2d58245 Compare October 7, 2026 11:02
@aainscow
aainscow marked this pull request as ready for review October 7, 2026 11:05
@aainscow
aainscow merged commit f0d2745 into stretchy-C Oct 7, 2026
4 of 5 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.

2 participants