Skip to content

umbrella: osd/SnapMapper: stop rescanning purged_snaps per mapping key - #74289

Open
cupnes wants to merge 1 commit into
ceph:umbrellafrom
cupnes:wip-83057-umbrella
Open

cupnes wants to merge 1 commit into
ceph:umbrellafrom
cupnes:wip-83057-umbrella

Conversation

@cupnes

@cupnes cupnes commented Nov 25, 2026 •

Copy link
Copy Markdown

backport tracker: https://tracker.ceph.com/issues/83057
backport tracker: https://tracker.ceph.com/issues/83671


backport of #72544
parent trackers: https://tracker.ceph.com/issues/81592, https://tracker.ceph.com/issues/81798

The original commit 43ce7a9 fixes both parent trackers:

  • #81592: Scrubber::run() rescanned purged_snaps from its start for every mapping key
    (O(M*P)), which pinned a core for days on snapshot-heavy OSDs. The fix collects the
    purged_snaps rows once, sorts and merges them, and binary-searches per mapping key
    (O(M log P)).
  • #81798: because pool ids were ordered as decimal strings, the walk could stop at a
    pool-20 row and never reach pool 3, missing strays. The numeric sort fixes this.

Both issues affect umbrella, which does not have this commit yet. The change is limited
to SnapMapper::Scrubber::run() plus a new unit test (unittest_scrubber_run).

this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh

@cupnes
cupnes requested a review from a team as a code owner November 25, 2026 07:52
@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[bot]

This comment was marked as outdated.

@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

This is a clean cherry-pick of #72544.
Could an org member add ci-approved so that Jenkins CI can run?

The releng-audit Redmine linkage failures are being addressed (I lack permission
to edit those fields, so I have requested):

The tentacle backport is #74287.

@cupnes

cupnes commented Nov 30, 2026

Copy link
Copy Markdown
Author

Note: the review on the tentacle backport #74463 (test_scrubber_run.cc relies on MemStore's in-memory mode from 2e8eee3) applies here too, since 2e8eee3 is not on umbrella either. I'll update this PR following the approach agreed on in #74463.

@cupnes

cupnes commented Dec 2, 2026

Copy link
Copy Markdown
Author

@Antek74 as the author of the original fix, would you like to handle the umbrella
backport as well? If so, I'm happy to close this PR. Otherwise I'll update this PR
to follow the approach taken in the tentacle backport (#74456) for
test_scrubber_run.cc, so the two branches stay consistent.

@Antek74

Antek74 commented Dec 2, 2026

Copy link
Copy Markdown

@cupnes you may drive umbrella backport...

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/test/test_scrubber_run.cc
	- No git conflict; manual test-only change. The test creates its
	  MemStore with an empty path, which relies on MemStore's
	  in-memory-only mode from 2e8eee3 (PR ceph#71931). umbrella lacks
	  that commit, so the fixture uses a temporary directory instead,
	  as in the tentacle backport (PR ceph#74456). No production code change.
@cupnes
cupnes force-pushed the wip-83057-umbrella branch from 0b88ca8 to 0893ea4 Compare December 3, 2026 00:54
@cupnes

cupnes commented Dec 3, 2026 •

Copy link
Copy Markdown
Author

Thanks @Antek74. Updated test_scrubber_run.cc to use a temporary directory for MemStore,
since 2e8eee3 (MemStore in-memory-only mode) is not on umbrella either.
Compared to the original commit 43ce7a9, only test_scrubber_run.cc differs; it now
matches the tentacle backport #74456 except for the branch name in a comment.
This is documented in the Conflicts section of the commit message.

@cupnes

cupnes commented Dec 3, 2026

Copy link
Copy Markdown
Author

/audit retest

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

🔄 Audit Retest Triggered by @cupnes.

View workflow run

@github-actions github-actions Bot removed the releng-audit-fail Release engineering: failed backport verification audit. label Dec 3, 2026

@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 PR Link: Backport tracker #83671 has no 'Pull Request ID' field set. Please link it to PR #74289.
  • Missing PR Link: Backport tracker #83057 has no 'Pull Request ID' field set. Please link it to PR #74289.

Commit Parity Visualizer

BACKPORT PR #74289 SOURCE PR SOURCE STATUS
0893ea4 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 0893ea4 (cherry-pick of 43ce7a9)

Affected File(s)

Range Diff

Click to expand
--- Original (43ce7a9a)
+++ Backport (0893ea4b)
@@ -28,3 +28,12 @@
 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/test/test_scrubber_run.cc
+	- No git conflict; manual test-only change. The test creates its
+	  MemStore with an empty path, which relies on MemStore's
+	  in-memory-only mode from 2e8eee3bb50 (PR #71931). umbrella lacks
+	  that commit, so the fixture uses a temporary directory instead,
+	  as in the tentacle backport (PR #74456). No production code change.

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

1:  43ce7a9acc0 ! 1:  0893ea4b68e 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/test/test_scrubber_run.cc
    +            - No git conflict; manual test-only change. The test creates its
    +              MemStore with an empty path, which relies on MemStore's
    +              in-memory-only mode from 2e8eee3bb50 (PR #71931). umbrella lacks
    +              that commit, so the fixture uses a temporary directory instead,
    +              as in the tentacle backport (PR #74456). No production code change.
     
      ## src/osd/SnapMapper.cc ##
     @@ src/osd/SnapMapper.cc: bool SnapMapper::Scrubber::_parse_m(
    @@ src/test/test_scrubber_run.cc (new)
     +// the collector against keys it must not read.
     +
     +#include <algorithm>
    ++#include <cstdlib>
    ++#include <filesystem>
     +#include <map>
    ++#include <system_error>
     +#include <tuple>
     +#include <vector>
     +
    @@ src/test/test_scrubber_run.cc (new)
     +  // mapping_drv without colliding
     +  std::map<std::pair<int64_t, int>, std::unique_ptr<SnapMapper>> mappers;
     +  bool mounted = false;
    ++  // Backport adaptation: main's MemStore supports an in-memory-only mode
    ++  // for the empty path (commit 2e8eee3bb50); umbrella does not, so the
    ++  // fixture uses a real temporary directory like the original test draft.
    ++  std::string path;
     +  CephContext *cct = g_ceph_context;
     +
     +  void SetUp() override {
    -+    store = ObjectStore::create(cct, "memstore", "");
    ++    char pathbuf[] = "/tmp/scrubber-run-test-XXXXXX";
    ++    char *d = mkdtemp(pathbuf);
    ++    ASSERT_NE(nullptr, d);
    ++    path = d;
    ++
    ++    store = ObjectStore::create(cct, "memstore", path);
     +    ASSERT_TRUE(store);
     +    ASSERT_EQ(0, store->mkfs());
     +    ASSERT_EQ(0, store->mount());
    @@ src/test/test_scrubber_run.cc (new)
     +    mapping_drv.reset();
     +    purged_drv.reset();
     +    store.reset();
    ++    std::error_code ec;
    ++    std::filesystem::remove_all(path, ec);
     +  }
     +
     +  SnapMapper &get_mapper(int64_t pool,

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 Dec 3, 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.

2 participants