Repository navigation
test/osd: overhaul OSD/EC unit test framework with CRUSH-based placement, ObjectTracker and Multi Zone - #71844
Merged
Merged
Conversation
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
aainscow
force-pushed
the
stretchy-C-tests-only
branch
from
September 18, 2026 13:48
1ad664b to
d47c1bd
Compare
aainscow
force-pushed
the
stretchy-C-tests-only
branch
from
September 21, 2026 06:55
d47c1bd to
1902559
Compare
Contributor
Author
|
Latest rebase on top of the memstore changes, which required small merge conflict resolution. |
aainscow
force-pushed
the
stretchy-C-tests-only
branch
from
September 22, 2026 08:31
1902559 to
6827f4d
Compare
…mpare attrs across shards TearDown() now runs scrub_all_objects() on optimised EC pools when the test has not already failed: it lists the primary's collection and scrubs each object (skipping ones the ObjectTracker says were deleted), so any inconsistency left behind by a test fails it. scrub_object() gains a skip_verify flag. Unless it is set, after the scrub-map comparison it also reads every shard's attributes directly from the store and compares them with the primary's (ignoring nonprimary shards, which legitimately lag), reporting count, value and extra-attribute mismatches as corruption, and finally runs verify_object() against the tracker. Tests that deliberately corrupt a shard pass skip_verify=true. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…y from the OSDMap Move the peering fixture onto OsdTestFixture/TestPG. The four spg_t-keyed maps (pg_states, pg_ctxs, pg_listeners, pg_dpps) go away; each TestPG now owns its ShardDpp, MockPeeringListener, PeeringState and PeeringCtx. Instead of creating k+m peering states up front in SetUp(), the fixture returns false from should_create_test_pgs_upfront() and builds them as the OSDMap is published: - event_advance_map() first ensures an OsdTestFixture exists for every OSD in the map (ensure_osd_fixture_exists(): store + LRU), then schedules advance_map_impl() on each OSD. - advance_map_impl() runs as that OSD: for every shard position the OSD holds in the up set it calls ensure_test_pg_exists(), which creates the TestPG, its collection, ShardDpp, backend listener, ECSwitch and MockPeeringListener, constructs the PeeringState via create_peering_state_common(), runs init_peering() for that PG and queues the Initialize event. It then schedules advance_map() for each parent-PG TestPG on the OSD. - create_child_peering_state() (used by split_pg()) goes through the same OsdTestFixture/TestPG path and create_peering_state_common(). Because a TestPG is created for whatever (osd, shard) the OSDMap reports, shard N no longer has to live on OSD N; this is what the CRUSH-driven fixture in a later commit relies on. Lookups: get_peering_state/ctx/listener(shard) go through find_test_pg_for_shard() (acting-set lookup, falling back to a scan of all fixtures so a down OSD's PG can still be found); no-arg overloads use the EventLoop's current TestPG. get_primary_listener()/backend(), get_child_peering_state(), all_shards_active(), all_shards_clean(), get_state_name(), inject_read_error_for_shard(), apply_new_epoch(), split_pg() and queue_transaction_helper() (now taking a TestPG*) all resolve their store/collection/state through TestPG. update_osdmap_with_peering() no longer calls the base update_osdmap() (whose on_change() scheduling is now done by MockPeeringListener); it sets the new map on the fixture, bumps every listener's current_epoch, updates each backend listener's osdmap/PGPool, and runs new_epoch_loop(). event_initialize(), run_first_peering() and the dne parameter of init_peering() are gone with the upfront creation. The recovery helpers only get the mechanical store/collection lookup change here; they are reworked in a later commit. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…) extension points Two virtual hooks so a derived fixture can drive placement through a real CRUSH map instead of the shard == osd pg_upmap: - use_upmap() (default true) guards installation of the pg_upmap in SetUp(); the upmap loop now runs over get_instance_count() rather than k + m so it also covers multi-zone pools. - pre_peering_hook() (default no-op) is called after the messenger and idle callback are wired but before the first new_epoch_loop(), which is the point at which an OSDMap rewrite must happen to affect the initial peering cycle. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
Snapshot g_ceph_context's config values at the start of SetUp() and put them back in TearDown(), so set_config() calls made by a test cannot leak into the next parameterisation. RollbackAfterMixedBlockedWritesWithOSDFailure3 no longer needs to undo its osd_async_recovery_min_cost change by hand. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
Wrapper around OSDMapTestHelpers::set_pool_min_size() that copies the current map, applies the change and runs a peering cycle, matching mark_osd_down()/mark_osd_up()/advance_epoch(). Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…is_clean() The function only ever checked the primary (in EC pools only the primary tracks PG_STATE_CLEAN), so name it for what it does and update the callers and their assertion messages. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…r_primary run_recovery_and_verify_callbacks(obj, removed_osd, data) and its parallel variant took the OSD that had been down and derived the target shard as pg_shard_t(osd, osd). That only works while shard == osd. Replace them with run_recovery(obj, recover_primary, data) and run_parallel_recovery(objs, recover_primary, datas): - recover_primary == true checks the primary's own missing set; otherwise the helper walks the primary's peer_missing map, checks each entry against that peer's actual missing set, and uses the first peer that is missing the object. The peer's OI is no longer re-read from the primary's store. - Callback/data verification moves out of the impl (which runs inside a scheduled TRANSACTION event) into run_parallel_recovery() after the event loop has drained, because read_object() drains the loop itself and doing that re-entrantly could interleave with in-flight recovery messages and duplicate an EC read tid. - The impl is scheduled from inside EventLoop::run_in_pg() so schedule_transaction() captures the primary's TestPG context rather than whatever the previous event left behind. - After recovery, check_recovery_completion_impl() runs on every acting OSD and, if the PG is RECOVERING with nothing left to recover, clears the state and queues RequestBackfill or AllReplicasRecovered, as PrimaryLogPG::start_recovery_ops() does. Callers in TestECFailoverWithPeering pass recover_primary as (removed_osd == 0) where the loop variable can be the primary, and true/false where it is fixed. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…he rollback tests Pure move, no change to the test body. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
- Look up peering state, listeners and backends via get_primary_test_pg(), get_test_pg_by_shard(), get_first_test_pg_for_osd() and get_test_pg(osd, shard) instead of the shard-indexed accessors, and read a recovered attribute through the OSD fixture's store and the TestPG's collection handle. - Use the tracker-backed verify_object(obj_name) where the expected contents were the last thing written, and read_object() where the test measures the read itself. - Pass num_zones from BackendConfig (every config here uses 1) and skip MultipleOSDFailuresWithPeering unless num_zones == 1; ECRecoveryTest, ECSequentialOSDFailoverTest and the new-OSD id are sized by num_zones. - ScrubDetectsCorruption passes skip_verify=true to scrub_object() and deletes the object it corrupted so the TearDown scrub does not report it. - Many EXPECT_* become ASSERT_* so a failed precondition stops the test instead of cascading. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
…TrackerDetectsCorruption and OSD0DownAddNewOSDRecovery - RollbackBlockedWrite: for each pair of (blocked, failed) shards drawn from shards 0, 1 and k in every zone, blocks a full-stripe write and an attribute write to one shard, fails another, releases both, and verifies the object rolled back to its original contents and that a scrub finds the attributes consistent across shards. - ObjectTrackerDetectsCorruption: corrupts the primary shard and checks that verify_object() reports a data mismatch (via EXPECT_FATAL_FAILURE) and that scrub_object() detects it when the plugin stores per-shard CRCs (ISA) and does not for jerasure. - OSD0DownAddNewOSDRecovery: fails OSD 0, adds a brand-new OSD at shard 0 with OSDMapTestHelpers::new_osd_up(), re-peers, and recovers to it. Assisted-by: IBM Bob v2.1.0 Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5 Signed-off-by: Alex Ainscow <[email protected]>
ECCrushTestFixture derives from ECPeeringTestFixture, returns false
from use_upmap() and uses pre_peering_hook() to replace the minimal
CRUSH map from setup_ec_pool() with build_simple_crush_map() plus an
indep erasure rule ("ec_rule", failure domain osd), point the pool at
that rule, and remove the pg_temp, so the initial peering cycle is
placed by CRUSH. num_zones > 1 aborts; the intended stretch topology is
documented in the header for the follow-up that implements it.
TestECWithCRUSH is parameterised over the same ISA/jerasure k+m/stripe
configurations as the failover tests and has one sanity test,
BasicWriteVerify, that peers, writes a full stripe and verifies it.
Assisted-by: IBM Bob v2.1.0
Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5
Signed-off-by: Alex Ainscow <[email protected]>
Standalone gtest for osdc/SplitOp.h that needs no OSDMap, peering or
IO path: ECStripeIterator/ECStripeView geometry over several (offset,
length, k, chunk_size) combinations, the reference-sub-read abs_shard
formula for multi-zone pools, and the replica LOCALIZE_READS zone
filtering ranges. Unrelated to the fixture rework in the preceding
commits.
The test lives in src/test/osdc/test_splitop.cc rather than under
src/test/osd, so that it mirrors the location of the code it covers
(src/osdc/SplitOp.{h,cc}). It also needs no OSD library: SplitOp.cc is
compiled into libcommon rather than into the osdc library (see
src/CMakeLists.txt), and libcommon comes in via global, so the target
links against global alone.
Assisted-by: IBM Bob v2.1.0
Assisted-by: Claude Code:Claude Opus 5/Claude Opus 4.8/Claude Sonnet 5
Signed-off-by: Alex Ainscow <[email protected]>
aainscow
force-pushed
the
stretchy-C-tests-only
branch
from
October 2, 2026 11:51
e6300ae to
9570fa8
Compare
bill-scales
approved these changes
Oct 2, 2026
bill-scales
left a comment
Contributor
There was a problem hiding this comment.
LGTM - one misalignment nit still
| // TestPG, not in OsdTestFixture. CRUSH may place shard N on any OSD, so | ||
| // shard_id != osd_id in general. | ||
| TestPG* test_pg = osd_fixture->create_pg(shard_spgid, pg_whoami); | ||
| { |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 7, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
Merged
4 of 14 tasks
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 8, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 9, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 9, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 12, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 12, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 13, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 13, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 13, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 13, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
MaxKellermann
added a commit
to MaxKellermann/ceph
that referenced
this pull request
Oct 14, 2026
Bug introduced by commit c9d0c5e ("test/osd: OSDMapTestHelpers: add pool min_size and OSD add/upmap helpers") from PR ceph#71844 (@aainscow). Signed-off-by: Max Kellermann <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This series refactors and significantly extends the OSD backend unit test
infrastructure to support realistic CRUSH-based placement, multi-zone EC
configurations, and systematic object-state verification.
depends-on: #71931
Fixes: https://tracker.ceph.com/issues/80680
Changes
Fixture decoupling and dynamic CRUSH mapping
Previously, OSD test fixtures conflated OSD instances with PG shard instances
via static 1:1 upmap mappings. Fixtures now own per-OSD
ObjectStoreand LRUcache instances, with
TestPGinstances created lazily on OSDMap epochadvancement. This enables tests to evaluate real CRUSH placement rules and
multi-PG scenarios natively.
MockStore factory method and
.ccsplitA static
MockStore::create()factory method now encapsulates construction,mkfs, andmountin one place, returning ashared_ptr. The implementationis moved to
MockStore.ccto keep the header lean.ObjectTracker for expected-state verification
New
ObjectTrackerclass records object modifications (data writes, creates,xattr writes, and omap operations) across transaction commits and reconstructs
expected state for verification in recovery and peering test scenarios.
Multi-zone EC support and fixture iteration fix
BackendConfiggains anum_zonesfield (default 1, preserving existingbehaviour).
simulate_multiple_osd_failuresnow acceptsstd::set<int>anditerates the
osd_fixtures/pgshierarchy correctly for pools wherepool_size = num_zones * (k + m). NewMultiZoneWriteThenReadandMultiZoneFailovertests exercise write, read, and degraded-read paths formulti-zone configurations.
NOTE: The product code is not added here and no test uses num_zones > 1
This will come in a future PR.
PGLogTest pool initialisation
PGLogTestnow initialises a replicated pool (size 3) in its fixtureconstructor, fixing failures in pool-property-dependent test scenarios.
Expanded pgtemp_primaryfirst tests
A comprehensive
pgtemp_primaryfirst_comprehensivesuite exercises multiple(k, m, num_zones)combinations and OSD layout patterns (large IDs,overlapping OSDs, all-same OSDs) to validate roundtrip consistency between
pgtemp_primaryfirstandpgtemp_undo_primaryfirst.Contribution Guidelines
Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.