Skip to content

rgw: fix bilog autotrim of stale bucket.instance metadata after peer deletion - #70003

Merged
BBoozmen merged 5 commits into
ceph:mainfrom
BBoozmen:wip-oozmen-70858
Jul 22, 2026
Merged

BBoozmen merged 5 commits into
ceph:mainfrom
BBoozmen:wip-oozmen-70858

Conversation

@BBoozmen

@BBoozmen BBoozmen commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes https://tracker.ceph.com/issues/70858

Summary

Bilog autotrim can permanently leave orphaned bucket.instance metadata after a bucket is deleted. When a peer zone reports -ENOENT for a bucket's sync status, the code only treated it as "peer is done with this bucket" if the local zone had already received the Deleted flag via metadata sync; however, that flag can never arrive if the source zone's own autotrim already removed its instance metadata first, since metadata-sync removal is a no-op by design. This fix trusts a peer's -ENOENT unconditionally and directly removes orphaned instance metadata once all peers confirm the bucket is gone, closing the race.

Preliminary QA Testing

Just wanted to see how it works on teuthology, submitted a couple of multisite jobs. Due to some lab issues (due to storm I think) some jobs were dead saying "["Wanted 2 disks of ~1700 GB (rotational=False), but only matched 1: ['nvme0n1']"]" but got a good preliminary when/if this is approved, I'll send this for a final QA test.

Test branch that has this changeset: https://github.com/ceph/ceph-ci/tree/wip-oozmen-trim-after-reshard
QA multisite runs:

[1] rgw:multisite run https://pulpito.ceph.com/bcs-ceph-2026-07-05_11:36:33-rgw:multisite-wip-oozmen-trim-after-reshard-distro-default-trial/

  • Job 341012 -> all tests passed including all 4 'bucket_trim' tests.
  • Other Job - dead - no run

[2] rgw:multisite run https://pulpito.ceph.com/bcs-ceph-2026-07-05_11:36:17-rgw:multisite-wip-oozmen-trim-after-reshard-distro-default-trial/

  • 341008 -> -> all tests passed including all 4 'bucket_trim' tests.
  • 341007 -> 1 test failed another known issue rgw_multi.tests.test_copy_object_different_bucket

[3] rgw run https://pulpito.ceph.com/bcs-ceph-2026-07-05_11:34:14-rgw-wip-oozmen-trim-after-reshard-distro-default-trial/

  • 340974 -> all tests passed including all 4 'bucket_trim' tests.
  • Other Job - dead - no run

So, 4 rgw:multisite runs passed the 'bucket_trim' tests.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@BBoozmen BBoozmen self-assigned this Jul 7, 2026
@BBoozmen
BBoozmen marked this pull request as ready for review July 7, 2026 16:21
@BBoozmen
BBoozmen requested a review from a team as a code owner July 7, 2026 16:21
@smanjara

smanjara commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

I think the test always fails with the two-zonegroup configuration.

@smanjara

smanjara commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

I think its always the two-zonegroup configuration that fails.

and these are the ones failing currently with "["Wanted 2 disks of ~1700 GB (rotational=False), but only matched 1: ['nvme0n1']"]"

@BBoozmen

BBoozmen commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

I think its always the two-zonegroup configuration that fails.

and these are the ones failing currently with "["Wanted 2 disks of ~1700 GB (rotational=False), but only matched 1: ['nvme0n1']"]"

Let me rerun them.

@BBoozmen

Copy link
Copy Markdown
Contributor Author

I think its always the two-zonegroup configuration that fails.

and these are the ones failing currently with "["Wanted 2 disks of ~1700 GB (rotational=False), but only matched 1: ['nvme0n1']"]"

@smanjara below are the re-run (of failed and dead jobs) results. all runs for this test branch provides the full list of runs: 3 original analyzed above and the top 3 are the re-runs of them. Original submissions were analyzed in description section above; below are the analysis of re-runs (in particular multisite with 2 zonegroup cfg).

[1] rgw::multisite (two-zonegroup) -> https://pulpito.ceph.com/bcs-ceph-2026-07-07_20:17:08-rgw:multisite-wip-oozmen-trim-after-reshard-distro-default-trial/:

2026-07-09T23:11:56.573 INFO:tasks.rgw_multisite_tests:FAIL: rgw_multi.tests.test_copy_object_different_bucket
...
2026-07-09T23:11:56.574 INFO:tasks.rgw_multisite_tests:Ran 58 tests in 4071.905s
2026-07-09T23:11:56.574 INFO:tasks.rgw_multisite_tests:
2026-07-09T23:11:56.574 INFO:tasks.rgw_multisite_tests:FAILED (SKIP=2, failures=1)

All 4 'bucket_trim' tests passed...Only 1 test failed which is being addressed in another PR.

[2] rgw::multisite (two-zonegroup) -> https://pulpito.ceph.com/bcs-ceph-2026-07-07_19:50:19-rgw:multisite-wip-oozmen-trim-after-reshard-distro-default-trial/:

2026-07-09T23:06:17.440 INFO:tasks.rgw_multisite_tests:FAIL: rgw_multi.tests.test_copy_object_same_bucket
...
2026-07-09T23:06:17.442 INFO:tasks.rgw_multisite_tests:Ran 58 tests in 3719.066s
2026-07-09T23:06:17.442 INFO:tasks.rgw_multisite_tests:
2026-07-09T23:06:17.442 INFO:tasks.rgw_multisite_tests:FAILED (SKIP=2, failures=1)

All 4 'bucket_trim' tests passed...Only 1 test failed which is being addressed in another PR.

[3] rgw (all suites) -> https://pulpito.ceph.com/bcs-ceph-2026-07-07_20:17:46-rgw-wip-oozmen-trim-after-reshard-distro-default-trial/; multisite job (two-zonegroup) passed all tests: no failures

2026-07-09T22:58:22.084 INFO:tasks.rgw_multisite_tests:Ran 58 tests in 3182.461s
2026-07-09T22:58:22.084 INFO:tasks.rgw_multisite_tests:
2026-07-09T22:58:22.084 INFO:tasks.rgw_multisite_tests:OK (SKIP=2)

To sum up, looking at all 6 submissions multisite runs, things look good:

  • no new failures
  • all 4 bucket_trim (3 existing + the new one) pass consistently across multiple runs

If you are OK with the changes, I'll do one last full rgw suites QA run. Please have a look.

Comment thread src/rgw/driver/rados/rgw_trim_bilog.cc Resolved
@BBoozmen BBoozmen added the wip-oozmen-testing for teuthology integration testing to be used via build-integration-branch.sh label Jul 14, 2026
BBoozmen added 5 commits July 17, 2026 14:24
…ary reshard

Adds test_bucket_log_trim_enoent_race_after_reshard to reproduce the
exact failure from tracker ceph#70858: when autotrim runs on the primary
zone first and fully cleans up (including removing its own bucket.instance
metadata), then an autotrim on the secondary zone asks the primary
and receives -ENOENT.

The secondary hasn't received the BucketLogType::Deleted
flag yet (metadata sync is stalled via delay injection), so the current code
left StatusShards{generation=0, shards=[]} which caused take_min_status()
to fail with -EINVAL, leaving the bucket.instance metadata permanently
orphaned.

Tests: https://tracker.ceph.com/issues/70858
Signed-off-by: Oguzhan Ozmen <[email protected]>
An all-peer -ENOENT does not by itself mean a bucket is deleted: a live
bucket whose sync status is not yet initialized returns -ENOENT too. Add
two testcases that verifies we do not accidentally delete instance of a
live bucket:

- test_bucket_log_trim_live_empty_bucket_not_removed: a data-less bucket
  never gets sync status, so every peer reports -ENOENT; autotrim must not
  remove its instance.
