Project

General

Profile

Actions

Bug #76458

closed
RF RF

Crimson/OSD: SnapMapper loses in-flight state during PG split due to premature cache reset

Bug #76458: Crimson/OSD: SnapMapper loses in-flight state during PG split due to premature cache reset

Added by Ronen Friedman 7 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
Due date:
% Done:

0%

Source:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v21.0.0-1590-gda250490d8
Released In:
v21.2.0~413
Upkeep Timestamp:
2026-10-24T01:45:08+00:00

Description

Test results:
/home/teuthworker/mnt/teuthology/rfriedma-2026-05-06_13:42:09-crimson-rados-rf-combined-oid-stat-trim-distro-default-trial/196012

Test: crimson-rados/thrash with pggrow thrasher, seastore/rbm, small-objects-balanced workload. The test passed, but only because the update_snaps ENOENT fallback fix (commit ac06cb5a959) prevented what would otherwise have been snap-mapper inconsistencies detected by scrub.

Problem analysis:

Note: related to https://tracker.ceph.com/issues/65679 (and its fix: https://github.com/ceph/ceph/pull/57125)

When a PG split occurs in crimson, PG::on_change() calls snap_mapper.reset_backend(), which unconditionally clears the SnapMapper's MapCacher in-memory cache. If recovery repops had written snap-mapper entries (OBJ_ and SNA_ records) that were still cached in the MapCacher — submitted to seastore but not yet committed — those entries become invisible. The subsequent snap-trim operation's update_snaps() call cannot find the OBJ_ record and gets ENOENT.

The classic OSD does not have this problem because it never calls reset_backend() during splits. Each child PG gets a fresh SnapMapper instance with an empty cache, and the parent's pending writes are guaranteed to be applied through the ObjectStore transaction ordering model.

Traced example (OSD 2, object trial07135892-953:b):

17:03:04 — Recovery repop on PG 3.9 writes snap-mapper entries via add_oid:

DEBUG 2026-05-06 17:03:04,342 [shard 2:main] osd - snap_mapper add_oid 3:9505de10:::trial07135892-953:b 2,3,5,6,7,8,9,a,b
17:03:56 — PG split: 3.9 splits, creating child PG 3.29. on_change() calls reset_backend(), discarding the cached snap-mapper entries:

DEBUG 2026-05-06 17:03:56,198 [shard 2:main] osd - PGAdvanceMap::split_pg: 3.29 split collection done
17:04:04 — Snap-trim repop on PG 3.29 calls update_snaps for the same object. get_snaps() returns ENOENT — the OBJ_ record is gone from the cache and not yet committed to seastore. The fallback fix recreates the mapping:

DEBUG 2026-05-06 17:04:04,167 [shard 2:main] osd - snap_mapper update_snaps: 3:9505de10:::trial07135892-953:b no existing snap mapping, creating for {3}
DEBUG 2026-05-06 17:04:04,167 [shard 2:main] osd - snap_mapper add_oid 3:9505de10:::trial07135892-953:b 3
This pattern occurred 35 times across all 4 OSDs during the test run. Representative lines from the full logs:

From remote/trial141/log/ceph-osd.2.log.gz:

DEBUG 2026-05-06 17:04:04,167 [shard 2:main] osd - snap_mapper update_snaps: 3:9505de10:::trial07135892-953:b no existing snap mapping, creating for {3}
DEBUG 2026-05-06 17:05:56,195 [shard 1:main] osd - snap_mapper update_snaps: 3:c2eeae22:::trial07135892-273:47 no existing snap mapping, creating for {3f, 44}
DEBUG 2026-05-06 17:05:58,204 [shard 1:main] osd - snap_mapper update_snaps: 3:c2befadf:::trial07135892-721:46 no existing snap mapping, creating for {3f, 44}
From remote/trial141/log/ceph-osd.3.log.gz:

DEBUG 2026-05-06 17:03:17,318 [shard 3:main] osd - snap_mapper update_snaps: 3:86dddc5b:::trial07135892-921:b no existing snap mapping, creating for {2, 3, b}
DEBUG 2026-05-06 17:05:36,226 [shard 2:main] osd - snap_mapper update_snaps: 3:7dfa1a19:::trial07135892-410:53 no existing snap mapping, creating for {29, 3b, 3f, 43, 44, 4d, 4e, 4f, 52}
Fix:

Replace snap_mapper.reset_backend() in PG::on_change() with snap_mapper.flush_and_reset_backend(), which flushes all pending MapCacher writes into the interval-change transaction before clearing the cache. This ensures in-flight snap-mapper state is persisted to the objectstore, matching the implicit guarantee that the classic OSD provides through its transaction ordering model.


Related issues 1 (0 open — 1 closed)

Related to crimson - Bug #65679: osd crashes due to inconsistency between the in-memory cache and on disk data of the snap mapperResolvedXuehan Xu

Actions

MB Updated by Matan Breizman 7 months ago Actions #1

  • Related to Bug #65679: osd crashes due to inconsistency between the in-memory cache and on disk data of the snap mapper added

MB Updated by Matan Breizman 7 months ago Actions #2

  • Project changed from Ceph to crimson
  • Category deleted (OSD)
  • Status changed from New to Fix Under Review
  • Pull request ID set to 68796

RF Updated by Ronen Friedman 7 months ago Actions #3

  • Status changed from Fix Under Review to Resolved

UB Updated by Upkeep Bot 7 months ago Actions #4

  • Merge Commit set to da250490d80e4114f8b36a528cee98225ccba13e
  • Fixed In set to v21.0.0-1590-gda250490d8
  • Upkeep Timestamp set to 2026-05-20T11:06:48+00:00

UB Updated by Upkeep Bot about 1 month ago Actions #5

  • Released In set to v21.2.0~413
  • Upkeep Timestamp changed from 2026-05-20T11:06:48+00:00 to 2026-10-24T01:45:08+00:00
Actions

Also available in: PDF Atom