Skip to content

test/osd: EC extent cache tests for cache invalidation and growth holes - #72684

Merged
aainscow merged 6 commits into
ceph:mainfrom
aainscow:wip-ec-invalidate-replay-tests
Nov 23, 2026
Merged

aainscow merged 6 commits into
ceph:mainfrom
aainscow:wip-ec-invalidate-replay-tests

Conversation

@aainscow

Copy link
Copy Markdown
Contributor

Stacked on #72683, which is stacked on #72666; only the last six commits are new to this PR. Tracker: https://tracker.ceph.com/issues/81754.

These are the tests for the Fast EC extent cache defects fixed in #72683. They combine the tests from #72566 and #72332, which this PR supersedes, with new tests for the remaining cases.

Commits:

  • From test/osd: EC harness fixes and tests for writes queued behind a rollback #72566, unchanged:
    • Two EC peering fixture fixes: wire the backend listeners to the fixture so that read tids are unique, and clear the PG's object contexts on an interval change, as PrimaryLogPG::on_change() does.
    • TestECRollbackPartialWrites: partial-page writes queued behind a rollback, with every byte checked and the object scrubbed.
  • From test/osd: Add EC extent cache growth hole reproducers #72332, unchanged: ECExtentCache.HoleErasedByOlderOpLineDeath and HoleErasedBeforeReadDoneSendReads (unittest_extent_cache), and TestECFailoverWithPeering.ExtentCacheGrowthHoleErasedByLineDeath.
  • New: TestECInvalidateReplay (unittest_ecfailover_with_peering). Another object's RMW read is held at the head of the extent cache queue, so an invalidating op and the writes queued behind it are replayed together. Each test checks every byte and scrubs the object. The invalidating ops are:
    • a rollback, with the object in and out of the extent cache;
    • a remove and recreate in one op, in and out of the extent cache;
    • a stripe-aligned truncate that also grows the object;
    • a truncate and grow that leaves a data shard short;
    • an unaligned truncate whose own read orders the queued reads, as a control.
  • New: re-enables CloneInvalidateStaleSize, TruncateGrowWithSuspendedReads and RollbackInvalidateRealistic, disabled by osd: revert #70377 "Set projected_size to current_size on cache invalidate." #72666. CloneInvalidateStaleSize now checks that the read of the clone target waits for the clone and is then sent for the clone's size.

Results on main with #70377 reverted, without and with #72683:

Test main + #72666 + #72683
TestECInvalidateReplay.Rollback abort, ceph_assert(reads_sent) pass 10/10
TestECInvalidateReplay.CachedRollback old data, 10/10 fail pass 10/10
TestECInvalidateReplay.TruncateGrow old data, 10/10 fail pass 10/10
TestECInvalidateReplay.CachedRecreate old data, 10/10 fail pass 10/10
TestECInvalidateReplay.Recreate abort pass 10/10
TestECInvalidateReplay.TruncateGrowShortShard abort pass 10/10
TestECInvalidateReplay.UnalignedTruncate (control) pass 10/10 pass 10/10
TestECRollbackPartialWrites.* (4 tests; 3 zero-fill with #70377) pass 10/10 pass 10/10
TestECFailoverWithPeering.ExtentCacheGrowthHoleErasedByLineDeath abort pass 10/10
ECExtentCache.HoleErasedByOlderOpLineDeath, HoleErasedBeforeReadDoneSendReads abort pass
ECExtentCache.CloneInvalidateStaleSize abort pass
TestBackendBasics.TruncateGrowWithSuspendedReads, RollbackInvalidateRealistic abort pass 96/96

With #72683 and this PR merged into main, all of unittest_ecfailover_with_peering (338), unittest_backend_basics (888), unittest_extent_cache (12), unittest_ecbackend, unittest_ec_with_crush, unittest_ec_transaction, unittest_ecutil, unittest_ec_omap_journal and the _l variants pass. The new and rollback tests passed 600/600 over 5 repeats. Locally, the ctest unit tests pass (218/219: run-cli-tests fails only on radosgw-admin/help.t, as RGW was not built), as do smoke.sh, safe-to-destroy.sh, crush_weights.sh and run-rbd-unit-tests-*.

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

@bill-scales bill-scales 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.

Tests look good, commit messages need sorting, last commit includes a change to .github!

@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch from e28d373 to c3690dc Compare October 14, 2026 15:18
@aainscow
aainscow marked this pull request as ready for review October 14, 2026 15:22
@aainscow
aainscow requested a review from a team as a code owner October 14, 2026 15:22
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath4-testing-20261016.224944-main.

@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

@lee-j-sanders

Copy link
Copy Markdown
Member

@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch 2 times, most recently from 41464f2 to ac91a85 Compare October 29, 2026 14:32
@SrinivasaBharath

SrinivasaBharath commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Please merge the PR once the review is complete and approved. If a rerun is required, remove the TESTED label and add the needs-qa label.

@bill-scales bill-scales 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

@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch from ac91a85 to 2a924b1 Compare November 10, 2026 10:05
@aainscow

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (head 2a924b1), trivial rebase: main gained new tests (from #72140) at the same place in src/test/osd/TestECFailoverWithPeering.cc where two of these commits add theirs, so I kept both blocks; no code was changed to resolve it. git range-diff shows all 8 commits' patches unchanged apart from diff-hunk context. The two osd/ commits underneath (from #72683) are replayed unchanged on the new base. The rebased test files compile (syntax check); no tests were re-run, the code and the tests are the same as the ones that were QA'd and approved.

@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

@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch from 2a924b1 to 11bcd60 Compare November 16, 2026 10:41
@aainscow

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (head 5759603), trivial rebase: main gained new tests at the same place in src/test/osd/TestECFailoverWithPeering.cc where two of these commits add theirs, so I kept both blocks; no code was changed to resolve it. git range-diff shows all 8 commits unchanged apart from diff-hunk context (and the blank line that separates the two test blocks). The two osd/ commits underneath are still identical to the current head of #72683. This was not compiled or run locally, CI will build it; the code and the tests are otherwise the same as the ones that were QA'd and approved.

@aainscow

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (head f02fb75), trivial rebase: no conflicts, and no change to the remaining patches (git range-diff identical for all 6). The two osd/ECExtentCache commits underneath are dropped because #72683 has merged, so the PR is now only the 6 test commits. The two changed test files compile (syntax check); no tests were re-run.

@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch from 11bcd60 to f02fb75 Compare November 20, 2026 08:47
@aainscow

Copy link
Copy Markdown
Contributor Author

jenkins test api

@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

The MockPGBackendListener of each shard and of each split child was
created without set_osd(), so every op got tid 0. Two reads in flight
on one PG then hit ceph_assert(!tid_to_read_map.contains(tid)).

Set the OSD on each listener so that tids are unique.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
PrimaryLogPG::on_change() clears object_contexts but the mock listener
did not, so a shard that became primary again reused object info and
attrs cached in its previous term, stale after other primaries' writes.

Clear them in MockPeeringListener::on_change() as the real PG does.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
Nothing tested partial-page writes queued behind a rollback of the same
object. Such a write must read back the rolled-back data it does not
overwrite, whether or not the object is in the extent cache.

Queue writes behind a rollback in each case, then check every byte and
scrub the object. Give write_attribute() the run flag that the other op
helpers have, so that a test can queue it.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
An older op dying could erase part of the growth hole of an op that
grows the object. A following op then sent reads that all failed the
read mask, and do_read_op hit ceph_assert(reads_sent). No test covered
this.

Add extent cache unit tests for the two paths that send the bad read,
request() and read_done(), and an EC backend test driving the same
sequence. MultiClient now asserts, as do_read_op does, that each backend
read intersects the read mask.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
An op that invalidates the extent cache (rollback, remove and recreate,
shrinking truncate) replays the ops queued behind it. They read the
object as it was before the invalidation and wrote that stale data back
into the parts of their pages they did not overwrite. No test covered
this.

Queue partial-page writes behind each such op, with the object in and
out of the cache, and check every byte and scrub the object.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
CloneInvalidateStaleSize, TruncateGrowWithSuspendedReads and
RollbackInvalidateRealistic were disabled when the 78465 fix was
reverted. The new fix sends the replayed reads after the invalidating
write, so enable them. CloneInvalidateStaleSize now expects the read of
the clone target to wait for the clone's write and use its size, rather
than be dropped as a hole.

Assisted-by: Claude Code
Signed-off-by: Alex Ainscow <[email protected]>
@aainscow
aainscow force-pushed the wip-ec-invalidate-replay-tests branch from f02fb75 to 0bf4908 Compare November 23, 2026 09:01
@aainscow

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (head 0bf4908), trivial rebase: main gained a new test (from #72290) at the same place in src/test/osd/TestECFailoverWithPeering.cc where one of these commits adds its own, so I kept both blocks; no code was changed to resolve it. git range-diff shows the patches of all 6 commits unchanged apart from diff-hunk context. The changed test files compile (syntax check); no tests were re-run.

@aainscow
aainscow merged commit 83b2a8e into ceph:main Nov 23, 2026
14 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.

4 participants