Skip to content

mon/MonMap: encode the umbrella monmap as struct version 11 - #45

Merged
aainscow merged 2 commits into
stretchy-Cfrom
wip-stretchy-C-monmap-v11
Oct 7, 2026
Merged

aainscow merged 2 commits into
stretchy-Cfrom
wip-stretchy-C-monmap-v11

Conversation

@aainscow

@aainscow aainscow commented Oct 7, 2026

Copy link
Copy Markdown
Owner

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 to stretch_mode_enabled. So once a --num-zones 2 pool create enables stretch mode, every monitor decodes the monmap with global stretch mode enabled too, as if ceph mon enable_stretch_mode had 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 refuses num_zones > 1 creates in global stretch mode, the create that enabled stretch mode is also refused when it is resent after the election.

  • test/mon: demonstrate an umbrella monmap decoding as global stretch mode. Two unittest_mon_monmap tests set stretch_mode_enabled, encode the monmap with all features (which include SERVER_UMBRELLA), decode it, and expect global_stretch_mode_enabled back as it was set.
  • mon/MonMap: encode the umbrella monmap as struct version 11, as before Eric's commit. compat_v stays 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

  • This branch is stretchy-C f0d2745 with these two commits, rebased unchanged (git range-diff shows both identical). f0d2745 adds the commits of mon: carry the stretch fixes proposed for main into stretchy-C #44, which do not touch MonMap. The results below are from stretchy-C abaef77; the build and unit tests on f0d2745 are still running.
  • On abaef77 with these two commits, a full ninja -k 0 -j20 built with no errors or warnings. unittest_mon_monmap passed 4/4 and unittest_osd_monitor passed 17/17.
  • At the test commit alone, MonMapEncode.umbrella_stretch_mode_without_global failed with "Value of: m.global_stretch_mode_enabled, Actual: true, Expected: false". The other three unittest_mon_monmap tests passed.
  • The refusal of later EC pool creates on plain stretchy-C comes from reading prepare_pool_size(); it was not run.
  • The standalone tests that failed without this fix need refusals that later PRs of the split add. At the tip of the split, mon-stretch/mon-stretch-multi-zone-stretch-set.sh passed, and so did TEST_pool_create_stretch_ec and TEST_pool_create_stretch_replica in crush/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 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

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
@aainscow
aainscow marked this pull request as ready for review October 7, 2026 11:31
@aainscow
aainscow merged commit aacff39 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant