Bug #81798
closedosd/SnapMapper: purged_snaps scrub misses strays when pool ids have different digit lengths
0%
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).
AK Updated by Ante Kuspilic about 2 months ago
- Description updated (diff)
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
- Status changed from New to Fix Under Review
Fix under review
KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago
PR added to QA
LF Updated by Laura Flores 28 days ago
Still in QA.
UB Updated by Upkeep Bot 22 days ago
- 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
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:
- umbrella: https://github.com/ceph/ceph/pull/74289 (tracker #83057)
- tentacle: https://github.com/ceph/ceph/pull/74287 (tracker #83058)
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
- Status changed from Resolved to Pending Backport
- Backport set to tentacle,umbrela
UB Updated by Upkeep Bot 4 days ago
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¶
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
- Backport changed from tentacle,umbrela to tentacle, umbrella
RF Updated by Ronen Friedman 4 days ago
- Backport changed from tentacle, umbrella to tentacle,umbrella
UB Updated by Upkeep Bot 4 days ago
- 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
- 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
- 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