Skip to content

osd/ECUtil: io_exerciser: fix two test-only defects - #72295

Merged
aainscow merged 4 commits into
ceph:mainfrom
aainscow:wip-ec-test-only-fixes
Oct 13, 2026
Merged

aainscow merged 4 commits into
ceph:mainfrom
aainscow:wip-ec-test-only-fixes

Conversation

@aainscow

@aainscow aainscow commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Two small fixes for defects that only affect unit tests or test tools. Neither
changes the behaviour of an OSD or a client.

Fixes: https://tracker.ceph.com/issues/81296

osd/ECUtil: initialise all_shards in every stripe_info_t constructor

Three of the stripe_info_t constructors used only by unit tests left the const
all_shards member empty:

  • (k, m, stripe_width, chunk_mapping)
  • (k, m, stripe_width, pool)
  • (k, m, stripe_width, pool, chunk_mapping)

get_all_shards() then returned an empty set, so loops over it were silently
skipped in tests built on these constructors. For example, unittest_scrubber_be's
TestPg uses the pool constructor. They now call calc_all_shards(k + m), as the
other constructors do. The production (ec_impl) constructor is unchanged.

The new test ECUtil.get_all_shards_every_constructor checks every test
constructor. All 28 tests in unittest_ecutil pass. With the fix reverted, the
new test fails for the three constructors.

common/io_exerciser: honour a 0% balanced read percentage

RadosIo chose a balanced read when a random index in [0, 100) was
<= balanced_read_percentage. So
ceph_test_rados_io_sequence --balanced_read_percentage 0 still balanced about 1%
of its reads, and every setting was one point too high. It now compares with <.
The default of 100 still balances every read. There is no separate test: the
off-by-one follows from the range of the index.

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.

@aainscow
aainscow requested a review from a team as a code owner October 1, 2026 13:32
@aainscow aainscow self-assigned this Oct 1, 2026
@aainscow aainscow changed the title osd/ECUtil, io_exerciser: fix two test-only defects osd/ECUtil: io_exerciser: fix two test-only defects Oct 1, 2026
@aainscow
aainscow requested a review from JonBailey1993 October 1, 2026 14:38

@JonBailey1993 JonBailey1993 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath19-testing-20261002.123021-main.

@github-actions

github-actions Bot commented Oct 2, 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

@aainscow
aainscow force-pushed the wip-ec-test-only-fixes branch from 4dfa323 to 6020b08 Compare October 6, 2026 09:54
@lee-j-sanders

Copy link
Copy Markdown
Member

@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@aainscow
aainscow force-pushed the wip-ec-test-only-fixes branch from 6020b08 to e859157 Compare October 13, 2026 09:17
Only the ec_impl constructor and the plain (k, m, stripe_width) test
constructor initialised the const all_shards member. The (k, m,
stripe_width, chunk_mapping), (k, m, stripe_width, pool) and (k, m,
stripe_width, pool, chunk_mapping) constructors left it empty, so
get_all_shards() returned an empty set and any loop over it was silently
skipped in the unit tests built on them (for example the scrub backend
tests, whose TestPg uses the pool constructor).

Initialise it with calc_all_shards(k + m) as the other constructors do.
These constructors are only used by unit tests; the production (ec_impl)
constructor is unchanged, so this is a test-only defect with no effect
on the OSD.

Tested by ECUtil.get_all_shards_every_constructor in the following
commit. unittest_ecutil, unittest_ecbackend, unittest_extent_cache and
unittest_ec_transaction all pass.

Fixes: https://tracker.ceph.com/issues/81296
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
Tests "osd/ECUtil: initialise all_shards in every stripe_info_t
constructor".

ECUtil.get_all_shards_every_constructor builds a k=2, m=1 stripe_info_t
with each of the test constructors ((k, m, stripe_width), (k, m,
stripe_width, chunk_mapping), (k, m, stripe_width, pool) and (k, m,
stripe_width, pool, chunk_mapping)) and checks that get_all_shards()
returns shards 0..2. Without the fix the last three return an empty set,
so code that iterates get_all_shards() silently does nothing under test
harnesses such as unittest_scrubber_be, whose TestPg builds its
stripe_info_t with the (k, m, stripe_width, pool) constructor.

Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
RadosIo chose a balanced read when a random index in [0, 100) was
<= balanced_read_percentage, which is true for percentage + 1 of the
100 values.  ceph_test_rados_io_sequence --balanced_read_percentage 0
therefore still sent about 1% of its reads with
OPERATION_BALANCE_READS, so a run meant to exercise only primary
reads did not, and every other setting was one point too high.
Compare with < so that the percentage is the share of balanced reads;
the default of 100 still makes every read balanced.

This is a test-only defect: io_exerciser is used only by the
ceph_test_rados_io_sequence tool, and the only effect is on the flags
that tool puts on its own reads. There is no separate test: the
off-by-one follows from the range of the index.

Fixes: https://tracker.ceph.com/issues/81296
Assisted-by: Claude Code

Signed-off-by: Alex Ainscow <[email protected]>
This is a defect in the unit test fixtures only; the OSD and monitor
code are unaffected.

OSDMap::Incremental::new_state is XORed into an OSD's state, so setting
CEPH_OSD_EXISTS for an OSD that already exists destroys it: its state,
osd_info (up_from, up_thru, down_at) and xinfo are cleared. The
fixtures marked OSDs down with new_state = CEPH_OSD_EXISTS
(OSDMapTestHelpers::mark_osd_down() and mark_osds_down(), used by
ECPeeringTestFixture, and the OSD failure simulations in
TestBackendBasics.cc), so every OSD a test took down was destroyed
rather than marked down. The helpers restored the xinfo features
afterwards to keep peering working, and mark_osd_up() recreated the
OSD with CEPH_OSD_EXISTS | CEPH_OSD_UP.

Toggle only CEPH_OSD_UP, as OSDMonitor does when it marks an OSD down,
and drop the xinfo workaround; every place that marks OSDs down now
asserts that they are up. mark_osd_up() asserts the OSD is down and
boots it with new_up_client, as OSDMonitor does, which also sets
up_from, so has_been_up_since() no longer accepts messages the OSD sent
before it went down.

Fixes: https://tracker.ceph.com/issues/81296
Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-ec-test-only-fixes branch from e859157 to 8ca8a5e Compare October 13, 2026 10:17
@aainscow
aainscow merged commit e83d91f into ceph:main Oct 13, 2026
14 checks passed
@github-actions

Copy link
Copy Markdown

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
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/38404470402

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.

4 participants