← Back to Pull requests

mon/OSDMonitor: apply stretch transitions to pending pool changes #59

Closed
unknown closed this pull request without merging on Oct 09, 2026 12:00 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 16:02 UTC
Author

<!--
- Please give your pull request a title like

[component]: [short description]

- Please use this format for each git commit message:

[component]: [short description]

[A longer multiline description]

Fixes: [ticket URL on tracker.ceph.com, create one if necessary]
Signed-off-by: [Your Name] <[your email]>

For examples, use "git log".
-->

A degraded, recovery or healthy stretch mode transition rewrites the peering state of every stretch pool in the
pending OSDMap incremental. It only looked at pools that are stretched in the committed map, and decided by their
committed bucket count. Pool creates and osd pool set commands prepared into the same incremental, about one
paxos_propose_interval before a zone fails or recovers, were therefore missed or overwritten. Found by reading
the code while reviewing https://github.com/aainscow/ceph/pull/47.

| Pending pool change | Transition | Before this PR |
| --- | --- | --- |
| two-zone create, or osd pool set num_zones 2 | degraded | keeps bucket count 2 and no mandatory member: its PGs stay inactive until the other zone returns |
| pool created from the degraded map | healthy | keeps bucket count 1 and the old mandatory member: its PGs can go active in one zone of a healthy cluster |
| the same | recovery | misses set_last_force_op_resend() |
| osd pool set num_zones 1 on a stretch pool | any | gets a bucket count and mandatory member back on top of the unstretch |
| pool deletion | any | gets a new_pools entry |

The pool deletion entry is harmless: OSDMap::apply_incremental() applies new_pools before it erases
old_pools, and scan_for_creating_pgs() skips old_pools. The unstretch case is real: the unit test shows the
pending num_zones 1 pool coming back with bucket count 1 and the surviving zone as mandatory member.

Commits

1. mon/OSDMonitor: share the pool update of the stretch transitions moves the loop that the three
transitions shared into the static OSDMonitor::apply_stretch_transition_to_pools(), so that unit tests can
call it. No change in behaviour.
2. test/mon: demonstrate stretch transitions missing pending pool changes adds
OSDMonitorStretchTransitionTest to unittest_osd_monitor, with each of the pending changes above. All
three tests fail on commit 1.
3. mon/OSDMonitor: apply stretch transitions to pending pool changes makes the helper decide by the pending
copy of each pool. It updates the stretch pools in new_pools (creates and num_zones 2 included), then the
committed stretch pools that have no pending copy, and skips pools in old_pools.

What this does not change

  • When the last stretch pool is unstretched or deleted, the pending incremental also turns stretch mode off.

  • A transition cannot then overwrite that with the committed stretch_mode_enabled:
    MonmapMonitor::clear_stretch_mode_state() clears Monitor::stretch_mode_engaged at once, and every
    Monitor entry point to the three transitions, including the retry contexts, returns early when
    is_stretch_mode() is false.
  • Known remaining gap (out of scope): the create and osd pool set num_zones 2 paths still copy the stretch

  • state from the committed osdmap, not from pending_inc. That covers the global stretch mode branch of
    prepare_new_pool() with degraded_stretch_mandatory_member(), and the per-pool branch of
    try_enable_stretch_mode(). With this PR, I know of no window where that is wrong: each transition calls
    propose_pending() itself, and a command that arrives later waits for that commit, because
    is_writeable() needs a pending incremental. Reading the pending state would remove the dependence on that
    ordering. That belongs with the ongoing rework of enable_stretch_mode and of the pool defaults, so it is
    left for it.

    Testing

  • unittest_osd_monitor: the three new tests fail on commit 1 (log excerpt below) and pass with commit 3; all 20

  • tests pass.
  • unittest_osdmap (the other test that includes mon/OSDMonitor.h): 46 tests pass.

  • Changed lines compiled with clang 19 -Wall -Wextra: no warnings.

  • Standalone, one at a time, 1 GiB OSDs: all pass, no cores:

  • - mon-stretch-pool-create-degraded.sh and mon-stretch-ec-pool-create-degraded.sh, which go through the
    degraded, recovery and healthy transitions with a pool created while degraded;
    - mon-stretch-fail-recovery.sh and crush/crush-stretch.sh;
    - the other qa/standalone/mon-stretch suites: mon-stretch-commands.sh,
    mon-stretch-failed-create-mons.sh, mon-stretch-failed-pool-create.sh,
    mon-stretch-pool-create-default-profile.sh, mon-stretch-pool-create-positional.sh,
    mon-stretch-replicated-placement-options.sh, mon-stretch-uneven-crush-weights.sh and
    osd-pool-set-replica.sh.

    <details>
    <summary>The new tests on commit 1</summary>

    DegradedCoversPendingPools, to bucket count 1 with zone -3 mandatory: FAILED
      pool 2 (num_zones 2 pending): bucket count 2, mandatory NONE, last_force_op_resend 0
      pool 6 (create pending):      bucket count 2, mandatory NONE, last_force_op_resend 0
      pool 3 (num_zones 1 pending): bucket count 1, mandatory -3, last_force_op_resend 100
      pool 4 (delete pending):      has a new_pools entry
    HealthyCoversPendingPools, to bucket count 2 with no mandatory member: FAILED
      pool 2 (create pending):      bucket count 1, mandatory -2, last_force_op_resend 0
    RecoveryCoversPendingPools: FAILED
      pool 2 (create pending):      last_force_op_resend 0
      pool 3 (delete pending):      has a new_pools entry
    

    </details>

    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)
    - [x] Code cleanup (no ticket needed)
  • Component impact

  • - [ ] Affects Dashboard, opened tracker ticket
    - [ ] Affects Orchestrator, opened tracker ticket
    - [x] No impact that needs to be tracked
  • Documentation (select at least one)

  • - [ ] Updates relevant documentation
    - [x] No doc update is appropriate
  • Tests (select at least one)

  • - [x] Includes unit test(s)
    - [ ] Includes integration test(s)
    - [x] Includes bug reproducer
    - [ ] No tests

    <details>
    <summary>Show available Jenkins commands</summary>

  • jenkins test classic perf Jenkins Job | Jenkins Job Definition

  • jenkins test crimson perf Jenkins Job | Jenkins Job Definition

  • jenkins test signed Jenkins Job | Jenkins Job Definition

  • jenkins test make check Jenkins Job | Jenkins Job Definition

  • jenkins test make check arm64 Jenkins Job | Jenkins Job Definition

  • jenkins test submodules Jenkins Job | Jenkins Job Definition

  • jenkins test dashboard Jenkins Job | Jenkins Job Definition

  • jenkins test dashboard cephadm Jenkins Job | Jenkins Job Definition

  • jenkins test api Jenkins Job | Jenkins Job Definition

  • jenkins test docs ReadTheDocs | Github Workflow Definition

  • jenkins test ceph-volume all Jenkins Jobs | Jenkins Jobs Definition

  • jenkins test windows Jenkins Job | Jenkins Job Definition

  • jenkins test rook e2e Jenkins Job | Jenkins Job Definition
  • You must only issue one Jenkins command per-comment. Jenkins does not understand
    comments with more than one command.
    </details>

    🤖 Generated with Claude Code

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: kamoltat Review duration: 1197m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #59"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository