Skip to content

osd/PGLog: lower last_complete in reset_complete_to on an empty log - #71525

Merged
aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip_aainscow_68649_fix
Sep 10, 2026
Merged

aainscow merged 1 commit into
ceph:mainfrom
aainscow:wip_aainscow_68649_fix

Conversation

@aainscow

@aainscow aainscow commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

reset_complete_to() returned early whenever the log was empty and never touched last_complete. Its callers rely on it to do the opposite: PeeringState::activate() (via activate_not_complete) and split_into() provisionally leave last_complete == last_update and delegate to reset_complete_to() the job of pulling it back below the oldest missing version. rewind_divergent_log() does the same - it only clamps last_complete down to the new (tail) head and adds the rewound objects to missing, expecting the later reset_complete_to() to lower it further.

So when a shard's log was rewound to empty (proc_replica_log discarding divergent entries) or a split handed a child an empty log, and the missing set was non-empty, last_complete was left equal to last_update. pg_info_t::has_missing() is last_complete != last_update, so it reported "no missing"; GetMissing's identical-log fast-path then discarded the peer's missing set and the primary activated the shard as up to date. A subsequent clone was forwarded to that shard, which no longer had the object, and it crashed with ENOENT in BlueStore (tracker 68649).

Drop the empty-log early return and let the existing complete_to == log.begin() path handle it: for an empty log begin() == end(), so the oldest_need walk is skipped and last_complete is lowered below oldest_need just as in the non-empty case. complete_to is left at end(), which is the only valid position for an empty log - the consumers that read complete_to == end() as "recovery complete" already special-case an empty log.

Recreate test harness (will never be backported):
#71526

This likely does not need backporting - as its low probability, but it IS a bug in tentacle/umbrella, so we might change our mind.

Assisted-by: Claude:Claude-Opus-4.8
Assisted-by: IBM Bob
Signed-off-by: Alex Ainscow [email protected]
Fixes: https://tracker.ceph.com/issues/68649

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.

reset_complete_to() returned early whenever the log was empty and never
touched last_complete.  Its callers rely on it to do the opposite:
PeeringState::activate() (via activate_not_complete) and split_into()
provisionally leave last_complete == last_update and delegate to
reset_complete_to() the job of pulling it back below the oldest missing
version.  rewind_divergent_log() does the same - it only clamps
last_complete down to the new (tail) head and adds the rewound objects to
missing, expecting the later reset_complete_to() to lower it further.

So when a shard's log was rewound to empty (proc_replica_log discarding
divergent entries) or a split handed a child an empty log, and the
missing set was non-empty, last_complete was left equal to last_update.
pg_info_t::has_missing() is last_complete != last_update, so it reported
"no missing"; GetMissing's identical-log fast-path then discarded the
peer's missing set and the primary activated the shard as up to date.  A
subsequent clone was forwarded to that shard, which no longer had the
object, and it crashed with ENOENT in BlueStore.

Drop the empty-log early return and let the existing complete_to ==
log.begin() path handle it: for an empty log begin() == end(), so the
oldest_need walk is skipped and last_complete is lowered below oldest_need
just as in the non-empty case.  complete_to is left at end(), which is the
only valid position for an empty log - the consumers that read
complete_to == end() as "recovery complete" already special-case an empty
log.

Assisted-by: Claude:Claude-Opus-4.8
Assisted-by: IBM Bob
Signed-off-by: Alex Ainscow <[email protected]>
Fixes: https://tracker.ceph.com/issues/68649
@aainscow
aainscow requested a review from a team as a code owner September 3, 2026 13:59
@aainscow
aainscow requested review from bill-scales and rzarzynski and removed request for a team September 3, 2026 13:59
@github-actions github-actions Bot added the core label Sep 3, 2026
@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath12-testing-20260907.061609-main.

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

Approve.

It is possible to have missing entries but no log entries. After a PG split is one possibility, but with very aggressive log trimming and a divergent log entry being rolled backwards (and creating a missing entry because the update has been completed and cannot be rolled back) is another.

The code depends on last_complete being set != last_update when there are missing entries. If we have an empty log we need to skip the first part of this function that scans the log, but still need the second half to set last complete to be prior to the oldest need.

@sseshasa

sseshasa commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@aainscow
aainscow merged commit adf3339 into ceph:main Sep 10, 2026
20 of 25 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log adf3339fa601e191b40b92ba112f3d4175377dd6^..adf3339fa601e191b40b92ba112f3d4175377dd6

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

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

aainscow added a commit to aainscow/ceph that referenced this pull request Sep 18, 2026
osd/PGLog: lower last_complete in reset_complete_to on an empty log

Reviewed-by: Bill Scales <[email protected]>
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