Repository navigation
mon/OSDMonitor: add missing checks to the stretch pool and stretch mode commands - #72416
Conversation
Ericmzhang
left a comment
There was a problem hiding this comment.
Agree with the changes. Need to squash commits and add signed-off-by.
4066bb2 to
5fae34f
Compare
6583a08 ("mon: Prevent osd pool stretch set for EC", #41) made ceph osd pool stretch set refuse EC pools: an EC pool is stretched and unstretched with ceph osd pool set <pool> num_zones <n>, which works out the rule, size, min_size, peering values and nonprimary_shards from the zone count. 8b30768 ("mon: add per-zone replica configuration for stretch pools", #35), written before that change and merged after it, brought back the older EC branch. stretch set has accepted a FastEC pool again since, while doc/rados/operations/pools.rst still says it is for replicated pools only. stretch set now refuses every EC pool again, with the message of 6583a08. stretch unset refuses an EC pool with num_zones > 1 and points to num_zones 1. It accepts an EC pool with one zone only with size k+m and min_size from k to k+m, as main does (ceph#72416), because only an older release's stretch set could have stretched such a pool. That check is OSDMonitor::check_stretch_unset_ec(), which has unit tests. The design (Sections 2.1.5 and 11.4.1) now states this and why, and pools.rst says what stretch unset does with an EC pool. stretch set no longer needs its own refusal of EC pools before the upgrade commit, and the nonprimary_shards updates in stretch set and unset go, because no multi-zone EC pool reaches them. Tests: TEST_stretch_set_ec_pool in mon-stretch-commands.sh, and the pre-commit stretch set check in mon-stretch-upgrade.sh expects the new message. Assisted-by: Claude Code
|
This PR has been added to wip-yuri10-testing-20261012.162444-main. |
| ``stretch_unset`` clears all ``peering_crush_*`` fields. No EC-specific | ||
| changes required. | ||
| ``stretch_unset`` clears all ``peering_crush_*`` fields. It accepts an EC | ||
| pool only with ``size`` ``k+m`` and ``min_size`` between ``k`` and ``k+m``, |
There was a problem hiding this comment.
Isn’t size k+ m by definition? I may misunderstand the intent here.
There was a problem hiding this comment.
In stretch cluster size = num_zones * (k+m). This will make more sense in the wider context of this design. I am removing design changes from this PR and moving them to the main stretch cluster PR.
There was a problem hiding this comment.
Does this end up with higher space amp than replication?
| stretch set/unset`` on EC pools with ``zones > 1``. Add EC-specific | ||
| ``min_size`` range validation (Section 11.4.1). | ||
| stretch set/unset`` on EC pools with ``zones > 1``. Both refusals in | ||
| Section 11.4.1, of EC pools and while stretch mode is enabled, must be |
There was a problem hiding this comment.
What are these section numbers?
There was a problem hiding this comment.
I am taking the design docs out of this PR, they belong in the main stretch cluster PR instead. The changes will not be lost, but need to be seen in the wider context.
I will also stop the document from referring to manually-constructed section numbers which will clearly get out of date.
6583a08 ("mon: Prevent osd pool stretch set for EC", #41) made ceph osd pool stretch set refuse EC pools: an EC pool is stretched and unstretched with ceph osd pool set <pool> num_zones <n>, which works out the rule, size, min_size, peering values and nonprimary_shards from the zone count. 8b30768 ("mon: add per-zone replica configuration for stretch pools", #35), written before that change and merged after it, brought back the older EC branch. stretch set has accepted a FastEC pool again since, while doc/rados/operations/pools.rst still says it is for replicated pools only. stretch set now refuses every EC pool again, with the message of 6583a08. stretch unset refuses an EC pool with num_zones > 1 and points to num_zones 1. It accepts an EC pool with one zone only with size k+m and min_size from k to k+m, as main does (ceph#72416), because only an older release's stretch set could have stretched such a pool. That check is OSDMonitor::check_stretch_unset_ec(), which has unit tests. The design (Sections 2.1.5 and 11.4.1) now states this and why, and pools.rst says what stretch unset does with an EC pool. stretch set no longer needs its own refusal of EC pools before the upgrade commit, and the nonprimary_shards updates in stretch set and unset go, because no multi-zone EC pool reaches them. Tests: TEST_stretch_set_ec_pool in mon-stretch-commands.sh, and the pre-commit stretch set check in mon-stretch-upgrade.sh expects the new message. Assisted-by: Claude Code
6583a08 ("mon: Prevent osd pool stretch set for EC", #41) made ceph osd pool stretch set refuse EC pools: an EC pool is stretched and unstretched with ceph osd pool set <pool> num_zones <n>, which works out the rule, size, min_size, peering values and nonprimary_shards from the zone count. 8b30768 ("mon: add per-zone replica configuration for stretch pools", #35), written before that change and merged after it, brought back the older EC branch. stretch set has accepted a FastEC pool again since, while doc/rados/operations/pools.rst still says it is for replicated pools only. stretch set now refuses every EC pool again, with the message of 6583a08. stretch unset refuses an EC pool with num_zones > 1 and points to num_zones 1. It accepts an EC pool with one zone only with size k+m and min_size from k to k+m, as main does (ceph#72416), because only an older release's stretch set could have stretched such a pool. That check is OSDMonitor::check_stretch_unset_ec(), which has unit tests. The design (Sections 2.1.5 and 11.4.1) now states this and why, and pools.rst says what stretch unset does with an EC pool. stretch set no longer needs its own refusal of EC pools before the upgrade commit, and the nonprimary_shards updates in stretch set and unset go, because no multi-zone EC pool reaches them. Tests: TEST_stretch_set_ec_pool in mon-stretch-commands.sh, and the pre-commit stretch set check in mon-stretch-upgrade.sh expects the new message. Assisted-by: Claude Code
|
Approved, but @anthonyeleven 's comments were unaddressed. cc @aainscow |
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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81427 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
…abled '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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81428 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
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]>
…tch mode '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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81429 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
I am removing all design changes. They did not belong here. |
5fae34f to
3554f6a
Compare
Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81427 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
…de is enabled Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81428 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Carried from ceph#72416; drop when this 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]>
…ery stretch mode Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81429 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
|
@aainscow can you please check the output of the test in /a/yuriw-2026-10-12_20:51:29-rados-wip-yuri10-testing-20261012.162444-main-distro-default-trial/630129/teuthology.log
|
|
@aainscow ignore that, this is issue with other pr that was already merged |
|
@aainscow this is ready for merge |
Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81427 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
…de is enabled Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81428 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Carried from ceph#72416; drop when this 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]>
…ery stretch mode Carried from ceph#72416; drop when this 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. This also adds the qa/standalone test that shows the defect and updates the documentation. Fixes: https://tracker.ceph.com/issues/81429 Assisted-by: Claude Code Signed-off-by: Alex Ainscow <[email protected]>
Three defects in the stretch pool and stretch mode monitor commands, found while testing stretch erasure coded pools on a development branch and shown on a main build:
ceph osd pool stretch setaccepted an erasure-coded pool, although stretch pools must be replicated (ceph mon enable_stretch_moderefuses EC pools).stretch setandceph osd pool stretch unsetthen applied whatever size they were given: a k=2 m=1 pool became size 6, whichceph osd pool set sizerefuses for an EC pool.stretch setnow refuses an EC pool, with the messageenable_stretch_modeuses.stretch unsetcan then only meet an EC pool that an older release stretched. Refusing it would leave no way to clear its 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 oldstretch setchanged.ceph osd pool stretch setandceph osd pool stretch unsetconfigure an individual stretch pool, which doc/rados/operations/stretch-mode.rst ("Individual Stretch Pools") offers as the alternative to stretch mode: stretch mode for exactly two data centers, a stretch pool for a pool spread over more than two. The monitor nevertheless accepted both while stretch mode was enabled. Stretch mode sets every pool's stretch values itself and changes them in its degraded and healthy transitions, and a pool changed by hand does not follow them. For example,stretch setin degraded stretch mode gave the pool the healthypeering_crush_bucket_countof 2 while only one zone was up, so its PGs stayed undersized+peered and its I/O blocked until the lost zone returned. Both commands now fail with -EINVAL while stretch mode is enabled.ceph osd force_healthy_stretch_modeonly ends recovery stretch mode, but in any other state it did nothing and still replied "Triggering healthy stretch mode" with success. It now fails with -EINVAL outside recovery stretch mode.Each fix is one commit together with the standalone test that shows the defect and its documentation (doc/rados/operations/pools.rst and stretch-mode.rst). The EC stretch cluster design (doc/dev/osd_internals/erasure_coding/ec_stretch_cluster.rst) is not changed here: its updates for these refusals are part of the stretch cluster work in #72643.
All the tests are in
qa/standalone/mon-stretch/mon-stretch-commands.sh. The EC tests run 3 mons without OSDs; the others run 3 mons and 4 OSDs in two zones plus a tiebreaker, in stretch mode. To restart a monitor on its existing data without copyingrun_mon's ceph-mon arguments,qa/standalone: split activate_mon out of run_monmoves the command that starts the daemon into a newactivate_monin ceph-helpers.sh, asactivate_osddoes for OSDs;run_moncalls it after--mkfs.Testing, on a main build, with ceph-mon rebuilt at each step:
TEST_stretch_set_ec_poolfails because the monitor answers "pool ec stretch values are set successfully" for a k=2 m=1 pool (TEST_stretch_set_replicated_poolpasses). With the fix,stretch seton the EC pool is refused,stretch unsetfails with "pool ec is not a stretch pool", and the pool's size, min_size and bucket count are unchanged. The test checks onlystretch set: with the fix no EC pool can be made a stretch pool, so the EC size check ofstretch unsetcannot be set up (next bullet).TEST_stretch_pool_commands_in_stretch_modefails because, in healthy stretch mode,ceph osd pool stretch set stretched 2 2 zone replicated_rule 6 3returns 0 ("pool stretched stretch values are set successfully"). A copy of the test without that step showedceph osd pool stretch unset stretched replicated_rule 3 2accepted as well ("pool stretched is no longer a stretch pool, all stretch values are unset successfully"). With the fix both are refused ("... is for individual stretch pools and cannot be used while stretch mode is enabled"), and the pool keeps bucket count 2, its stretch rule and size 4.TEST_force_healthy_stretch_mode_requires_recovery(run with the other two fixes in place) fails because the command returns 0 with "Triggering healthy stretch mode" in healthy stretch mode. With the fix it is refused in healthy and in degraded stretch mode, and in recovery stretch mode it returns the cluster to healthy stretch mode.stretch unseton an EC pool that an older monitor stretched, which the tests cannot set up now thatstretch setrefuses EC pools: the unfixed monitor stretched a k=2 m=1 pool (size 4, bucket count 2), then the fixed monitor was started on the same store. Unset with size 6, and with min_size 1, was refused; unset with size 3 and min_size 2 succeeded (size 3, min_size 2, bucket count 0);stretch setagain was refused.ninja vstart-base cython_cephfs cython_rbd, one at a time:qa/standalone/mon-stretch/mon-stretch-commands.sh(all four tests),mon-stretch/mon-stretch-fail-recovery.sh,mon-stretch/mon-stretch-uneven-crush-weights.shandmon/osd-pool-create.shpass, and so do the helper self-testsqa/standalone/ceph-helpers.sh TESTS test_run_mon test_activate_mon.qa/workunits/mon/mon-stretch-pool.shpasses at the head of the branch against a standalone cluster shaped likerados/singleton/all/mon-stretch-pool.yaml(9 mons, 9 OSDs, connectivity election, default pool size 6). Nothing in qa/ or src/ usesstretch setorstretch unsetwith stretch mode enabled; the teuthology tasksstretch_cluster.pyandtest_netsplit_3az_stretch_pool.pyuse them without stretch mode and were not run.pools.rstandstretch-mode.rstwere checked with docutils (no messages beyond the unknown Sphinx directives and roles that main also gives), andgit diff --checkis clean.Backport: umbrella and tentacle. The command handlers are the same as main on both, and the commits cherry-pick cleanly apart from small doc conflicts. squid is not proposed: it reaches end of life on 2026-10-31, and the first fix would need a squid-only patch. The defects came in with #56233 (1 and 2; in squid from v19.2.1 through #59084), #60631 (the size arguments of
stretch unset, v20.1.0 on) and #35906 (3, from Pacific on).Fixes: https://tracker.ceph.com/issues/81427
Fixes: https://tracker.ceph.com/issues/81428
Fixes: https://tracker.ceph.com/issues/81429
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.
🤖 Generated with Claude Code
https://claude.ai/code/session_012ETDivFUQubLqznTDowHRu