r/ceph • u/Signal-Bluejay5859 • 1h ago
Large omap objects stuck after resharding on single-zone cluster — bilog trim clears it but old generation's real keys remain (Reef 18.2.8)
Hi all,
We've spent the last few days tracking down a HEALTH_WARN: large omap objects issue on our RGW cluster and made good progress, but got stuck on a subset we can't clear with any documented command. Writing up the full investigation in case someone has run into the same thing or knows a fix we're missing.
Environment
- Ceph 18.2.8 (Reef), deployed with cephadm
- 4 nodes, 23 OSDs (index pool lives on 4 SSDs)
- Single realm/zonegroup/zone —
radosgw-admin sync statusreportsmetadata sync no sync (zone is master),period getshows 1 zone in the zonegroup. Not multisite. - Pool in question:
DC7.rgw.buckets.index, replicated size 2, 32 PGs, pg_autoscale on osd_deep_scrub_large_omap_object_key_thresholdraised from the 200000 default to 400000 (value_sum threshold left at default 1 GiB)- Buckets involved are mostly Veeam B&R backup repositories (S3, versioning enabled) plus a few application buckets (Odoo, MSSQL dumps via Veeam Agent)
Initial symptom
HEALTH_WARN 558 large omap objectsAll 558 were confirmed to be in DC7.rgw.buckets.index only (ceph health detail → 558 large objects found in pool 'DC7.rgw.buckets.index').
Investigation method
ceph pg dump pgs -f json | jq '.pg_stats[] | select(startswith 27.) | .stat_sum.num_large_omap_objects'to see the per-PG distribution (fairly even across all 32 PGs — ruled out a single pathological PG).- Grepped the cluster log for
Large omap object found, parsingObject:,PG:,Key count:andSize (bytes):. Cluster log only retains the last deep-scrub result per PG (rotated logs), so we had to re-scrub all 32 PGs once to get a complete, consistent snapshot, then re-grep with a time window matched to each PG'slast_deep_scrub_stamp. - Object names are
.dir.<bucket-id>.<shard>for generation 0, or.dir.<bucket-id>.<gen>.<shard>for generation ≥ 1. Mapped<bucket-id>→ bucket name viaradosgw-admin bucket stats. - Cross-checked
radosgw-admin bucket layout --bucket=<name>for every flagged bucket to see current vs. old generations.
Root cause #1 — bilog never gets trimmed on a single-zone cluster
For every flagged object, rados listomapkeys showed the bulk of keys prefixed with the binary 0_ marker (bucket index log / "bilog" entries), vastly outnumbering real object/instance/OLH keys. Example — a bucket with only 986 real objects had a shard with 920,910 omap keys, of which 920,833 were bilog.
radosgw-admin bilog trim documentation says it exists to manually trim logs "instead of the gateways' integrated log sync" and warns to check pending sync first. On a single-zone cluster there is no sync consumer to ever trim this automatically — so bilog just accumulates forever on every write/delete, independent of resharding.
Fix: radosgw-admin bilog trim --bucket=<name> --bucket-id=<bucket-id> [--gen=<N>], then a ceph pg deep-scrub of the PGs holding that shard to refresh the warning count. We methodically verified this on >15 buckets: counted real (khac) vs bilog keys per shard before trim, trimmed, re-counted — in every case the non-bilog key count was byte-for-byte identical before/after (confirmed with diff), and bilog dropped to 0. This took us from 558 down to 159 warnings, recovering hundreds of millions of stale bilog entries (single largest bucket: ~183M entries on one generation alone).
Root cause #2 — old index generations from dynamic resharding are never retired
This is where we're stuck. Worked example, bucket veeam159ttc (versioning enabled, currently 8,660 real objects):
"layout": {
"current_index": { "gen": 2, "layout": {"normal": {"num_shards": 727}}},
"logs": [
{"gen": 0, "layout": {"in_index": {"layout": {"num_shards": 11}}}},
{"gen": 1, "layout": {"in_index": {"layout": {"num_shards": 89}}}},
{"gen": 2, "layout": {"in_index": {"layout": {"num_shards": 727}}}}
]
}- gen 1 (old, 89 shards): each shard had ~1.3–1.4M bilog + ~150–156k real keys (object name +
1000_/1001_OLH/instance keys for versioned objects). Afterbilog trim --gen=1: bilog → 0 on all 89 shards (verified per-shard, real-key counts unchanged), real keys stayed well under 400k → cleared from HEALTH_WARN after the next deep-scrub. Fully resolved, as expected. - gen 0 (oldest, 11 shards): each shard had ~280–285k bilog + ~401–407k real keys. After
bilog trim --gen=0: bilog → 0 (confirmed via diff), but real-key count is unchanged at 401–407k/shard — still over our 400000 threshold. These 11 shards remain flagged after deep-scrub and we have found no command that reduces this further. rados stat .dir.<bucket-id>.0and.dir.<bucket-id>.1.<shard>both return successfully (non-zero mtime, size 0 — payload is in omap) even after bilog trim.bucket layoutis unchanged — gen 0 and gen 1 are still listed inlogsalongside the live gen 2.
Why the real-key count consistently lands right around 400–425k: rgw_max_objs_per_shard (default 100,000) triggers a reshard once a shard hits that many objects. Because these buckets have versioning enabled, each object produces ~4 omap keys (name + CURRENT marker + OLH + instance), so a shard is reshard-triggered at roughly 100k objects × ~4 keys ≈ 400k keys — i.e. every versioned bucket's outgoing generation is, by construction, captured right at (or just over) the exact value our threshold is set to. Lowering our threshold wouldn't help (it would just flag more); raising it just chases a number that moves with rgw_max_objs_per_shard.
We found this in Ceph's own design doc (src/doc/rgw/multisite-reshard.md):
"Once bilog trimming advances past an old generation, it can delete the associated rados objects and remove that layout from the bucket instance metadata."
So there is a designed generation-GC path gated on bilog trim catching up — but it clearly isn't firing for us even after a full bilog trim of the old generation. Our working theory is that this GC logic is written for multisite (it needs a sync-status generation number from the other zone(s) to know a generation is safe to retire) and simply never triggers on a single-zone/no-multisite deployment, leaving old generations (bilog cleared or not) stuck in logs indefinitely.
We also proactively ran radosgw-admin reshard stale-instances list / delete before doing any bilog trimming, as a precaution for leftover stale bucket instances from old resharding bugs (RHBZ#1627562 / #1653830, fixed pre-Reef). It found nothing and didn't change our warning count — and separately, our full object-level scan never turned up any orphaned bucket-id (one absent from current radosgw-admin bucket stats output), so we don't believe stale instances are the issue here. This is specifically about old generations of bucket instances that are still very much alive and in active use.
We also looked at RHBZ#2400114 ("[RGW-multisite] after manual bucket index reshard old bucket index objects are still present", fixed in ceph-20.1.0-14) — but that fix is explicitly scoped to replicated buckets in a multisite setup, so we're not confident it applies to (or would even trigger on) a single-zone cluster like ours.
Current state
558 → 557 → 531 → 493 → 474 → 463 → 374 → 285 → 159 → 129, and we've plateaued there. The remaining 129 are 100% confined to non-current generations of 7 already-resharded, versioned Veeam buckets:
- 52 shards: gen 1 of one bucket (bilog cleared, ~400–406k real keys/shard)
- 55 shards: gen 0 of five buckets (bilog cleared, ~401–425k real keys/shard)
- 22 shards: gen 0 of two more buckets (not yet bilog-trimmed, same pattern expected)
None of the current (highest) generation of any bucket is flagged — every live shard is healthy.
Questions for the list
- Is there any supported
radosgw-adminoperation on Reef 18.2.8 (non-multisite) to force-retire / garbage-collect an old bucket-index generation that bilog trim has already fully drained, short of raising the threshold and living with it? - Is the generation-GC path described in
multisite-reshard.mdgenuinely gated on multisite sync status, and therefore expected to never fire on a single-zone cluster? If so, is that considered a known gap, or are we missing a step? - Has anyone validated manually editing a bucket's
layout.logs(viaradosgw-admin metadata get/put bucket.instance) to drop a fully-bilog-trimmed old generation on a single-site cluster? We're hesitant to do this blind given the risk of corrupting the live index. - Is there a point release (post-18.2.8, or in Squid/Tentacle) that extends the #2400114 cleanup-for-replicated-buckets fix to single-site resharding as well?
Happy to share any further output (bucket layouts, rados stat results, log snippets, etc.) on request.
Thanks in advance,