- test_bucket_log_trim_new_bucket_entrypoint_not_synced: a new bucket
  whose instance has synced to the secondary before its entrypoint must
  survive autotrim. A delay_meta_sync_bucket_entrypoint_store injection
  forces that window.

Tests: https://tracker.ceph.com/issues/70858
Signed-off-by: Oguzhan Ozmen <[email protected]>
When a peer returns -ENOENT for a bucket's sync status, the old code only
purged the log if the local layout already carried BucketLogType::Deleted.
That flag may never arrive once the deleting zone removes its own instance
(ceph#70858), so trim aborted with -EINVAL and left bucket.instance metadata
orphaned.

But an all-peer -ENOENT is also ambiguous: a live bucket whose sync status is
not yet initialized looks the same. The Deleted flag is unreliable here,
and the local entrypoint is not authoritative during creation (the
instance syncs to peers before the entrypoint). So on all-peer -ENOENT,
confirm the bucket is really gone by reading its entrypoint from the
metadata master, which is authoritative and available immediately on
creation; if this zone is the metadata master its local read already
suffices. Only on confirmed deletion remove the orphaned instance
directly; on any failure, skip and retry on the next trim cycle.

Fixes: https://tracker.ceph.com/issues/70858
Signed-off-by: Oguzhan Ozmen <[email protected]>
…s shards CR

The peer -ENOENT handling in RGWReadRemoteStatusShardsCR no longer
consults the local bucket layout (whether Deleted flag set or not),
so its bucket_info member and the matching constructor arg are
not used anymore.

Signed-off-by: Oguzhan Ozmen <[email protected]>
Raise a few low-frequency, high-signal bilog trim events so they are
visible at the default log level:

Trim pace is bounded by the rgw trim config options and these events
fire at most once per bucket or once per trim cycle, so they are not
expected to be chatty.

Signed-off-by: Oguzhan Ozmen <[email protected]>
@BBoozmen

Copy link
Copy Markdown
Contributor Author

ceph-ci branch: https://github.com/ceph/ceph-ci/tree/wip-oozmen-trim-reshard-testing-2026-07-17-1429
QA test results: https://pulpito.ceph.com/bcs-ceph-2026-07-17_18:32:55-rgw-wip-oozmen-trim-reshard-testing-2026-07-17-1429-distro-default-trial/

image

All testsutes passed except for rgw/d4n which is a known issue:

Specifically, both multisite suites (2-zone and 2-zonegroup) passed all tests including all 6 bucket_trim tests:

...
2026-07-17T20:09:19.773 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_index_log_trim ... ok
2026-07-17T20:10:15.423 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_log_trim_after_delete_bucket_primary_reshard ... ok
2026-07-17T20:11:11.990 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_log_trim_after_delete_bucket_secondary_reshard ... ok
2026-07-17T20:12:31.271 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_log_trim_enoent_race_after_reshard ... ok
2026-07-17T20:12:56.697 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_log_trim_live_empty_bucket_not_removed ... ok
2026-07-17T20:14:07.785 INFO:tasks.rgw_multisite_tests:rgw_multi.tests.test_bucket_log_trim_new_bucket_entrypoint_not_synced ... ok
..
2026-07-17T20:52:51.368 INFO:tasks.rgw_multisite_tests:----------------------------------------
2026-07-17T20:52:51.368 INFO:tasks.rgw_multisite_tests:Ran 60 tests in 3995.228s
2026-07-17T20:52:51.368 INFO:tasks.rgw_multisite_tests:
2026-07-17T20:52:51.368 INFO:tasks.rgw_multisite_tests:OK (SKIP=2)

@BBoozmen BBoozmen added TESTED and removed wip-oozmen-testing for teuthology integration testing to be used via build-integration-branch.sh labels Jul 18, 2026
@smanjara
smanjara self-requested a review July 21, 2026 17:26
@BBoozmen
BBoozmen merged commit 9e160aa into ceph:main Jul 22, 2026
6 checks passed
@smanjara smanjara mentioned this pull request Jul 27, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants