Skip to content

doc/dev: ec_stretch_cluster: describe entering and leaving stretch mode - #57

Closed
aainscow wants to merge 1 commit into
stretchy-Cfrom
wip-stretchy-C-stretch-mode-doc
Closed

aainscow wants to merge 1 commit into
stretchy-Cfrom
wip-stretchy-C-stretch-mode-doc

Conversation

@aainscow

@aainscow aainscow commented Oct 8, 2026

Copy link
Copy Markdown
Owner

The stretch mode state machine in the EC stretch cluster design doc (Section 11.3) entered stretch mode only with enable_stretch_mode and left it only from Healthy with disable_stretch_mode. That is global stretch mode. Pools with --num_zones 2 use per-pool stretch mode, which works differently on stretchy-C. This PR updates Section 11.3 to describe the code as it is, and asks reviewers to decide the open questions below. No code changes.

What the section now says:

  • Entering: the first pool given num_zones = 2 (osd pool create ... --num_zones 2 or osd pool set <pool> num_zones 2) enables stretch mode. It lists:
    • the checks: two zones of similar weight, monitors in both zones, exactly one monitor outside them, connectivity support;
    • the MonMap changes: connectivity election strategy, tiebreaker, disallowed leader, stretch_mode_enabled;
    • the OSDMap flags and the pool's peering_crush_* fields.
  • Leaving: deleting the last stretch pool (_prepare_remove_pool -> is_last_stretch_pool() -> clear_stretch_mode_state(), a86a2a3) or setting it to num_zones 1 (a1dbca8, 1e62a12) disables stretch mode from any state: Healthy, Degraded or Recovery. This:
    • clears tiebreaker_mon, every disallowed leader (including ones added with ceph mon add disallowed_leader) and stretch_marked_down_mons, and leaves the election strategy at connectivity;
    • clears all OSDMap stretch flags, including degraded and recovering.
  • Degraded, Recovery and Healthy: what triggers each transition and what it changes.
  • Global stretch mode (legacy): ceph mon enable_stretch_mode and disable_stretch_mode. num_zones cannot change, deleting pools never leaves stretch mode, and disable_stretch_mode is the only exit. It is refused outside global stretch mode, and refused in Recovery but not in Degraded.
  • Contradictions removed:
    • the prerequisite "Stretch mode must be enabled on the cluster" and the "Pool Creation Gate" (creating a num_zones = 2 pool now enables stretch mode);
    • the note that a pool created after mon enable_stretch_mode in degraded mode gets no mandatory member (prepare_new_pool sets it).

Questions for reviewers

The doc describes the behaviour as it is and records these as open questions (Section 11.3.3):

  1. Leaving stretch mode while Degraded or Recovery. Deleting the last stretch pool, or setting it to num_zones 1, clears the degraded and recovering flags and stretch_marked_down_mons without a transition to Healthy, while the failed zone may still be down. ceph mon disable_stretch_mode is refused in Recovery. Should the per-pool exits be refused (or deferred) in Degraded or Recovery too, or is leaving at once intended, because no stretch pool is left to protect? This was first raised in mon, qa: fix the rados:thrash-erasure-code-stretch failures #52.

  2. Entering can leave the MonMap in stretch mode with no stretch pool. This is from reading the code; it was not run.

    • osd pool set <pool> num_zones 2 stages the MonMap change before it checks the zone weights, so a refusal for uneven weights still commits the MonMap change.
    • osd pool create --num_zones 2 proposes the MonMap change in its own Paxos round. If the client does not resend the command after the election, the pool is never created.

    Should both commit the MonMap change only with the pool, in one round, as pool delete does since a86a2a3?

  3. A later pool's zone failure domain is checked to split the cluster into two zones, but not against the OSDMap's stretch_mode_bucket, as it is in global stretch mode (validate_stretch_mode_new_pool). Should it be?

Checks

  • docutils 0.20.1 (rst2html, with .. code:: standing in for the Sphinx mermaid and ditaa directives): the same four messages before and after this change: two Sphinx-only roles, the ditaa stand-in, and an existing list warning in Section 14. None is in Section 11.
  • mermaid 11.17.2 (mermaid.parse() under jsdom): the new state diagram and the three existing sequence diagrams parse. A deliberately broken diagram is rejected.
  • No Sphinx docs build was run.

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

The state machine in Section 11.3 entered stretch mode with
enable_stretch_mode and left it only from Healthy with
disable_stretch_mode. Per-pool stretch mode does neither:

- the first pool given num_zones 2, at creation or with 'osd pool set
  num_zones 2', enables it;
- deleting the last stretch pool or setting it to num_zones 1 disables
  it, from Healthy, Degraded or Recovery.

Describe what entering and leaving change in the MonMap (tiebreaker,
disallowed leaders, election strategy) and the OSDMap, the degraded,
recovery and healthy transitions, and how global stretch mode differs.
'mon disable_stretch_mode' only leaves global stretch mode and is
refused in Recovery.

Ask reviewers whether leaving in Degraded or Recovery should be
refused, whether entering should commit the MonMap with the pool, and
whether a later pool's zone failure domain should be checked.

Drop the statements that contradict the code: the prerequisite and
the pool creation gate that require stretch mode to be enabled before
a num_zones 2 pool is created, and the note that a pool created after
'mon enable_stretch_mode' in degraded mode gets no mandatory member.

Assisted-by: Claude Code
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 8, 2026
aainscow added a commit that referenced this pull request Oct 9, 2026
Folds the still-current parts of
#57 ("doc/dev: ec_stretch_cluster:
describe entering and leaving stretch mode") into this design, as the
owner asked, so that #57 can be closed:

- 11.3.1 Entering Stretch Mode: what is checked, what changes in the
  MonMap, the OSDMap and the pool, and how the Paxos rounds of osd pool
  set and osd pool create differ.
- 11.3.2 Degraded, Recovery and Healthy, in detail.
- 11.3.3 Leaving Stretch Mode through pool delete, num_zones 1 or
  disable_stretch_mode, and that the first two leave from any state.
- The open questions on leaving in Degraded or Recovery, and on a MonMap
  left in stretch mode with no stretch pool.

Left out because this design replaces it: #57's Section 11.3.4 on global
stretch mode, the global_stretch_mode_enabled flag, and the reset of a
pool to osd_pool_default_size. #57's question whether a later pool's
zone type is checked against stretch_mode_bucket is answered here: it
is, at creation and at num_zones 2. 11.4.2 now refers to 11.3.1 and
11.3.3 rather than repeating them.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 9, 2026
ceph osd pool create already refuses a new two-zone pool, while stretch
mode is enabled, unless its rule covers the same zone buckets of the
stretch mode zone type as the other stretch pools
(validate_stretch_mode_new_pool). ceph osd pool set <pool> num_zones 2
did not check this, so a pool could join stretch mode across other
buckets or another zone type. Both now make the same check, as the
design says in Section 11.3.1.

The owner asked for this while folding
#57 into this PR: #57 asked
whether a later pool's zone type is checked against stretch mode.

Test: TEST_stretch_diff_sites in crush-stretch.sh,
which refuses pool create with a rule over other zone buckets, now
also refuses num_zones 2 with that rule.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
@aainscow

aainscow commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

Folded into #54 by f850beb, updated for the global stretch mode refactor: Sections 11.3.1–11.3.3 and the two open questions on leaving in Degraded/Recovery and on a MonMap left in stretch mode. Section 11.3.4 is not carried over, because #54 replaces global stretch mode. The question on checking a later pool's zone type is answered in #54: it is checked at creation and at num_zones 2. Closing.

@aainscow aainscow closed this Oct 9, 2026
aainscow added a commit that referenced this pull request Oct 13, 2026
Folds the still-current parts of
#57 ("doc/dev: ec_stretch_cluster:
describe entering and leaving stretch mode") into this design, as the
owner asked, so that #57 can be closed:

- 11.3.1 Entering Stretch Mode: what is checked, what changes in the
  MonMap, the OSDMap and the pool, and how the Paxos rounds of osd pool
  set and osd pool create differ.
- 11.3.2 Degraded, Recovery and Healthy, in detail.
- 11.3.3 Leaving Stretch Mode through pool delete, num_zones 1 or
  disable_stretch_mode, and that the first two leave from any state.
- The open questions on leaving in Degraded or Recovery, and on a MonMap
  left in stretch mode with no stretch pool.

Left out because this design replaces it: #57's Section 11.3.4 on global
stretch mode, the global_stretch_mode_enabled flag, and the reset of a
pool to osd_pool_default_size. #57's question whether a later pool's
zone type is checked against stretch_mode_bucket is answered here: it
is, at creation and at num_zones 2. 11.4.2 now refers to 11.3.1 and
11.3.3 rather than repeating them.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
ceph osd pool create already refuses a new two-zone pool, while stretch
mode is enabled, unless its rule covers the same zone buckets of the
stretch mode zone type as the other stretch pools
(validate_stretch_mode_new_pool). ceph osd pool set <pool> num_zones 2
did not check this, so a pool could join stretch mode across other
buckets or another zone type. Both now make the same check, as the
design says in Section 11.3.1.

The owner asked for this while folding
#57 into this PR: #57 asked
whether a later pool's zone type is checked against stretch mode.

Test: TEST_stretch_diff_sites in crush-stretch.sh,
which refuses pool create with a rule over other zone buckets, now
also refuses num_zones 2 with that rule.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
Folds the still-current parts of
#57 ("doc/dev: ec_stretch_cluster:
describe entering and leaving stretch mode") into this design, as the
owner asked, so that #57 can be closed:

- 11.3.1 Entering Stretch Mode: what is checked, what changes in the
  MonMap, the OSDMap and the pool, and how the Paxos rounds of osd pool
  set and osd pool create differ.
- 11.3.2 Degraded, Recovery and Healthy, in detail.
- 11.3.3 Leaving Stretch Mode through pool delete, num_zones 1 or
  disable_stretch_mode, and that the first two leave from any state.
- The open questions on leaving in Degraded or Recovery, and on a MonMap
  left in stretch mode with no stretch pool.

Left out because this design replaces it: #57's Section 11.3.4 on global
stretch mode, the global_stretch_mode_enabled flag, and the reset of a
pool to osd_pool_default_size. #57's question whether a later pool's
zone type is checked against stretch_mode_bucket is answered here: it
is, at creation and at num_zones 2. 11.4.2 now refers to 11.3.1 and
11.3.3 rather than repeating them.

To be squashed into "doc/dev: ec_stretch_cluster: refactor global
stretch mode" before merge.

Assisted-by: Claude Code
aainscow added a commit that referenced this pull request Oct 13, 2026
ceph osd pool create already refuses a new two-zone pool, while stretch
mode is enabled, unless its rule covers the same zone buckets of the
stretch mode zone type as the other stretch pools
(validate_stretch_mode_new_pool). ceph osd pool set <pool> num_zones 2
did not check this, so a pool could join stretch mode across other
buckets or another zone type. Both now make the same check, as the
design says in Section 11.3.1.

The owner asked for this while folding
#57 into this PR: #57 asked
whether a later pool's zone type is checked against stretch mode.

Test: TEST_stretch_diff_sites in crush-stretch.sh,
which refuses pool create with a rule over other zone buckets, now
also refuses num_zones 2 with that rule.

To be squashed into "mon: replace global stretch mode with per-pool
num_zones commands" before merge.

Assisted-by: Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant