Skip to content

osd/scrub: auto-correct accounting-only stat mismatches - #68684

Merged
ronen-fr merged 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-statfx
May 23, 2026
Merged

ronen-fr merged 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-statfx

Conversation

@ronen-fr

@ronen-fr ronen-fr commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

When scrub detects a PG stats mismatch but no object-level
inconsistencies (all replicas agree on actual data), fix the
stats in place rather than reporting a scrub error.

Previously, a pure stat mismatch would log [ERR], increment
shallow_errors, and trigger OSD_SCRUB_ERRORS / PG_STATE_INCONSISTENT
health alerts — yet leave the stats unfixed unless a repair
scrub was manually initiated. The scrubber's own object count
is authoritative in this case.

Persistence of the corrected stats is deferred until the next
transaction that sets dirty_info, consistent with the existing
stats_invalid repair path.

Added post-merge:
Fixes: https://tracker.ceph.com/issues/76562

When scrub detects a PG stats mismatch but no object-level
inconsistencies (all replicas agree on actual data), fix the
stats in place rather than reporting a scrub error.

Previously, a pure stat mismatch would log [ERR], increment
shallow_errors, and trigger OSD_SCRUB_ERRORS / PG_STATE_INCONSISTENT
health alerts — yet leave the stats unfixed unless a repair
scrub was manually initiated. The scrubber's own object count
is authoritative in this case.

Persistence of the corrected stats is deferred until the next
transaction that sets dirty_info, consistent with the existing
stats_invalid repair path.

Signed-off-by: Ronen Friedman <[email protected]>
@ronen-fr
ronen-fr marked this pull request as ready for review April 30, 2026 15:57
@ronen-fr
ronen-fr requested a review from a team as a code owner April 30, 2026 15:57
@ronen-fr

ronen-fr commented May 5, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@ronen-fr
ronen-fr requested review from liu-chunmei and rzarzynski May 5, 2026 13:39
m_scrub_cstat.sum.num_whiteouts != info.stats.stats.sum.num_whiteouts ||
m_scrub_cstat.sum.num_bytes != info.stats.stats.sum.num_bytes) {

m_osds->clog->error() << info.pgid << " " << m_mode_desc

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.

For the sake of a bug investigation having an explicit log about ignoring the mismatch could be helpful.

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.

@rzarzynski:
There already is in this version a dout(1) for the else case. Did you mean something else?

@rzarzynski

Copy link
Copy Markdown
Contributor

@ronen-fr: feel free to tag as needs-qa.

@ronen-fr

Copy link
Copy Markdown
Contributor Author

marked 'needs-qa' - but (due to the date pressure) I'll also run my own Teuthology tests.

@ronen-fr

Copy link
Copy Markdown
Contributor Author

Merging based on my Teuthology tests

@ronen-fr
ronen-fr merged commit 5b03460 into ceph:main May 23, 2026
6 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.

2 participants