Skip to content

test/osd: recreate corrupt last complete resulting in cloning of non-existing object - #71526

Merged
aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip-aainscow-68649-test
Sep 17, 2026
Merged

aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip-aainscow-68649-test

Conversation

@aainscow

@aainscow aainscow commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Before this change the EC peering unit-test fixture could drive recovery
and OSD failover, but had no way to reach the state behind tracker 68649:
a primary that believes a still-missing shard is up to date and forwards
a clone to it.  Reaching that needs aggressive PG-log trimming, control
over which child a PG split sends an object to, and an actual PG split -
none of which the fixture could do.

This adds that capability to ECPeeringTestFixture and friends:

  • Opt-in aggressive log trimming on the write path (it now computes a
      real trim_to / pg_committed_to via update_trim_to()/complete_write(),
      as PrimaryLogPG does) so a shard's log can be driven to the trimmed and
      empty states that a low osd_*_pg_log_entries produces in the field.
  • Per-object hash control, so an object can be steered into a chosen
      child PG when pg_num increases.
  • A real PG split (split_pg): it bumps pg_num, runs the production
      PeeringState::split_into, splits the ObjectStore collection, and peers
      the child PG - including the pg_temp cycle the child primary needs to
      finish peering.
  • Epoch-gated, correctly-routed delivery of deferred peering events in
      MockPeeringListener, matching PG::do_peering_event()/pg_has_reset_since:
      a deferred event (e.g. ActivateCommitted, DoRecovery) queued in a prior
      interval is now discarded rather than delivered into Reset, and is
      delivered to the listener's own PG (parent vs split child).  Without
      this the fixture aborted once the fix let recovery actually run.

