Skip to content

tentacle: osd/SnapMapper: stop rescanning purged_snaps per mapping key - #74287

Closed
cupnes wants to merge 1 commit into
ceph:tentaclefrom
cupnes:wip-83058-tentacle
Closed

cupnes wants to merge 1 commit into
ceph:tentaclefrom
cupnes:wip-83058-tentacle

Conversation

@cupnes

@cupnes cupnes commented Nov 25, 2026

Copy link
Copy Markdown

Scrubber::run() opened a fresh omap_iterate over purged_snaps, from its
start, for every mapping key: O(M*P).  On snapshot-heavy OSDs this
pinned a core for days.

Collect the purged_snaps rows once up front, sort them numerically by
(pool, begin), merge overlapping and adjacent same-pool rows into
disjoint ranges, and binary-search them per mapping key: O(M log P).

The numeric sort also fixes missed strays: with pools ordered as
decimal strings, the old walk could stop at a pool-20 row and never
reach pool 3.

The on-disk key order is not numeric in the pool (decimal string), and
rows of one pool may overlap or touch (record_purged_snaps() merges a
new interval only with rows already on disk, so intervals carried in
one call do not see each other), so the merged ranges stay sorted by
(pool, begin) and disjoint: one upper_bound per mapping key, and the
last row that starts at or before the snap is the only one that can
cover it.

Adds unittest_scrubber_run, a unit test for Scrubber::run(): it
builds a SnapMapper over a MemStore and fills it through the same
writer methods ceph-osd uses (record_purged_snaps(), add_oid()),
then checks every stray the scrub reports.

Fixes: https://tracker.ceph.com/issues/81592
Fixes: https://tracker.ceph.com/issues/81798
Signed-off-by: Ante Kuspilic <[email protected]>
(cherry picked from commit 43ce7a9)

Conflicts:
	src/osd/SnapMapper.cc
- tentacle lacks f0028be ("osd: s/assert/ceph_assert/g"), so the
  removed asserts are plain assert() rather than ceph_assert(); drop
  them as in the original commit
@cupnes
cupnes requested a review from a team as a code owner November 25, 2026 06:58
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ceph Release Engineering Audit Report

Automated Redmine Linkage Audit

The following tracking irregularities were found:

  • Missing Backport Tracker: Main tracker #81798 does not have a backport tracker for tentacle. Please adjust the 'Backport' field on the main tracker appropriately and remove 'backport_processed' from 'Tags (freeform)'.
  • Missing PR Link: Backport tracker #83058 has no 'Pull Request ID' field set. Please link it to PR #74287.

Commit Parity Visualizer

BACKPORT PR #74287 SOURCE PR SOURCE STATUS
3c45fc9 osd/SnapMapper: stop rescanning purged_snaps per mapping key PR #72544 43ce7a9 osd/SnapMapper: stop rescanning purged_snaps per mapping key

Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations

⚠️ WARNING: Cherry-pick conflicts or deviations were found that require component lead review.

A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.

This does not necessarily indicate an issue but a maintainer should review.

**Click to expand conflict summaries.**

Deviation in Backport 3c45fc9 (cherry-pick of 43ce7a9)

Affected File(s)

Range Diff

Click to expand
--- Original (43ce7a9a)
+++ Backport (3c45fc94)
@@ -28,3 +28,10 @@
 Fixes: https://tracker.ceph.com/issues/81592
 Fixes: https://tracker.ceph.com/issues/81798
 Signed-off-by: Ante Kuspilic <[email protected]>
+(cherry picked from commit 43ce7a9acc0b9c872614a55c26baf43da268063b)
+
+Conflicts:
+	src/osd/SnapMapper.cc
+- tentacle lacks f0028be0ec5 ("osd: s/assert/ceph_assert/g"), so the
+  removed asserts are plain assert() rather than ceph_assert(); drop
+  them as in the original commit

================================================================================
RANGE DIFF
================================================================================

1:  43ce7a9acc0 ! 1:  3c45fc94aea osd/SnapMapper: stop rescanning purged_snaps per mapping key
    @@ Commit message
         Fixes: https://tracker.ceph.com/issues/81592
         Fixes: https://tracker.ceph.com/issues/81798
         Signed-off-by: Ante Kuspilic <[email protected]>
    +    (cherry picked from commit 43ce7a9acc0b9c872614a55c26baf43da268063b)
    +
    +    Conflicts:
    +            src/osd/SnapMapper.cc
    +    - tentacle lacks f0028be0ec5 ("osd: s/assert/ceph_assert/g"), so the
    +      removed asserts are plain assert() rather than ceph_assert(); drop
    +      them as in the original commit
     
      ## src/osd/SnapMapper.cc ##
     @@ src/osd/SnapMapper.cc: bool SnapMapper::Scrubber::_parse_m(
    @@ src/osd/SnapMapper.cc: bool SnapMapper::Scrubber::_parse_m(
     +                      __func__, mapping.hoid, mapping.snap)
                       << dendl;
            } else {
    --        ceph_assert(mapping.snap >= begin);
    --        ceph_assert(mapping.snap < end);
    --        ceph_assert(mapping.hoid.pool == pool);
    +-        assert(mapping.snap >= begin);
    +-        assert(mapping.snap < end);
    +-        assert(mapping.hoid.pool == pool);
              // invalid
              dout(10) << fmt::format(
     -                      "{} stray {} snap {} in pool {} shard {} purged_snaps[{}, {})",

How to proceed:

  • Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git Conflicts: block intact) and include an explanation for changes.
  • Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
  • Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting /audit override.

Be familiar with the rules and guidelines for writing backports.


🛟 Need Help?

If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.

📋 Component Lead / Release Manager

To override the audit failure, apply releng-audit-override label or comment /audit override.


⚠️ Note: Automated audit checks will be suspended on future pushes to prevent comment spam while you work.

When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.

View workflow run

@github-actions github-actions Bot added the releng-audit-fail Release engineering: failed backport verification audit. label Nov 25, 2026
@cupnes

cupnes commented Nov 25, 2026

Copy link
Copy Markdown
Author

The releng-audit deviation is expected: tentacle lacks f0028be
("osd: s/assert/ceph_assert/g"), so the three asserts removed by the original
commit are plain assert() instead of ceph_assert(). The resolution simply drops
them, as the original commit does, and is documented in the Conflicts section.

Could a RADOS component lead or @ceph/ceph-release-manager please review and
/audit override if it looks good? Also, could an org member add ci-approved
so that Jenkins CI can run?

Tracker status (I lack permission to edit those fields, so I have requested):

The umbrella backport is #74289.

@cupnes

cupnes commented Nov 30, 2026

Copy link
Copy Markdown
Author

Closing in favor of #74463, which contains the same
change and where review is already in progress.

@cupnes cupnes closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/ops core needs-ci-approval releng-audit-fail Release engineering: failed backport verification audit. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant