Skip to content

test/osd: three-zone stretch EC unit tests - #42

Merged
aainscow merged 3 commits into
stretchy-Cfrom
wip-stretchy-C-three-zone-tests
Oct 6, 2026
Merged

aainscow merged 3 commits into
stretchy-Cfrom
wip-stretchy-C-three-zone-tests

Conversation

@aainscow

@aainscow aainscow commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Three test-only commits that add three-zone coverage for stretch erasure coded pools to the OSD unit tests. No production code changes: only src/test/osd/TestECActingStretch.cc, TestECFailoverWithPeering.cc and TestECWithCRUSH.cc are touched (+181 -34).

Commits

  1. test/osd: cover growing a stretch EC pool from two zones to three (TestECActingStretch.cc).
    • TestECActingStretch3Zone already covered going from three zones to two. It now also covers the reverse: calc_ec_acting_stretch() for a 2-zone acting set growing into a 3-zone up set, where the new zone's OSDs answer with empty infos.
    • ZoneTransition_TwoToThree checks that the new zone's OSDs are recovered from the log when it reaches back far enough, and are backfilled when it has been trimmed.
    • ZoneTransition_TwoToThree_NewZoneFirst lets CRUSH put the new zone first. It checks that want uses no OSD twice, keeps each zone block in one datacenter and keeps every OSD that holds data.
  2. test/osd: run TestECFailoverWithPeering with three zones (TestECFailoverWithPeering.cc).
    • Adds ISA k=2 m=1 and k=4 m=2 configurations with num_zones = 3, so every test that fits their geometry also runs with three zones.
    • The tests that fail a whole zone go through degraded stretch mode, which is defined only for two zones. They are now limited to num_zones == 2 instead of > 1.
    • The new ThreeZoneZoneLossPeeredUntilZoneReturns takes each zone of a three-zone pool down in turn. It checks that the PG stops being active, brings the zone back and reads the object.
  3. test/osd: check local_zone_for_acting_set with three zones (TestECWithCRUSH.cc).
    • TestLocalZoneForActingSet takes its zone count from the fixture, and a new three-zone fixture covers how SplitOp::local_zone_for_acting_set() chooses among more than two zones.
    • A client in zone 2 reads from zone 2.
    • When the client's zone has no OSDs in the acting set, the remaining zones tie and zone 0 is chosen, also when the missing zone is the middle one.

Testing

On this branch (stretchy-C fb56ba2 plus these three commits):

  • Build: ninja -j20 unittest_ec_acting_stretch unittest_ecfailover_with_peering unittest_ec_with_crush succeeded, with no warnings.
  • Filtered to the new tests:
    • unittest_ec_acting_stretch --gtest_filter='TestECActingStretch3Zone.ZoneTransition_TwoToThree*': 2/2 passed.
    • unittest_ec_with_crush --gtest_filter='TestLocalZoneForActingSet3Zone.*': 3/3 passed.
    • unittest_ecfailover_with_peering, filtered to the EC_ISA_Opt_k2m1_zones3 and EC_ISA_Opt_k4m2_zones3 configurations plus ThreeZoneZoneLossPeeredUntilZoneReturns: 102 run, 47 passed, 55 skipped, 0 failed.
      • k2m1_zones3: 17 passed, 27 skipped.
      • k4m2_zones3: 30 passed, 14 skipped.
      • ThreeZoneZoneLossPeeredUntilZoneReturns passed on both three-zone configurations.
  • Full runs:
    • unittest_ec_acting_stretch: 34/34 passed.
    • unittest_ec_with_crush: 28/28 passed.
    • unittest_ecfailover_with_peering: 704 run, 423 passed, 281 skipped, 0 failed, in 3 min 21 s.
  • The zone tests now limited to num_zones == 2 still pass on all four 2-zone configurations. The exceptions are three tests that skip on k2m1_zones2 because of their existing k >= 3 check.
  • How the binaries were run:
    • PGBackendTestFixture loads the EC plugins from a relative ./lib, so the binaries were run from a directory with a lib symlink to the build's lib. They were not run under ctest.
    • If the plugins cannot be loaded, ECPeeringTestFixture::SetUp() dereferences a null messenger and segfaults instead of failing. That behaviour is pre-existing and not changed here.
  • git log --check is clean.

Notes for reviewers

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

https://claude.ai/code/session_012ETDivFUQubLqznTDowHRu

TestECActingStretch3Zone had a three-to-two zone transition but not the
reverse. calc_two_to_three() runs calc_ec_acting_stretch() for a 2-zone
acting set growing into a 3-zone up set, with the new zone's OSDs
answering the primary's query with empty infos.

ZoneTransition_TwoToThree checks that the new zone's OSDs are recovered
from the log when it reaches back far enough, and are backfilled,
serving nothing yet, when it has been trimmed.
ZoneTransition_TwoToThree_NewZoneFirst lets CRUSH put the new zone
first and checks that want uses no OSD twice, keeps each zone block in
one datacenter and keeps every OSD that holds data.

Assisted-by: Claude Code
Add ISA k=2 m=1 and k=4 m=2 configurations with num_zones = 3, so every
TestECFailoverWithPeering test that fits their geometry also runs with
three zones.

The tests that fail a whole zone go through degraded stretch mode,
which the monitor, and OSDMapTestHelpers like it, define only for two
zones. Limit those to num_zones == 2 rather than > 1.

ThreeZoneZoneLossPeeredUntilZoneReturns covers losing a zone of a
three-zone pool instead: without degraded stretch mode every zone must
still meet min_size, so the PG must stop being active. It takes each
zone down in turn, checks the PG is no longer active, brings the zone
back and reads the object.

This asserts the current OSD behaviour:
OSDMap::stretch_ec_num_acting_below_min_size() applies min_size to each
zone, the per-zone interpretation of design section 11.2.2. If the OSD
moves to the per-pool interpretation of section 11.2.1, this test
changes with it.

Assisted-by: Claude Code
TestLocalZoneForActingSet built only two zones, so how
SplitOp::local_zone_for_acting_set() chooses among more zones was not
covered. Take the zone count from the fixture and add a three-zone
fixture: a client in zone 2 reads from zone 2, and when the client's
zone has no OSDs in the acting set the remaining zones tie at root
level and zone 0 is chosen, also when the missing zone is the middle
one.

Assisted-by: Claude Code
@aainscow
aainscow marked this pull request as ready for review October 6, 2026 12:38
@aainscow
aainscow merged commit 0ef148d into stretchy-C Oct 6, 2026
5 of 6 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