Project

General

Profile

Actions

Bug #81798

closed
AK

osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengths

Bug #81798: osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengths

Added by Ante Kuspilic about 2 months ago. Updated 4 days ago.

Status:
Backporting
Priority:
Normal
Assignee:
-
Category:
Snapshots
Target version:
Due date:
% Done:

0%

Source:
Community (dev)
Backport:
tentacle,umbrella
Regression:
No
Severity:
3 - minor
Reviewed:
ceph-qa-suite:
Component(RADOS):
OSD
Pull request ID:
Tags (freeform):
Fixed In:
v22.0.0-697-g15101d95cd
Released In:
Upkeep Timestamp:
2026-11-29T15:29:35+00:00

Description

The purged_snaps scrub can silently miss strays when pool ids have different digit lengths.

make_purged_snap_key() writes the pool id as a decimal string (PSN__<pool>_<snapid-hex>), so the on-disk order of the purged_snaps rows is not numeric order in the pool: rows of pools 20 and 21 sort before rows of pool 3.

The scrub walks these rows assuming numeric order. For each mapping it stops at the first row whose pool is >= the mapping's pool and checks only that row (src/osd/SnapMapper.cc, the purged walk inside Scrubber::run()):

bc. if (pool >= 0 &&
(mapping.hoid.pool > pool ||
(mapping.hoid.pool == pool && mapping.snap >= end))) {
// next row
} else {
// stop here
}

So a mapping in pool 3 stops at a pool-20 row and is classified ok. Pool 3's own row sorts later and is never checked. The stray is not reported.

Clusters whose pool ids all have the same digit length are not affected. Pool ids only grow, so a cluster can run into this over time.

Reproduced on v20.2.1 with pools 1, 3, 20 and 21 (rows and mappings written with record_purged_snaps() and add_oid()): the stray (pool 3, snap 35) is missed by stock. The test MultiPoolMixedPoolIds in PR https://github.com/ceph/ceph/pull/72544 fails on stock, which finds only 2 of 3 strays, and passes with the patch, which sorts the rows numerically before the lookup. Stock only ever misses strays, it never reports extra ones.

Related: #81592 (same walk, the O(M*P) cost since Tentacle, same PR).


Related issues 2 (2 open — 0 closed)

Copied to RADOS - Backport #83670: tentacle: osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengthsFix Under ReviewRonen Friedman

Actions
Copied to RADOS - Backport #83671: umbrella: osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengthsNew

Actions

AK Updated by Ante Kuspilic about 2 months ago Actions #1

  • Description updated (diff)

KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago Actions #2

  • Status changed from New to Fix Under Review

Fix under review

KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago Actions #3

PR added to QA

LF Updated by Laura Flores 28 days ago Actions #4

Still in QA.

UB Updated by Upkeep Bot 22 days ago Actions #5

  • Status changed from Fix Under Review to Resolved
  • Merge Commit set to 15101d95cde4f1801bacc23de55ff49f82a545c4
  • Fixed In set to v22.0.0-697-g15101d95cd
  • Upkeep Timestamp set to 2026-11-11T14:55:33+00:00

YO Updated by Yuma Ogami 8 days ago Actions #6

This issue was fixed by https://github.com/ceph/ceph/pull/72544 together with
https://tracker.ceph.com/issues/81592, whose Backport field is "umbrella, tentacle".
Backports are in progress:

Could someone with permissions please set "Backport: umbrella, tentacle" on this
issue so that the corresponding backport trackers are created? The releng-audit
check on the backport PRs requires them. I don't have permission to edit the
fields myself.

RF Updated by Ronen Friedman 4 days ago Actions #7

  • Status changed from Resolved to Pending Backport
  • Backport set to tentacle,umbrela

UB Updated by Upkeep Bot 4 days ago Actions #8

Redmine Upkeep failure

The redmine-upkeep.py script failed to update this issue. I have added the flag "upkeep-failed" to avoid looking at this issue again.

Please manually fix the issue and remove "upkeep-failed" flag to allow future upkeep operations.

Transformation

The script was in the create_backports transformation.

Update Log

https://github.com/ceph/ceph/actions/runs/46261101165

Error

Redmine Update failed:

Traceback (most recent call last):
  File "/home/runner/work/ceph/ceph/ceph/src/script/redmine-upkeep.py", line 1173, in _transform_create_backports
    other = self.R.issue.create(**create_args)
  File "/opt/hostedtoolcache/Python/3.14.10/x64/lib/python3.14/site-packages/redminelib/managers/base.py", line 187, in create
    response = self.redmine.engine.request(self.resource_class.http_method_create, url, data=request)
  File "/opt/hostedtoolcache/Python/3.14.10/x64/lib/python3.14/site-packages/redminelib/engines/base.py", line 84, in request
    return self.process_response(self.session.request(method, url, **kwargs))
           ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.14.10/x64/lib/python3.14/site-packages/redminelib/engines/base.py", line 188, in process_response
    raise exceptions.ValidationError(', '.join(': '.join(e) if isinstance(e, list) else e for e in errors))
redminelib.exceptions.ValidationError: Ceph release is not included in the list

RF Updated by Ronen Friedman 4 days ago Actions #9

  • Backport changed from tentacle,umbrela to tentacle, umbrella

RF Updated by Ronen Friedman 4 days ago Actions #10

  • Backport changed from tentacle, umbrella to tentacle,umbrella

UB Updated by Upkeep Bot 4 days ago Actions #11

  • Copied to Backport #83670: tentacle: osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengths added

UB Updated by Upkeep Bot 4 days ago Actions #12

  • Copied to Backport #83671: umbrella: osd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengths added

UB Updated by Upkeep Bot 4 days ago Actions #13

  • Status changed from Pending Backport to Backporting
  • Upkeep Timestamp changed from 2026-11-11T14:55:33+00:00 to 2026-11-29T15:29:35+00:00
Actions

Also available in: PDF Atom