Skip to content

EC Stretch Cluster - #67879

Draft
aainscow wants to merge 241 commits into
ceph:mainfrom
aainscow:stretchy-C
Draft

aainscow wants to merge 241 commits into
ceph:mainfrom
aainscow:stretchy-C

Conversation

@aainscow

Copy link
Copy Markdown
Contributor

This is a collaboration branch

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.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@kamoltat

kamoltat commented May 14, 2026 •

Copy link
Copy Markdown
Member

forced push to rebase against ceph upstream/main since #68409 recently merged into main and caused merge conflict, so I resolved it.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

…licas

stretch_mode_disable_enable runs after a workunit that enables stretch
mode, which now also sets the pool creation defaults to two zones of
two replicas. setUp deletes every pool, which leaves stretch mode but
not its defaults, so _setup_pool created a two-zone pool and its
osd pool set size 4 was refused, as a stretched pool's size follows
from its zones. Create the pool with --num_zones 2 --replica 2 instead,
which gives the size 4 and stretch rule that the checks expect. Not run:
it needs teuthology.

Found by an independent review of
#54; the owner asked for a fix.

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

Assisted-by: Claude Code
Each monitor reports in POOL_DEFAULT_OVERRIDDEN the pool defaults that
are overridden for itself. It used db_pool_default_overrides(), which
counts any masked global value as an override because the set command
must cover every monitor and cannot know the other monitors' hosts. A
monitor knows its own host, so ConfigMonitor::pool_default_db_overrides()
now asks pool_default_source() (ConfigMap::generate_entity_map) for each
option, and a value masked to another host no longer warns. ceph osd
pool default set keeps the conservative check. New standalone test
TEST_health_ignores_mask_of_other_host (not run yet).

Owner review of #54 (override
detection by ConfigMap::generate_entity_map).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
…text

Comparing the design with stretchy-C found passages that contradict
each other and passages that the code has overtaken. As the owner
asked, fix them in one commit:

- 2.1.1/2.1.4: the syntax lacked --min_size and --force_pg_limit;
  --root is not "R2 only", and its default is osd_pool_default_root.
- 2.1.3/2.2 Example 3: --size is refused for a multi-zone replicated
  pool; the example uses --replica 2.
- 2.1.5: the release gate exists (15.3); FastEC also needs a 4096
  multiple chunk size; m >= 1 is checked by the monitor; LRC profiles
  are checked by their plugin; num_zones is 1 or 2 and a pool has at
  most 128 OSDs.
- 5, 11, 11.1: more than two zones are refused for now; only main's
  individual stretch pools span more sites.
- 7.1.2 title, 7.4 wording, 7.3 note, 7.3.2, 7.5: how localized and
  balanced reads choose zones and replicas today.
- 10.1 note: pg_temp already lists primary-capable shards first.
- 11.2: a replicated min_size is 1..replica, per zone.
- 11.5.1: the zone tie-break order since 20cf19c.
- 11.5.3 agrees with 11.2.1 and 11.3 (per-zone min_size).
- 11.8 is a later-release item, as 14.4 says.
- 13.2: no FastEC side effect; placement parameters default.
- 14.1 items 4 and 7a, 14.4 item 2: numbering and references.
- 18: the --root example is an EC pool, as 2.1.5 allows.

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

Assisted-by: Claude Code
generate_entity_map() walks the sections from the least to the most
specific (global, type, name), and a later section's value replaces an
earlier one in the result. Since e65f676 ("mon/ConfigMap: use
ValueSource type for generate_entity_map()") the value sources were
added with emplace(), which keeps the first, so a value set in both
global and mon was reported as coming from global:

    ceph config set global osd_pool_default_replica 2
    ceph config set mon osd_pool_default_replica 3
    ceph config get mon.a     # WHO global, VALUE 3

Record the source with insert_or_assign(), as the value is recorded.
ceph config get <who> and ceph osd pool default get now name the
section that gives the value, and POOL_DEFAULT_OVERRIDDEN, which asks
the same question, sees a mon section override again. The new unit test
failed before this change. The same code is on main.

Not to be squashed: this is a main defect, to be proposed for main too.

Assisted-by: Claude Code
cef2508 stopped checking a min_size default altogether, but only
its check as an EC pool was wrong: EC pools never use
osd_pool_default_min_size. Keep the check against the replicas per zone,
which TEST_set_checks in mon-stretch-pool-defaults.sh expects, and say
so in the design (Section 2.3.3).

Owner review of #54 (16a).

To be squashed into "mon: add ceph osd pool default set and get" before
merge.

Assisted-by: Claude Code
Building pool create's parameters in four steps checks everything
before anything is created, so the command-line and stretch mode checks
now come before the CRUSH rule is generated:

- crush-stretch.sh TEST_pool_create_stretch_ec and
  TEST_pool_create_stretch_replica walk through the rule's errors as
  hosts and OSDs are added. Once one zone had an OSD, the zone weight
  check failed first. The OSDs now join with weight 0 until both zones
  have them, and are reweighted before the pool is created.
- crush-stretch.sh TEST_stretch_diff_bucket_barrier and
  TEST_stretch_diff_sites get the stretch mode check's error ("there are
  0/3 datacenters ...") instead of the rule's.
- mon-stretch-replicated-placement-options.sh: with a rule given, the
  placement options conflict with the rule before num_zones is looked at.

All of crush-stretch.sh and the placement options test pass.

To be squashed into "mon: build and check pool create parameters in
four steps" before merge.

Assisted-by: Claude Code
enable_stretch_mode and disable_stretch_mode now keep paxos plugged, so
the MonMap, configuration and OSDMap change in one round, as
MonmapMonitor::clear_stretch_mode_state() asserts since stretchy-C
f4ba9aa. The MonMap change makes every monitor bootstrap, which
retries each command still waiting for its reply. The retried
disable_stretch_mode found stretch mode gone and failed with "stretch
mode is already disabled" although it had succeeded; before the plug the
OSDMap committed a round later, so the retry happened to find the pools
still stretched. mon-stretch-upgrade.sh TEST_legacy_stretch_mode_then_commit
failed this way.

A repeated disable_stretch_mode now succeeds, as a repeated
enable_stretch_mode already does (design Section 2.3.4). The user sees
the retry's reply, so the replies no longer contradict the first run:
"stretch mode is enabled" or "stretch mode is disabled", with the number
of pools changed only when there were any. On a vstart cluster both
commands replied "0 pool(s) changed" or "already disabled" after changing
every pool.

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

Assisted-by: Claude Code
…eplicas

stretchy-C added TEST_stretch_unstretch_clean after this series was
written. It creates two-zone replicated pools on two hosts per zone, so
it relied on two copies per zone. Pools now default to
osd_pool_default_replica (3) copies per zone, so pool create failed with
"replica 3 per zone requires at least 3 hosts". Ask for two replicas,
as the other tests in this script do.

Squash into: mon,mgr: size new pools as num_zones times the replicas per zone

Assisted-by: Claude Code
Ericmzhang and others added 12 commits October 13, 2026 15:08
Make stretch EC versions of:
 2-dc-1-arbiter-stretch-cluster-netsplit.yaml
stretch-mode-5-mons-8-osds.yaml
mon-stretch-pool.yaml
mon-stretch-uneven-crush-weights.sh
mon-stretch-fail-recovery.sh
The new EC test function was named TEST_stretch_cluster_uneven_crush_weights,
identical to the pre-existing replicated test, so bash kept only the last
definition and the replicated test silently stopped running.  Rename the EC
variant to TEST_EC_stretch_cluster_uneven_crush_weights and factor the ~110
near-duplicate lines (5-mon bring-up, zone/host topology and the stretch-mode
health checks) into _setup_stretch_uneven_cluster and
_run_stretch_uneven_weight_checks, so both tests run and differ only in the
pool-create step.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
The cherry-picked commit accidentally renamed
qa/suites/rados/singleton/ec-feature-test/ec-feature-plugins-v2.yaml into
qa/suites/rados/singleton/all/, which both drops it from the ec-feature-test
sub-suite and silently adds it to the singleton/all run.  Move it back; it is
unrelated to the EC stretch tests.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
Three assertions mis-describe the stretch EC pool state:

* After failing DC1, test_stretch_ec_degraded_and_recovery_mode asserted
  _stretch_mode_disabled_correctly() (stretch fully OFF).  A single-site
  failure leaves stretch mode ENABLED but degraded, so wait for
  degraded_stretch_mode == 1 instead.

* _stretch_mode_enabled_correctly asserted pool size == SIZE/2 (3) while a
  stretch EC pool with num_zones*(k+m) is SIZE (6); the sibling
  stretch_ec_mode_disable_enable.py expects 6.  Assert self.SIZE.

* _stretch_mode_disabled_correctly asserted size == SIZE (6) and crush_rule
  reverting to the replicated rule.  Once stretch is unset the pool is a plain
  EC pool: size k+m (3) with the default EC rule.  Match the sibling.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
…topology

TEST_EC_stretched_cluster_failover_add_three_osds only killed daemons, slept
and printed `ceph -s`; it asserted nothing, so it could never fail.  It also
moved osd.4/osd.5 onto host buckets node-6/node-7 that were never created
(only node-2..node-5 existed) and those unchecked crush moves silently failed.

Build a balanced 3-hosts-per-zone topology (so num-zones=2 k=2 m=1 has a full
stripe in each zone), add `|| return 1` to the crush commands, and assert the
actual behaviour: reach active+clean, seed and read back an object, confirm it
stays readable while the pze site is down, then add replacement OSDs into the
failed site, mark the dead ones out and wait for a clean recovery with the data
intact.  Raw `sleep 3` calls are replaced by wait_for_clean loops.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
…ms to test

The header advertised a CLI test for "ceph osd pool stretch set/show" but the
script never called either command, defined expect_false/expect_true without
using them meaningfully, placed mon g in a datacenter=arbiter that has no
corresponding bucket, and claimed "3 datacenters" when it builds two.

Mirror the replicated sibling mon-stretch-pool.sh: assert the negative cases
(show on an absent/non-stretch pool, set with missing args / absent pool /
absent barrier / absent crush rule all fail), then set the EC pool stretched
across the two datacenters and show it, and finally unset it and confirm show
fails again.  Correct the header to "2 datacenters, 3 hosts each" and drop the
bogus arbiter mon location.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
Remove leftovers that can never run or refer to a non-existent third site:
the unused _set_stretch helper, the fully commented-out
test_mon_failures_in_ec_stretch_pool body, and the commented
_surviving_osds_in_acting_set_dont_exceed(_get_osds_by_dc('dc3')) check
(DC_OSDS only defines dc1 and dc2).

Replace the bare sleep(30) between the degraded-site writes and restoring DC2
with a wait_until_true_and_hold on PGs staying active.  The remaining
sleep(self.WRITE_PERIOD) is kept intentionally: it just lets the background
workload thread start before DC1 is killed, which has no clean condition to
wait on.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
…g params

The cherry-picked commit inserted pool_type and moved num_zones ahead of
min_size/erasure_code_use_overwrites in create_pool's signature, which shifts
every positional argument after erasure_code_crush_rule_name and silently
breaks positional callers.  Restore the original parameter order and append the
new pool_type keyword (default 'replicated') at the end so existing positional
callers keep working while the EC paths keep passing pool_type by keyword.  Also
drop the trailing whitespace the commit added to the pool-create cmd_args lines.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
…etch EC yaml

mon-stretch-ec-pool.yaml listed "overall HEALTH_" and "\(SLOW_OPS\)" twice in
its log-ignorelist; drop the duplicates.  Add the missing trailing newline to
mon-stretch-ec-pool.yaml, the netsplit stretch EC fragment and
setup_stretch_ec_cluster.sh.

The netsplit fragment intentionally carries no roles: the netsplit suite's
cluster.yaml supplies 5 mons and 8 OSDs, matching the sibling replicated
fragment, so no roles block is needed here.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
The cherry-picked commit rewrote pool_hdd creation in
TEST_stretch_replica_device_class_pools from a single checked
"pool create ... --rule stretch_hdd --num-zones 2 || return 1" into a bare
"pool create pool_hdd" (no error check) followed by a separate "pool stretch
set".  This is unrelated to the EC-copy work and drops the error check on pool
creation, so restore the original line.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
The cherry-picked commit bundled an unrelated one-line fix to
qa/tasks/stretch_cluster.py (the replicated stretch test).  Revert that hunk
here so the EC-copy commit stays focused; the fix is re-applied on its own in
the following standalone commit so it can be merged independently.

Squash into 'qa: Make a copy stretch EC versions of stretch replica tests' before merge.
Assisted-by: Claude Code
The wait for partial-active PGs passed the bound method itself,
`lambda: self._pg_partial_active`, instead of calling it.  A method object is
always truthy, so wait_until_true_and_hold returned immediately without ever
evaluating the PG state, making the wait a no-op.  Call the method so the test
actually waits for the condition.

Assisted-by: Claude Code
Add dashboard inputs for num_zones, k, m, CRUSH params (osd_failure_domain,
zone_failure_domain, root, class), replica, min_size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

5 participants