Two tests are added.  DivergentLogRewindThenSplit builds the corrupt
state through the real code paths - trim to a high tail, an
async-recovery target that rolls forward uncommitted EC writes,
proc_replica_log's divergent rewind, then a real split - and asserts the
gate PrimaryLogPG uses before issuing a clone (is_degraded_or_backfilling
/ should_send_op, both of which need peer_missing[target].is_missing).
DivergentLogRewindThenNewInterval is a negative control: a plain interval
change instead of a split does not reproduce it (the primary re-requests
the target's log), showing the split is required.

DivergentLogRewindThenSplit fails on this commit alone and passes once
the following reset_complete_to fix is applied.

Assisted-by: Claude:Claude-opus-4.8(1M)
Assisted-by: IBM-Bob-v2.0.1
Signed-off-by: Alex Ainscow [email protected]

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 September 3, 2026 14:03
@aainscow
aainscow requested review from bill-scales and removed request for a team September 3, 2026 14:03

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

New test cases are fine. I'm a bit worried about the maintainability of some of the test harness changes - in particular I don't think split PGs will function correctly much beyond the split.

The split capability is limited to a single split and only from 1 to 2 PGs. This should be sufficient (I don't think there are any scenarios that can only be covered by performing multiple splits or an N-way split) but could do with a comment and an assert to police this.

Comment thread src/test/osd/ECPeeringTestFixture.cc Resolved
Comment thread src/test/osd/ECPeeringTestFixture.cc Outdated
child_pgid = pg_t(1, pool_id); // seed 1 = child of seed 0 for pg_num 1 -> 2
child_split_bits = split_bits;

std::vector<int> acting;

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.

You are resetting the up map for both the parent and child PGs here. I think you should be keeping the current acting set for the parent and setting the child to start with the same acting set. Once the split has occurred you could then optionally change the up map for the child (although I'm not convinced that the harness really copes with the parent and child having different up maps at the moment - in particular if the child is using different OSDs to the parent).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved in my latest commit.

Comment thread src/test/osd/ECPeeringTestFixture.h Outdated

// Child-PG state populated by split_pg(). Empty until a split is performed.
pg_t child_pgid;
unsigned child_split_bits = 0;

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.

I don't think child_split_bits needs to stored. It is written to by split_pg() and read by create_child_peering_state which is called by split_pg - it could just be passed as a function argument

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved in my latest commit.

Comment thread src/test/osd/ECPeeringTestFixture.h Resolved
Comment thread src/test/osd/ECPeeringTestFixture.h Outdated
pg_t child_pgid;
unsigned child_split_bits = 0;
bool stall_recovery_reservations = false;
std::map<int, std::unique_ptr<PeeringState>> child_peering_states;

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.

Rather than having child_peering_{states, ctxs, listeners, dpps} it might be cleaner to change the maps for shard_peering_{states, ctxs, listeners, dpps} to use <osd,pg> instead of as the key.

You could keep simpler getters for now that find the parent/child version for now.

Keeping the child separate will cause problems if you try and run the test harness much beyond performing the split. For example if a new epoch occurs I don't think you are updating the epoch for the child_peering_listeners.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved in my latest commit.

Comment thread src/test/osd/ECPeeringTestFixture.h Outdated
std::map<int, std::unique_ptr<PeeringCtx>> child_peering_ctxs;
std::map<int, std::unique_ptr<MockPeeringListener>> child_peering_listeners;
std::map<int, coll_t> child_colls;
std::map<int, ObjectStore::CollectionHandle> child_chs;

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.

I don't think we should be storing child_colls and child_chs - you can get these from MockPeeringListener instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved in my latest commit.

Comment thread src/test/osd/ECPeeringTestFixture.cc 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

@aainscow
aainscow force-pushed the wip-aainscow-68649-test branch from 77ba6c9 to d1bae78 Compare September 10, 2026 12:16
@aainscow

Copy link
Copy Markdown
Contributor Author

Latest update is a rebase only. I am working on comments.

@aainscow
aainscow force-pushed the wip-aainscow-68649-test branch from 1a9e638 to dde410e Compare September 10, 2026 13:55
@aainscow
aainscow force-pushed the wip-aainscow-68649-test branch from dde410e to 98ea78e Compare September 11, 2026 16:16

@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

…existing object

Before this change the EC peering unit-test fixture could drive recovery
and OSD failover, but had no way to reach the state behind tracker 68649:
a primary that believes a still-missing shard is up to date and forwards
a clone to it.  Reaching that needs aggressive PG-log trimming, control
over which child a PG split sends an object to, and an actual PG split -
none of which the fixture could do.

This adds that capability to ECPeeringTestFixture and friends:

- Opt-in aggressive log trimming on the write path (it now computes a
  real trim_to / pg_committed_to via update_trim_to()/complete_write(),
  as PrimaryLogPG does) so a shard's log can be driven to the trimmed and
  empty states that a low osd_*_pg_log_entries produces in the field.
- Per-object hash control, so an object can be steered into a chosen
  child PG when pg_num increases.
- A real PG split (split_pg): it bumps pg_num, runs the production
  PeeringState::split_into, splits the ObjectStore collection, and peers
  the child PG - including the pg_temp cycle the child primary needs to
  finish peering.
- Epoch-gated, correctly-routed delivery of deferred peering events in
  MockPeeringListener, matching PG::do_peering_event()/pg_has_reset_since:
  a deferred event (e.g. ActivateCommitted, DoRecovery) queued in a prior
  interval is now discarded rather than delivered into Reset, and is
  delivered to the listener's own PG (parent vs split child).  Without
  this the fixture aborted once the fix let recovery actually run.

Two tests are added.  DivergentLogRewindThenSplit builds the corrupt
state through the real code paths - trim to a high tail, an
async-recovery target that rolls forward uncommitted EC writes,
proc_replica_log's divergent rewind, then a real split - and asserts the
gate PrimaryLogPG uses before issuing a clone (is_degraded_or_backfilling
/ should_send_op, both of which need peer_missing[target].is_missing).
DivergentLogRewindThenNewInterval is a negative control: a plain interval
change instead of a split does not reproduce it (the primary re-requests
the target's log), showing the split is required.

DivergentLogRewindThenSplit fails on this commit alone and passes once
the following reset_complete_to fix is applied.

Assisted-by: Claude:Claude-opus-4.8(1M)
Assisted-by: IBM-Bob-v2.0.1
Signed-off-by: Alex Ainscow <[email protected]>

# Conflicts:
#	src/test/osd/PGBackendTestFixture.h
@aainscow
aainscow force-pushed the wip-aainscow-68649-test branch from 98ea78e to 27a105a Compare September 17, 2026 09:10
@aainscow
aainscow merged commit 7e122a6 into ceph:main Sep 17, 2026
14 checks passed
aainscow added a commit to aainscow/ceph that referenced this pull request Sep 18, 2026
test/osd: recreate corrupt last complete resulting in cloning of non-existing object

Reviewed-by: Bill Scales <[email protected]>
@aainscow aainscow added the no-backport-required Label that can be optionally added to show that we do not need to backport. label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core no-backport-required Label that can be optionally added to show that we do not need to backport. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants