Repository navigation
doc/dev: ec_stretch_cluster: refactor global stretch mode - #54
Conversation
Addresses Bill Scales' review of #54: - "I don't think you need ceph osd pool default rm": drop it. Every value always has a default and the defaults stay consistent, so 'set' replaces a value instead. '--rule none' returns to generated rules. - "whether you should only have a command that shows all the pool create defaults": Ceph's get commands are not consistent (osd pool get, config get, fs get, erasure-code-profile get differ), so 'ceph osd pool default get' shows everything. - "Not sure why we are letting you disable stretch mode while in recovery": refuse it in recovery stretch mode, as on main; 'ceph osd force_healthy_stretch_mode' can be run first. - osd_pool_default_size: a pool must still report its total size, and the upgrade must not cause functional problems. Name the per-zone default after its parameter, osd_pool_default_replica, with osd_pool_default_size as its legacy name, and note that the user documentation mentioning it needs updating. State that a pool reports its total size (3 per zone with num_zones 2 gives 6), and why the per-zone meaning is safe: main does not use osd_pool_default_size while stretch mode is enabled. Name the rook module as the one functional risk after the upgrade. - Upgrade: until require_osd_release is raised, the configuration holds the old values and monitors of both versions may be in quorum. Refuse pool creation (the command and librados) until then, and any use of num_zones on 'osd pool set', even 1. The stretch mode commands behave as on main. Raising require_osd_release commits the upgrade: the behaviour and the configuration values change together. Flag for review that this also stops on-demand pool creation, for example by RGW. To be squashed into "doc/dev: ec_stretch_cluster: refactor global stretch mode" before merge. Assisted-by: Claude Code
| ceph osd pool default set | ||
| [--pool_type <replicated|erasure>] | ||
| [--num_zones <num_zones>] | ||
| [--rule <rule> | | ||
| [--zone_failure_domain <type>] [--osd_failure_domain <type>] | ||
| [--root <crush_root>] [--class <device_class>]] | ||
| [--replica <replica>] [--min_size <min_size>] | ||
| [--erasure_code_profile <profile> | [--k <k>] [--m <m>]] | ||
| [--pg_num <pg_num>] [--pgp_num <pgp_num>] |
There was a problem hiding this comment.
I know --replica will change osd_pool_default_size, but should we also add --size just for legacy support?
There was a problem hiding this comment.
Agreed, added a legacy --size in 4b72d43: other projects may use it even if nothing here does. It sets the per-zone osd_pool_default_replica (legacy name osd_pool_default_size), so it is refused with --num_zones or --replica, or while the num_zones default is above 1.
| a. **Pool Creation Defaults and Global Stretch Mode Commands** (OSDMonitor): | ||
| Refactor global stretch mode into configuration option defaults for every | ||
| pool creation parameter, ``ceph osd pool default`` to set and clear them, and | ||
| ``mon enable_stretch_mode``/``disable_stretch_mode`` commands that change | ||
| the defaults and every existing pool, replicated and EC (Section 2.3). |
There was a problem hiding this comment.
Okay so basically if the user wants to enable_stretch_mode for existing EC pools
they need to execute ceph osd pool deafult first.
There was a problem hiding this comment.
No need. Every default has a sensible built-in value, and enable_stretch_mode changes only the stretch ones (replicas 2, num_zones 2, zone failure domain) and stretches existing EC pools itself; FastEC is the only prerequisite. The design now also requires the defaults left by enable to pass the same checks as ceph osd pool default set, so the next create works. Clarified in 2.3.3 and 2.3.4 (4b72d43).
| * Pool behaviour does not change. If global stretch mode was enabled, every pool gets | ||
| ``num_zones`` 2, with its replicas and ``min_size`` counted per zone, and keeps its CRUSH | ||
| rule. |
There was a problem hiding this comment.
Thanks! For reference, this text has since moved: the upgrade is now described in Section 15 (rewritten around encode/decode in 8a01880), and 2.3.5 keeps only the conversion of the pool creation defaults.
| 2.3.4 Enabling and Disabling Stretch Mode | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| ``ceph mon enable_stretch_mode [<tiebreaker_mon>] <new_crush_rule> <dividing_bucket>`` and |
There was a problem hiding this comment.
I think BIll and I have discussed removing the [<tiebreaker_mon>] out of the command since there is just 1 tiebreaker monitor and it's simple for us to find out which one
There was a problem hiding this comment.
This would break legacy compatibility, which is why I left it in. @bill-scales @kamoltat Do we think nobody/nothing ever uses this command?
I will update to say it should be marked as legacy in the docs - but happy to remove if @bill-scales agrees.
There was a problem hiding this comment.
Marked it as a legacy argument for now (4b72d43). The monitors pick the one monitor outside both zones; the argument is still accepted and used as today, so existing callers keep working and a cluster with more than one monitor outside the zones can still name its tiebreaker.
Addresses Kamoltat Sirivadhna's review of #54: - #54 (comment) "should we also add --size just for legacy support?": yes. Scripts and other projects use --size and osd_pool_default_size. 'ceph osd pool default set --size' sets osd_pool_default_replica, and is refused together with --num_zones or --replica, and while the num_zones default is greater than 1. - #54 (comment) "if the user wants to enable_stretch_mode for existing EC pools they need to execute ceph osd pool default first": they do not. Every default has a sensible built-in value, and enable_stretch_mode changes only the stretch defaults (replicas 2, num_zones 2, zone failure domain). The resulting defaults must pass the checks of 'ceph osd pool default set' so that the next pool create works. 2.3.3 now says how pool create uses the defaults: options changed directly with 'ceph config' skip those checks, which is not blocked, so pool create checks the defaults it uses. - #54 (comment) removing [<tiebreaker_mon>]: mark it as a legacy argument. The monitors pick the one monitor outside both zones, and the argument is still accepted so that existing callers keep working. To be squashed into "doc/dev: ec_stretch_cluster: refactor global stretch mode" before merge. Assisted-by: Claude Code
4b72d43 to
943adea
Compare
Show what the warning looks like, and how to remove an overriding value from each place it can be set: a section of the configuration database, a monitor's configuration file, command line or environment, or a runtime setting. Link the pool creation defaults to it. Requested in review of #54. To be squashed into "doc: stretch mode commands and pool creation defaults" before merge. Assisted-by: Claude Code
Make the resolution steps: find the override, remove it, then set the default with ceph osd pool default set, which checks it, and confirm with ceph osd pool default get. Say the same where the pool creation defaults describe the refusal. Requested in review of #54. To be squashed into "doc: stretch mode commands and pool creation defaults" before merge. Assisted-by: Claude Code
ceph osd pool default get only reads the defaults, so it no longer waits for require_osd_release to be raised; set still does. num_zones_committed() becomes num_zones_supported(): it says whether the cluster's release supports per-pool num_zones, which is not about a command. Requested in review of #54. To be squashed into "mon: wait for the upgrade commit before num_zones can change" before merge. Assisted-by: Claude Code
ceph osd pool create and ceph osd pool default set now build a pool's parameters the same way: the osd_pool_default_* options, then the erasure code profile, named or default, then the command line. One function, check_pool_params(), checks the values that result, with the cluster where it needs to: CRUSH types, roots and classes, the plugin, min_size, pg_num, crimson, and whether the cluster can be stretched. An error caused by a default names its option. The librados pool create and the stretch mode commands use the same checks, and the checks in prepare_new_pool() and in the defaults command that repeated them are gone. Which parameters may be given together is still checked on the command line, and differs only where pool create describes one pool and the defaults command the defaults of every pool. A profile can be given with neither k, m nor a CRUSH parameter by either command. The defaults command checks the defaults as a pool of the default type, and of each type whose parameters it is given. A min_size default is not checked, since pool create limits it to the size. Requested in review of #54. To be squashed into "mon: check pool create parameters in a function of their own" before merge. Assisted-by: Claude Code
Describe the four steps that build and check a pool's parameters, the rules that differ between the two commands, the checks of the defaults command, the --size and crimson rules, the message for a missing named profile, and ceph osd pool default get before the upgrade is committed. Requested in review of #54. To be squashed into "doc/dev: ec_stretch_cluster: refactor global stretch mode" before merge. Assisted-by: Claude Code
8e801f2 to
f7d03c0
Compare
|
@Ericmzhang your #41 ("mon: Prevent osd pool stretch set for EC") was undone on stretchy-C. 8b30768 ("mon: add per-zone replica configuration for stretch pools", from #35) was written before #41 and merged after it, and it brought back the older EC branch in I agree with #41, and ed771c7 in this PR restores it:
Could you check that ed771c7 matches what you intended? The unit tests pass; the standalone test ( |
OSDMapTestHelpers.h and two TestECFailoverWithPeering.cc zone transitions built a FastEC pool's nonprimary_shards by hand. Use the ECUtil helper that the monitor uses, so that shared EC geometry lives in ECUtil. Owner review of #54: "You created a nonprimary_shards function - this really sounds like something that should already exist". Nothing else computes the set; the hand-written copies in the tests are replaced instead. To be squashed into "mon: recompute nonprimary_shards when a pool's num_zones changes" before merge. Assisted-by: Claude Code
Nothing but their own unit tests called them after the pool parameters were built in four steps; profile values are read from the parsed profile map instead. include/str_map.h already parses "key=value" strings where that is needed. Owner review of #54 (helpers that duplicate existing code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
PoolCreateParams read k and m with std::stoll, which stops at the first character that is not a digit, so a profile with k=3x or m=2.5 was taken as k=3 or m=2. Use strict_strtoll, as the erasure code plugins do, so such a value is no value and the checks report the profile. Owner review of #54 (helpers that duplicate existing code). The new unit test failed before this change. To be squashed into "mon: build and check pool create parameters in four steps" before merge. Assisted-by: Claude Code
pool_create_cluster() copied the CRUSH map it was given, by encoding and decoding it, only because the stretch check needs a non-const map. Every caller already holds its own copy from _get_pending_crush(), so take that copy by reference instead. ConfigMonitor now gets one too, rather than handing over the committed map. Owner review of #54 (helpers that duplicate existing code: _get_pending_crush() already makes the copy). To be squashed into "mon: build and check pool create parameters in four steps" before merge, except the ConfigMonitor.cc hunk, which goes into "mon: add ceph osd pool default set and get". Assisted-by: Claude Code
ConfigMonitor turned each pool parameter into the string its option holds twice, once for ceph osd pool default get and once for the values set writes. pool_default_value() in PoolCreateParams does it once, with unit tests; get still shows the rule by name, the profile as the option holds it, and k and m on their own. Owner review of #54 (code that duplicates other code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
enable_stretch_mode, disable_stretch_mode and the conversion at the upgrade commit each spelled out the pool default options they write. stretch_pool_defaults() builds them from the zone count, the replicas per zone and the zone failure domain, with the option names of pool_default_options(), and has unit tests. Owner review of #54 (code that duplicates other code). To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge, except the stretch_mode_defaults_at_commit() hunk, which goes into "mon: wait for the upgrade commit before num_zones can change". Assisted-by: Claude Code
ceph osd pool default set copied the size one check of ceph osd pool set <pool> size: mon_allow_pool_size_one must be set and the command must pass --yes-i-really-mean-it. Both now call check_size_one() in PoolCreateParams, which has unit tests. The messages do not change. Owner review of #54 (code that duplicates other code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
…aults() ceph osd pool set <pool> num_zones and its CRUSH rule read each pool creation default by its option name. Take them from load_pool_defaults(), as pool create and ceph osd pool default do, so that the option names and the replica fallback to osd_pool_default_size live in one place. The command line is still read as before: a --replica of 0 or less is refused there, where pool create treats 0 as not given. Owner review of #54 (the num_zones paths read the defaults by hand). To be squashed into "mon: build and check pool create parameters in four steps" before merge. Assisted-by: Claude Code
OSDMap.cc and PGMap.cc are also built into crimson-common, where cct->_conf is crimson::common::ConfigProxy. That proxy lacked get_osd_pool_default_replica() and get_osd_pool_default_total_size(), so a WITH_CRIMSON build failed. Add them as the classic ConfigProxy has them. Found by an independent review of #54 (not compiled locally: the local build has WITH_CRIMSON=OFF). To be squashed into "mon,mgr: size new pools as num_zones times the replicas per zone" before merge. Assisted-by: Claude Code
Three fixes from an independent review of #54, as the owner decided them: - More than two zones are not supported. ceph osd pool create and ceph osd pool default set now refuse num_zones above 2, as ceph osd pool set <pool> num_zones already did. PoolCreateCluster::max_num_zones lets unit tests raise the limit. A pool created with num_zones 3 had no stretch values, so disable_stretch_mode could never unstretch it. - A pool can have at most 128 OSDs. A FastEC pool with more shards than that, such as k=32 m=20 over 3 zones, made ECUtil::nonprimary_shards() wrap the 8-bit shard id and hit an assert in the leader, which then crashed again on every new leader as the client retried. This was already on stretchy-C. check_pool_params() refuses num_zones x (k+m) above 128, and prepare_pool_size() refuses any pool size above 128, which also covers num_zones changes and LRC's local parity chunks. - An LRC profile defined with mapping and layers is normalized with k=-1 m=-1 l=-1, so the k and m checks refused it, which pool create did not do before the four steps. The LRC plugin checks its own k, m and l, and its chunk count is more than k+m, so check_pool_params() leaves LRC profiles to it. LRC stays a legacy EC plugin: it cannot be given FastEC, so it cannot have more than one zone. New unit tests for each; the two LRC tests failed before this change. To be squashed into "mon: build and check pool create parameters in four steps" before merge. The 128 OSD limit fixes a crash that stretchy-C already had. Assisted-by: Claude Code
check_pool_defaults() checked a given --min_size as part of each pool type it checked. With osd_pool_default_type erasure, --min_size 1 was refused as outside k..k+m, though EC pools never use osd_pool_default_min_size, and --k 4 --m 2 --min_size 2 was refused in one command but accepted in two. A replicated --replica 2 --min_size 3 was refused too. The design (Section 2.3.3) says a min_size default is not checked, because pool create limits it to the pool's size; do that. The three new unit tests failed before this change. Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
ceph osd pool stretch set takes min_size as main documents it, a total over all zones, but stored it unchanged as the pool's per-zone min_size. stretch set rep 2 2 datacenter rule 4 2, which on main means 2 of 4, needed 2 in every zone, so a single OSD down stopped I/O, and nothing checked min_size against the pool size: 6 4 gave PGs that could never go active. stretch_set_zone_min_size() refuses a min_size outside 1..size and stores it per zone, divided by the zone count and rounded up, so that writes are never accepted with fewer replicas than the total asked for. The design (Section 11.4.1) and pools.rst say so. Unit tests added. Found by an independent review of #54; the owner asked for a fix. The per-zone meaning came with stretchy-C's per-zone min_size. Not to be squashed: it fixes stretch set as stretchy-C has it. Assisted-by: Claude Code
…stretch mode After enable_stretch_mode, stretch mode leaves with its last stretched pool (deleted or set to num_zones 1), but the pool creation defaults stay at two zones with two replicas each. disable_stretch_mode then refused with "stretch mode is already disabled", so every new pool was still created stretched and turned stretch mode back on. With no stretched pool and stretch mode off, disable_stretch_mode now sets the one-zone defaults when they are not already in place, and is refused only when there is nothing to do. It no longer touches the MonMap in that case. New standalone test TEST_disable_resets_defaults_without_stretch_mode (not run yet). Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge. Assisted-by: Claude Code
…licas stretch_mode_disable_enable runs after a workunit that enables stretch mode, which now also sets the pool creation defaults to two zones of two replicas. setUp deletes every pool, which leaves stretch mode but not its defaults, so _setup_pool created a two-zone pool and its osd pool set size 4 was refused, as a stretched pool's size follows from its zones. Create the pool with --num_zones 2 --replica 2 instead, which gives the size 4 and stretch rule that the checks expect. Not run: it needs teuthology. Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge. Assisted-by: Claude Code
…text Comparing the design with stretchy-C found passages that contradict each other and passages that the code has overtaken. As the owner asked, fix them in one commit: - 2.1.1/2.1.4: the syntax lacked --min_size and --force_pg_limit; --root is not "R2 only", and its default is osd_pool_default_root. - 2.1.3/2.2 Example 3: --size is refused for a multi-zone replicated pool; the example uses --replica 2. - 2.1.5: the release gate exists (15.3); FastEC also needs a 4096 multiple chunk size; m >= 1 is checked by the monitor; LRC profiles are checked by their plugin; num_zones is 1 or 2 and a pool has at most 128 OSDs. - 5, 11, 11.1: more than two zones are refused for now; only main's individual stretch pools span more sites. - 7.1.2 title, 7.4 wording, 7.3 note, 7.3.2, 7.5: how localized and balanced reads choose zones and replicas today. - 10.1 note: pg_temp already lists primary-capable shards first. - 11.2: a replicated min_size is 1..replica, per zone. - 11.5.1: the zone tie-break order since 20cf19c. - 11.5.3 agrees with 11.2.1 and 11.3 (per-zone min_size). - 11.8 is a later-release item, as 14.4 says. - 13.2: no FastEC side effect; placement parameters default. - 14.1 items 4 and 7a, 14.4 item 2: numbering and references. - 18: the --root example is an EC pool, as 2.1.5 allows. To be squashed into "doc/dev: ec_stretch_cluster: refactor global stretch mode" before merge. Assisted-by: Claude Code
generate_entity_map() walks the sections from the least to the most specific (global, type, name), and a later section's value replaces an earlier one in the result. Since e65f676 ("mon/ConfigMap: use ValueSource type for generate_entity_map()") the value sources were added with emplace(), which keeps the first, so a value set in both global and mon was reported as coming from global: ceph config set global osd_pool_default_replica 2 ceph config set mon osd_pool_default_replica 3 ceph config get mon.a # WHO global, VALUE 3 Record the source with insert_or_assign(), as the value is recorded. ceph config get <who> and ceph osd pool default get now name the section that gives the value, and POOL_DEFAULT_OVERRIDDEN, which asks the same question, sees a mon section override again. The new unit test failed before this change. The same code is on main. Not to be squashed: this is a main defect, to be proposed for main too. Assisted-by: Claude Code
cef2508 stopped checking a min_size default altogether, but only its check as an EC pool was wrong: EC pools never use osd_pool_default_min_size. Keep the check against the replicas per zone, which TEST_set_checks in mon-stretch-pool-defaults.sh expects, and say so in the design (Section 2.3.3). Owner review of #54 (16a). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
Building pool create's parameters in four steps checks everything
before anything is created, so the command-line and stretch mode checks
now come before the CRUSH rule is generated:
- crush-stretch.sh TEST_pool_create_stretch_ec and
TEST_pool_create_stretch_replica walk through the rule's errors as
hosts and OSDs are added. Once one zone had an OSD, the zone weight
check failed first. The OSDs now join with weight 0 until both zones
have them, and are reweighted before the pool is created.
- crush-stretch.sh TEST_stretch_diff_bucket_barrier and
TEST_stretch_diff_sites get the stretch mode check's error ("there are
0/3 datacenters ...") instead of the rule's.
- mon-stretch-replicated-placement-options.sh: with a rule given, the
placement options conflict with the rule before num_zones is looked at.
All of crush-stretch.sh and the placement options test pass.
To be squashed into "mon: build and check pool create parameters in
four steps" before merge.
Assisted-by: Claude Code
enable_stretch_mode and disable_stretch_mode now keep paxos plugged, so the MonMap, configuration and OSDMap change in one round, as MonmapMonitor::clear_stretch_mode_state() asserts since stretchy-C f4ba9aa. The MonMap change makes every monitor bootstrap, which retries each command still waiting for its reply. The retried disable_stretch_mode found stretch mode gone and failed with "stretch mode is already disabled" although it had succeeded; before the plug the OSDMap committed a round later, so the retry happened to find the pools still stretched. mon-stretch-upgrade.sh TEST_legacy_stretch_mode_then_commit failed this way. A repeated disable_stretch_mode now succeeds, as a repeated enable_stretch_mode already does (design Section 2.3.4). The user sees the retry's reply, so the replies no longer contradict the first run: "stretch mode is enabled" or "stretch mode is disabled", with the number of pools changed only when there were any. On a vstart cluster both commands replied "0 pool(s) changed" or "already disabled" after changing every pool. To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge. Assisted-by: Claude Code
…eplicas stretchy-C added TEST_stretch_unstretch_clean after this series was written. It creates two-zone replicated pools on two hosts per zone, so it relied on two copies per zone. Pools now default to osd_pool_default_replica (3) copies per zone, so pool create failed with "replica 3 per zone requires at least 3 hosts". Ask for two replicas, as the other tests in this script do. Squash into: mon,mgr: size new pools as num_zones times the replicas per zone Assisted-by: Claude Code
20d734a to
c8a51ec
Compare
kamoltat
left a comment
There was a problem hiding this comment.
I reviewed the global stretch mode and refractor, I'm happy with what Claude is changing here, simplifying big logic like PoolCreateParams and added more encoding guards against old decoder for min_size.
POOL_DEFAULT_OVERRIDDEN sounds a little vague to me so I propose maybe naming it different to something like POOL_DEFAULT_CONFIG_OVERRIDE? since the default changes are conflicting.
| static constexpr ceph_release_t NUM_ZONES_RELEASE = ceph_release_t::umbrella; | ||
| bool num_zones_supported() const { | ||
| return osdmap.require_osd_release >= NUM_ZONES_RELEASE; | ||
| } |
There was a problem hiding this comment.
I think this is a good addition and correct since we will be supporting this downsteam and in Vampire release
| // before v34, min_size counts every zone | ||
| const __u8 encoded_min_size = v >= 34 ? min_size : min_size * num_zones; | ||
| encode(encoded_min_size, bl); |
There was a problem hiding this comment.
I don't see anything wrong with this, I guess it deals with older decoder.
| bool force_create = false; | ||
| int ret = 0; | ||
| // librados creates a single-zone replicated pool from the defaults | ||
| PoolCreateParams params = load_pool_defaults(g_conf()); |
There was a problem hiding this comment.
Okay tidied up a lot of things
| // POOL_DEFAULT_OVERRIDDEN | ||
| { | ||
| const ConfigMap& config_map = mon.configmon()->get_config_map(); | ||
| auto global_value = [&](const string& name) -> std::optional<string> { | ||
| auto [first, last] = config_map.global.options.equal_range(name); | ||
| for (auto i = first; i != last; ++i) { |
There was a problem hiding this comment.
Yeah I think this is good but the Warning confused me at first
POOL_DEFAULT_OVERRIDDEN sounds like detects pools whose configurations differ from the defaults, but it actually detects configuration-source conflicts,
| // a total over all zones, kept per zone and rounded up | ||
| return (min_size + num_zones - 1) / num_zones; |
There was a problem hiding this comment.
Okay yeah I'm fine with rounding up, but just want to tag this line to make sure this has been discussed.
OSDMapTestHelpers.h and two TestECFailoverWithPeering.cc zone transitions built a FastEC pool's nonprimary_shards by hand. Use the ECUtil helper that the monitor uses, so that shared EC geometry lives in ECUtil. Owner review of #54: "You created a nonprimary_shards function - this really sounds like something that should already exist". Nothing else computes the set; the hand-written copies in the tests are replaced instead. To be squashed into "mon: recompute nonprimary_shards when a pool's num_zones changes" before merge. Assisted-by: Claude Code
Nothing but their own unit tests called them after the pool parameters were built in four steps; profile values are read from the parsed profile map instead. include/str_map.h already parses "key=value" strings where that is needed. Owner review of #54 (helpers that duplicate existing code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
PoolCreateParams read k and m with std::stoll, which stops at the first character that is not a digit, so a profile with k=3x or m=2.5 was taken as k=3 or m=2. Use strict_strtoll, as the erasure code plugins do, so such a value is no value and the checks report the profile. Owner review of #54 (helpers that duplicate existing code). The new unit test failed before this change. To be squashed into "mon: build and check pool create parameters in four steps" before merge. Assisted-by: Claude Code
pool_create_cluster() copied the CRUSH map it was given, by encoding and decoding it, only because the stretch check needs a non-const map. Every caller already holds its own copy from _get_pending_crush(), so take that copy by reference instead. ConfigMonitor now gets one too, rather than handing over the committed map. Owner review of #54 (helpers that duplicate existing code: _get_pending_crush() already makes the copy). To be squashed into "mon: build and check pool create parameters in four steps" before merge, except the ConfigMonitor.cc hunk, which goes into "mon: add ceph osd pool default set and get". Assisted-by: Claude Code
ConfigMonitor turned each pool parameter into the string its option holds twice, once for ceph osd pool default get and once for the values set writes. pool_default_value() in PoolCreateParams does it once, with unit tests; get still shows the rule by name, the profile as the option holds it, and k and m on their own. Owner review of #54 (code that duplicates other code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
enable_stretch_mode, disable_stretch_mode and the conversion at the upgrade commit each spelled out the pool default options they write. stretch_pool_defaults() builds them from the zone count, the replicas per zone and the zone failure domain, with the option names of pool_default_options(), and has unit tests. Owner review of #54 (code that duplicates other code). To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge, except the stretch_mode_defaults_at_commit() hunk, which goes into "mon: wait for the upgrade commit before num_zones can change". Assisted-by: Claude Code
ceph osd pool default set copied the size one check of ceph osd pool set <pool> size: mon_allow_pool_size_one must be set and the command must pass --yes-i-really-mean-it. Both now call check_size_one() in PoolCreateParams, which has unit tests. The messages do not change. Owner review of #54 (code that duplicates other code). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
…aults() ceph osd pool set <pool> num_zones and its CRUSH rule read each pool creation default by its option name. Take them from load_pool_defaults(), as pool create and ceph osd pool default do, so that the option names and the replica fallback to osd_pool_default_size live in one place. The command line is still read as before: a --replica of 0 or less is refused there, where pool create treats 0 as not given. Owner review of #54 (the num_zones paths read the defaults by hand). To be squashed into "mon: build and check pool create parameters in four steps" before merge. Assisted-by: Claude Code
OSDMap.cc and PGMap.cc are also built into crimson-common, where cct->_conf is crimson::common::ConfigProxy. That proxy lacked get_osd_pool_default_replica() and get_osd_pool_default_total_size(), so a WITH_CRIMSON build failed. Add them as the classic ConfigProxy has them. Found by an independent review of #54 (not compiled locally: the local build has WITH_CRIMSON=OFF). To be squashed into "mon,mgr: size new pools as num_zones times the replicas per zone" before merge. Assisted-by: Claude Code
Three fixes from an independent review of #54, as the owner decided them: - More than two zones are not supported. ceph osd pool create and ceph osd pool default set now refuse num_zones above 2, as ceph osd pool set <pool> num_zones already did. PoolCreateCluster::max_num_zones lets unit tests raise the limit. A pool created with num_zones 3 had no stretch values, so disable_stretch_mode could never unstretch it. - A pool can have at most 128 OSDs. A FastEC pool with more shards than that, such as k=32 m=20 over 3 zones, made ECUtil::nonprimary_shards() wrap the 8-bit shard id and hit an assert in the leader, which then crashed again on every new leader as the client retried. This was already on stretchy-C. check_pool_params() refuses num_zones x (k+m) above 128, and prepare_pool_size() refuses any pool size above 128, which also covers num_zones changes and LRC's local parity chunks. - An LRC profile defined with mapping and layers is normalized with k=-1 m=-1 l=-1, so the k and m checks refused it, which pool create did not do before the four steps. The LRC plugin checks its own k, m and l, and its chunk count is more than k+m, so check_pool_params() leaves LRC profiles to it. LRC stays a legacy EC plugin: it cannot be given FastEC, so it cannot have more than one zone. New unit tests for each; the two LRC tests failed before this change. To be squashed into "mon: build and check pool create parameters in four steps" before merge. The 128 OSD limit fixes a crash that stretchy-C already had. Assisted-by: Claude Code
check_pool_defaults() checked a given --min_size as part of each pool type it checked. With osd_pool_default_type erasure, --min_size 1 was refused as outside k..k+m, though EC pools never use osd_pool_default_min_size, and --k 4 --m 2 --min_size 2 was refused in one command but accepted in two. A replicated --replica 2 --min_size 3 was refused too. The design (Section 2.3.3) says a min_size default is not checked, because pool create limits it to the pool's size; do that. The three new unit tests failed before this change. Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
ceph osd pool stretch set takes min_size as main documents it, a total over all zones, but stored it unchanged as the pool's per-zone min_size. stretch set rep 2 2 datacenter rule 4 2, which on main means 2 of 4, needed 2 in every zone, so a single OSD down stopped I/O, and nothing checked min_size against the pool size: 6 4 gave PGs that could never go active. stretch_set_zone_min_size() refuses a min_size outside 1..size and stores it per zone, divided by the zone count and rounded up, so that writes are never accepted with fewer replicas than the total asked for. The design (Section 11.4.1) and pools.rst say so. Unit tests added. Found by an independent review of #54; the owner asked for a fix. The per-zone meaning came with stretchy-C's per-zone min_size. Not to be squashed: it fixes stretch set as stretchy-C has it. Assisted-by: Claude Code
…stretch mode After enable_stretch_mode, stretch mode leaves with its last stretched pool (deleted or set to num_zones 1), but the pool creation defaults stay at two zones with two replicas each. disable_stretch_mode then refused with "stretch mode is already disabled", so every new pool was still created stretched and turned stretch mode back on. With no stretched pool and stretch mode off, disable_stretch_mode now sets the one-zone defaults when they are not already in place, and is refused only when there is nothing to do. It no longer touches the MonMap in that case. New standalone test TEST_disable_resets_defaults_without_stretch_mode (not run yet). Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge. Assisted-by: Claude Code
…licas stretch_mode_disable_enable runs after a workunit that enables stretch mode, which now also sets the pool creation defaults to two zones of two replicas. setUp deletes every pool, which leaves stretch mode but not its defaults, so _setup_pool created a two-zone pool and its osd pool set size 4 was refused, as a stretched pool's size follows from its zones. Create the pool with --num_zones 2 --replica 2 instead, which gives the size 4 and stretch rule that the checks expect. Not run: it needs teuthology. Found by an independent review of #54; the owner asked for a fix. To be squashed into "mon: replace global stretch mode with per-pool num_zones commands" before merge. Assisted-by: Claude Code
Each monitor reports in POOL_DEFAULT_OVERRIDDEN the pool defaults that are overridden for itself. It used db_pool_default_overrides(), which counts any masked global value as an override because the set command must cover every monitor and cannot know the other monitors' hosts. A monitor knows its own host, so ConfigMonitor::pool_default_db_overrides() now asks pool_default_source() (ConfigMap::generate_entity_map) for each option, and a value masked to another host no longer warns. ceph osd pool default set keeps the conservative check. New standalone test TEST_health_ignores_mask_of_other_host (not run yet). Owner review of #54 (override detection by ConfigMap::generate_entity_map). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
cef2508 stopped checking a min_size default altogether, but only its check as an EC pool was wrong: EC pools never use osd_pool_default_min_size. Keep the check against the replicas per zone, which TEST_set_checks in mon-stretch-pool-defaults.sh expects, and say so in the design (Section 2.3.3). Owner review of #54 (16a). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile, but a pool created without --k/--m or a profile used the default profile in the OSDMap, which the option only creates when the cluster is created. So the k and m defaults never reached pool creation, and every such pool shared the default profile, which changed under them if it was edited. As the design says (Section 4.2): - A pool that names no profile, or names default, gets its own <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH options given, then normalized. An existing profile of that name is used only if every key matches; otherwise pool create fails with EEXIST and says how to fix it. This replaces the k/m-only and CRUSH option comparisons. CRUSH options no longer need --k/--m. - Plain single-zone pools still share the erasure-code rule. - ceph osd pool default set --k/--m set k and m in the default profile, in the same Paxos proposal as the options, or on their own when no option changes. default get shows them with source osdmap, and default set loses --erasure_code_profile. osd_pool_default_erasure_code_profile keeps its role on main. - Before the upgrade commit, a pool created without a profile (only possible with mon_debug_allow_pool_create_before_commit) still uses default, as in earlier releases. Owner review of #54 (item 17). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
… commit With every pool that names no profile having one of its own, the default profile is a template that ceph osd pool default set changes. Pools from earlier releases still refer to it. When the upgrade is committed, give each EC pool that refers to default a verbatim copy, <pool>-k<k>-m<m>, in the same OSDMap update as the pool's new erasure_code_profile, and log it to the cluster log. The copy is not normalized, so the OSDs build the same EC backend from it and the pool does not change. A name holding other contents gets a suffix -<n>; if the plugin cannot be loaded to count the chunks, the copy is named <pool>-default (design Section 13.5). default and osd_pool_default_erasure_code_profile are not changed. Owner review of #54 (item 17). To be squashed into "mon: create pools only once the upgrade is committed" before merge. Assisted-by: Claude Code
… own ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile, but a pool created without --k/--m or a profile used the default profile in the OSDMap, which the option only creates when the cluster is created. So the k and m defaults never reached pool creation, and every such pool shared the default profile, which changed under them if it was edited. As the design says (Section 4.2): - A pool that names no profile, or names default, gets its own <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH options given, then normalized. An existing profile of that name is used only if every key matches; otherwise pool create fails with EEXIST and says how to fix it. This replaces the k/m-only and CRUSH option comparisons. CRUSH options no longer need --k/--m. - Plain single-zone pools still share the erasure-code rule. - ceph osd pool default set --k/--m set k and m in the default profile, in the same Paxos proposal as the options, or on their own when no option changes. default get shows them with source osdmap, and default set loses --erasure_code_profile. osd_pool_default_erasure_code_profile keeps its role on main. - Before the upgrade commit, a pool created without a profile (only possible with mon_debug_allow_pool_create_before_commit) still uses default, as in earlier releases. Owner review of #54 (item 17). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
…e commit With every pool that names no profile having one of its own, the default profile is a template that ceph osd pool default set changes. Pools from earlier releases still refer to it. When the upgrade is committed, give each EC pool that refers to default a verbatim copy, <pool>-k<k>-m<m>, in the same OSDMap update as the pool's new erasure_code_profile, and log it to the cluster log. The copy is not normalized, so the OSDs build the same EC backend from it and the pool does not change. A name holding other contents gets a suffix -<n>; if the plugin cannot be loaded to count the chunks, the copy is named <pool>-default (design Section 13.5). default and osd_pool_default_erasure_code_profile are not changed. Owner review of #54 (item 17). To be squashed into "mon: create pools only once the upgrade is committed" before merge. Assisted-by: Claude Code
… own ceph osd pool default set --k/--m wrote osd_pool_default_erasure_code_profile, but a pool created without --k/--m or a profile used the default profile in the OSDMap, which the option only creates when the cluster is created. So the k and m defaults never reached pool creation, and every such pool shared the default profile, which changed under them if it was edited. As the design says (Section 4.2): - A pool that names no profile, or names default, gets its own <pool>-k<k>-m<m>, built from the default profile, --k/--m and the CRUSH options given, then normalized. An existing profile of that name is used only if every key matches; otherwise pool create fails with EEXIST and says how to fix it. This replaces the k/m-only and CRUSH option comparisons. CRUSH options no longer need --k/--m. - Plain single-zone pools still share the erasure-code rule. - ceph osd pool default set --k/--m set k and m in the default profile, in the same Paxos proposal as the options, or on their own when no option changes. default get shows them with source osdmap, and default set loses --erasure_code_profile. osd_pool_default_erasure_code_profile keeps its role on main. - Before the upgrade commit, a pool created without a profile (only possible with mon_debug_allow_pool_create_before_commit) still uses default, as in earlier releases. Owner review of #54 (item 17). To be squashed into "mon: add ceph osd pool default set and get" before merge. Assisted-by: Claude Code
Refactors global stretch mode, as agreed: whether a pool is stretched depends only on its own
num_zones, everyceph osd pool createparameter takes its default from anosd_pool_default_*option, andceph mon enable_stretch_mode/disable_stretch_modebecome commands that set those defaults and change every pool.The first commit is the design (
doc/dev/osd_internals/erasure_coding/ec_stretch_cluster.rst, Sections 2.3, 11.3, 13.2 and 15). Commits 2–12 implement it. The commits after them answer reviews; each says which commit it will be squashed into before merge, or that it stays on its own.Commits
doc/dev: ec_stretch_cluster: refactor global stretch mode: the design.osd: pg_pool_t num_zones and replica in v34, total min_size before.mon: pool create takes its defaults from osd_pool_default_* options: newosd_pool_default_replica,_num_zones,_zone_failure_domain,_osd_failure_domain,_root,_class.mon: build and check pool create parameters in four steps: load the defaults, use the erasure code profile, apply the command line, check the result (src/mon/PoolCreateParams.{h,cc}), shared by pool create (command and librados),ceph osd pool default setand the stretch mode commands.mon: add ceph osd pool default set and get: plus thePOOL_DEFAULT_OVERRIDDENhealth warning.mon: replace global stretch mode with per-pool num_zones commands.mon: wait for the upgrade commit before num_zones can change.mon,mgr: size new pools as num_zones times the replicas per zone.doc: stretch mode commands and pool creation defaults.mon: recompute nonprimary_shards when a pool's num_zones changes.qa/standalone: test pool creation defaults and stretch mode commands.mon: use osd_pool_default_crush_rule for every pool it suits.Review responses (owner review, and an independent review of the PR):
mon/OSDMonitor: refuse osd pool stretch set for EC pools again(mon: Prevent osd pool stretch set for EC #41's refusal, undone by osd, mon: support per-zone replica min_size for stretch pools #35's merge) andmon/OSDMonitor: keep stretch set's min_size as a total over all zones.mon/ConfigMap: report the section that gives an entity's value(ceph config get <who>named the least specific section that sets an option, not the one whose value is used;POOL_DEFAULT_OVERRIDDENasks the same question).num_zones 2checked against stretch mode; duplicate helpers removed or shared; at most two zones and 128 OSDs per pool, and LRC profiles left to their plugin; crimson config getters;default setchecks amin_sizedefault only against the replicas per zone, not as an EC pool;disable_stretch_moderesets defaults left without stretch mode; the teuthology task's pool; per-monitor mask checks inPOOL_DEFAULT_OVERRIDDEN; design text fixes; standalone test expectations for the four-step order of checks.Points for reviewers
OSDMonitor::NUM_ZONES_RELEASE) use Umbrella. Both move to Vampire together once it is defined.min_sizeacross the upgrade; librados (RGW) pool creation in a stretched cluster; EC profiles versus the default CRUSH rule; a repeatedenable_stretch_mode; whatdefault setpromises; named profiles and the zone type; deleting the user's stretch rule; legacy EC pools blockingenable_stretch_mode.enable_stretch_mode/disable_stretch_modedo not plug Paxos, so the MonMap can commit before the pools and defaults;default set --rule <EC rule>breaks replicated pool creation;default_rule_suits_poolignores how many OSDs a rule puts in each zone (to use mon/OSDMonitor: refuse a rule that does not place a full set in each zone #60's check); the commit-time conversion misses a legacy enable or disable in the same epoch.default setandnum_zones; only main's individual stretch pools (ceph osd pool stretch set) span more sites.osd_pool_default_replicadefaults to 0, meaning "useosd_pool_default_size", because Ceph config has no option aliases.ceph osd pool defaultis served by ConfigMonitor (config caps, plus a routing exception inMonitor) and refuses values that amonsection or a monitor's local configuration overrides.Testing
ninja tests(WITH_CRIMSON=OFF; the crimson getters are not compiled locally).unittest_pool_create_params,unittest_pool_defaults,unittest_osd_monitor,unittest_osd_types,unittest_ecutil,unittest_ecfailover_with_peering,unittest_ecbackend,unittest_osdmapand the stretch EC unit tests.mon-stretch/,crush/crush-stretch.sh,mon/osd-pool-create.sh,mon/misc.sh,mon/osd-erasure-code-profile.shanderasure-code/test-erasure-code.sh. 16 passed on dccad0b. The other 3 (mon-stretch-pool-defaults.sh,crush-stretch.sh,mon-stretch-replicated-placement-options.sh) failed there and pass with the last three commits. The other 16 have not been rerun since those commits.refuse osd pool stretch set for EC pools again:mon-stretch-commands.sh TEST_stretch_set_ec_poolfails, and it passes with the fix.qa/tasks/stretch_mode_disable_enable.pywas updated).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