Repository navigation
mon/MonMap: encode the umbrella monmap as struct version 11 - #45
Merged
Merged
Conversation
MonMap::encode() for umbrella peers writes a version 10 header, but it still appends global_stretch_mode_enabled, a version 11 field. MonMap::decode() reads that field only from version 11, and for older versions sets it to stretch_mode_enabled. So a monmap with stretch mode enabled and global stretch mode disabled, as a num_zones 2 pool create leaves it, decodes with global stretch mode enabled. Add two unittest_mon_monmap tests. Each sets stretch_mode_enabled, encodes the monmap with CEPH_FEATURES_ALL, which includes SERVER_UMBRELLA, and decodes it. global_stretch_mode_enabled must come back as it was set: false in umbrella_stretch_mode_without_global, true in umbrella_global_stretch_mode. MonMapEncode.umbrella_stretch_mode_without_global fails on the current code. Assisted-by: Claude Code
"mon/MonMap: Return early from encoding if before umbrella" gave
pre-umbrella peers a version 9 encoding of their own, and changed the
version of the umbrella encoding from 11 to 10. That encoding still
ends with global_stretch_mode_enabled, a version 11 field.
MonMap::decode() reads the field only when struct_v >= 11. For a
version 10 struct it sets global_stretch_mode_enabled to
stretch_mode_enabled.
So once a num_zones 2 pool create enables stretch mode, every monitor
decodes the committed monmap with global stretch mode enabled too, as
if 'ceph mon enable_stretch_mode' had been run. prepare_pool_size()
then refuses every later erasure coded pool create ("we are in global
stretch mode; cannot create EC pools!"). Once num_zones > 1 creates are
refused in global stretch mode, so is the create that enabled stretch
mode, when it is resent after the election that enabling stretch mode
starts.
Encode the umbrella monmap as version 11 again, as before that commit.
compat_v stays 6, so a decoder that knows only version 10 still accepts
it and skips the last field.
This can be squashed into "mon/MonMap: Return early from encoding if
before umbrella".
Assisted-by: Claude Code
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.
Follow-up to Eric Zhang's "mon/MonMap: Return early from encoding if before umbrella", for him to review and squash.
That commit encodes the monmap for umbrella peers as struct version 10, but the encoding still ends with
global_stretch_mode_enabled, a version 11 field.MonMap::decode()reads that field only from version 11, and otherwise sets it tostretch_mode_enabled. So once a--num-zones 2pool create enables stretch mode, every monitor decodes the monmap with global stretch mode enabled too, as ifceph mon enable_stretch_modehad been run. From reading the code,prepare_pool_size()then refuses every later erasure coded pool create ("we are in global stretch mode; cannot create EC pools!"). Once a later PR in this series refusesnum_zones > 1creates in global stretch mode, the create that enabled stretch mode is also refused when it is resent after the election.unittest_mon_monmaptests setstretch_mode_enabled, encode the monmap with all features (which includeSERVER_UMBRELLA), decode it, and expectglobal_stretch_mode_enabledback as it was set.compat_vstays 6, so a decoder that knows only version 10 still accepts it and skips the last field.The second commit can be squashed into Eric's commit without conditions. The test then passes from its own commit on, so the last sentence of its message ("MonMapEncode.umbrella_stretch_mode_without_global fails on the current code.") should be dropped.
Split out of #43. Independent of the other PRs of the split, and based directly on stretchy-C.
Testing
git range-diffshows both identical). f0d2745 adds the commits of mon: carry the stretch fixes proposed for main into stretchy-C #44, which do not touchMonMap. The results below are from stretchy-C abaef77; the build and unit tests on f0d2745 are still running.ninja -k 0 -j20built with no errors or warnings.unittest_mon_monmappassed 4/4 andunittest_osd_monitorpassed 17/17.MonMapEncode.umbrella_stretch_mode_without_globalfailed with "Value of: m.global_stretch_mode_enabled, Actual: true, Expected: false". The other threeunittest_mon_monmaptests passed.prepare_pool_size(); it was not run.mon-stretch/mon-stretch-multi-zone-stretch-set.shpassed, and so didTEST_pool_create_stretch_ecandTEST_pool_create_stretch_replicaincrush/crush-stretch.sh.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