Repository navigation
Conversation
…e rule A multi-zone pool needs a CRUSH rule that places each zone's block of the pool (k+m shards, or the per-zone replicas) in a zone of its own, as the rule that 'osd pool create --num_zones 2' builds does. Outside global stretch mode the monitor does not check a rule it is given, so it accepts one that chooses OSDs across the zones: - 'osd pool create <pool> ... erasure <profile> <rule> --num_zones 2', and the replicated equivalent; - 'osd pool set <pool> crush_rule <rule>' on a multi-zone pool; - 'osd pool set <pool> num_zones 2 --crush_rule <rule>'; - 'osd pool set <pool> replica <n>' when it reuses an existing rule named <pool>-replica-<n>. In teuthology job 611913 the EC pool was created on a rule made by 'osd crush rule create-erasure <rule>' from a one-zone profile. 10 of its 16 PGs had up sets that mixed the datacenters within a zone's block of shards, and stretch mode did not recover. Add tests that try each of these with a one-zone rule and expect the command to fail. They fail on stretchy-C, which accepts it. They also check that pools are still created on rules that place a full set in each zone: the generated rule, one from 'osd crush rule create-erasure --num_zones 2' or 'create-stretch-replicated', and one that takes each datacenter in turn, which the new add_zone_take_rule() builds. Assisted-by: Claude Code
…zone A multi-zone EC pool keeps shard s of zone z at position s + (k+m) * z, and calc_ec_acting_stretch() serves each zone's block from one CRUSH zone that no other block uses. A multi-zone replicated pool needs its per-zone replicas in each zone. Outside global stretch mode the monitor did not check that a rule it was given does this, so it accepted a rule that chooses OSDs across the zones (see "qa/standalone/mon-stretch: demonstrate a multi-zone pool on a one-zone rule"). In teuthology job 611913 10 of 16 PGs of such a pool got up sets that mixed the datacenters within a zone's block. Add OSDMonitor::validate_multi_zone_rule(), which reads the rule's steps and accepts the two forms that place num_zones blocks of per_zone OSDs, each block in its own bucket of the zone type: - a take above the zones, a choose of the zone type that yields num_zones buckets, then choose/chooseleaf steps below the zone type that pick per_zone OSDs in each, as add_simple_stretch_rule() builds; - one take/emit block per zone, each taking a different zone bucket, or a bucket or OSD inside it, and picking per_zone OSDs. choosemsr is refused for the zone step, because it can move OSDs of a block to another bucket of that step's type when an OSD is out. Outside global stretch mode, the check runs when a multi-zone pool is created, for 'osd pool set <pool> crush_rule' on a multi-zone stretch pool, for 'osd pool set <pool> num_zones 2', and when 'osd pool set <pool> replica' reuses an existing <pool>-replica-<n> rule. The command fails with EINVAL, for example: crush rule one_zone does not place 4 OSDs in each of 2 datacenter buckets: it chooses host items before choosing datacenter buckets Generated stretch rules pass, so pool creation without a rule works as before. Global stretch mode keeps its own check (validate_stretch_mode_new_pool()). mon-stretch-failed-pool-create.sh used replicated_rule to get a multi-zone create past building a rule. It now uses a two-zone rule. Assisted-by: Claude Code
5 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A multi-zone pool (
num_zones2) needs a CRUSH rule that puts each zone's block of the pool in a zone of its own. For an EC pool that block isk+mshards. For a replicated pool it is the per-zone replicas. Outside global stretch mode the monitor accepted any existing rule for such a pool. Per-pool stretch mode came in with 59997c6, and f713744 checks the rule only in global stretch mode. This is on stretchy-C only, so there is no tracker.Seen in teuthology job 611913, rados:thrash-erasure-code-stretch with the jerasure-k=2-m=2-crush facet (run). The test made its rule with
osd crush rule create-erasure teuthologycrush, which builds a one-zone rule.osd pool create ... jerasure22profile teuthologycrush --num_zones 2then succeeded. 10 of the 16 PGs had up sets that mixed the datacenters within a zone block,calc_ec_acting_stretchleft holes, and stretch mode never recovered. 9af382e fixed the qa side. This PR fixes the monitor side.The fix
OSDMonitor::validate_multi_zone_rule()reads the rule's steps. It accepts the two forms that placenum_zonesblocks ofper_zoneOSDs, each block in a different bucket of the zone type:takeabove the zones, achooseof the zone type that yieldsnum_zonesbuckets, thenchoose/chooseleafsteps below it that pickper_zoneOSDs in each zone. This is whatadd_simple_stretch_rule()builds.take/emitblock per zone, each taking a different zone bucket, or a bucket or OSD inside it.choosemsris not accepted for the zone step, because it can move a block's OSDs to another bucket when an OSD is out.Outside global stretch mode the check runs on
osd pool createwithnum_zones> 1,osd pool set <pool> crush_ruleon a multi-zone stretch pool,osd pool set <pool> num_zones 2, andosd pool set <pool> replica <n>when it reuses an existing<pool>-replica-<n>rule. A rule that fails gets EINVAL, for example:Generated stretch rules pass, so creating a pool without a rule works as before. Global stretch mode is unchanged. The developer and user stretch documentation describe the check.
Commits
qa/standalone/mon-stretch: demonstrate a multi-zone pool on a one-zone rule: addsmon-stretch-multi-zone-rule.sh, which tries each path with a one-zone rule and expects a refusal. It also checks that the generated rule,create-erasure --num_zones 2(the rule 9af382e builds),create-stretch-replicatedand a hand-built per-zonetakerule are still accepted. All four test functions fail on stretchy-C.mon/OSDMonitor: refuse a rule that does not place a full set in each zone: the fix, a unit test inunittest_osd_monitor, and the documentation.mon-stretch-failed-pool-create.shnow uses a two-zone rule to reach the monitor check it tests.Testing
crush_ruleandnum_zones 2on each, and the replica reuse. All seven were accepted. The EC pool on the one-zone rule had 15 of 16 PGs with a zone block that spanned both datacenters.mon-stretch-multi-zone-rule.shpasses.qa/standalone/mon-stretchscripts andqa/standalone/crush/crush-stretch.shpass.ValidateMultiZoneRule), unittest_mon_monmap, unittest_monmap_monitor and unittest_mon_election pass.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