Skip to content

fix(site-replication): keep replicated bucket deletions from being resurrected - #241

Open
julienlau wants to merge 1 commit into
pgsty:mainfrom
julienlau:fix/sr-deleted-bucket-resurrection
Open

julienlau wants to merge 1 commit into
pgsty:mainfrom
julienlau:fix/sr-deleted-bucket-resurrection

Conversation

@julienlau

Copy link
Copy Markdown

Problem

A deleted bucket could reappear on other replicated sites. Site replication records a deletion as a tombstone under .minio.sys/buckets/.deleted/<bucket> and the heal loop reconciles bucket state from per-site creation/deletion times — but nothing guarded bucket creation itself:

  • a stale or replayed bucket make — a MakeBucketHook retry, syncToAllPeers during site join, or a heal snapshot taken before a concurrent delete — recreated the bucket on sites where it had been deleted;
  • when the make carried no lineage time, SetCreatedAt fabricated "now", so a resurrected bucket looked newer than its own deletion and the heal loop then kept it;
  • re-deleting a bucket with an existing tombstone silently kept the old tombstone time (MakeVol returns errVolumeExists and the error is ignored), making the recorded deletion look older than the actual delete;
  • GetBucketInfo(Deleted) only reported a tombstone when the bucket volume was already gone, hiding stale tombstones behind a live volume (listBucketsLocal already reported them).

Matches the item "A deleted bucket could reappear on other replicated sites" in the MinIO AIStor release notes; the tombstone/heal machinery is inherited from the common upstream base.

Changes

  • PeerBucketMakeWithVersioningHandler — the single choke point for all replicated bucket creations (hook fan-out, heal, syncToAllPeers) — now rejects makes whose creation time is older than (or missing compared to) the local tombstone (errSRStaleBucketCreate), and clears the tombstone when a genuinely newer re-creation wins.
  • MakeBucketHook falls back to a fresh timestamp instead of propagating an unknown (zero) lineage.
  • Bucket deletion refreshes an existing tombstone so the recorded deletion time stays accurate.
  • getBucketInfoLocal reports tombstones for live bucket volumes too, matching listBucketsLocal.

Testing

  • TestSRStaleBucketCreateRejected: makes older than / without lineage are rejected, the bucket stays deleted, the tombstone survives for the heal loop.
  • TestSRNewerBucketCreateClearsTombstone: a newer re-creation succeeds and clears the obsolete tombstone.
  • TestSRGetBucketInfoReportsTombstone and TestSRDeleteRefreshesTombstone.
  • Existing site-replication bucket-adoption and bucket-metadata suites pass.

Signed-off-by: Julien Laurenceau [email protected]

…surrected

A deleted bucket could reappear on other replicated sites. Site
replication records a deletion as a tombstone under
.minio.sys/buckets/.deleted/<bucket> and the heal loop reconciles
buckets from per-site creation/deletion times, but nothing guarded
bucket creation itself:

- a stale or replayed bucket make (hook retry, syncToAllPeers, a heal
  snapshot taken before a delete) recreated the bucket on sites where
  it was deleted;
- SetCreatedAt fabricated the current time when the make carried no
  lineage, so a resurrected bucket looked newer than its own deletion
  and the heal loop then kept it;
- re-deleting a bucket with an existing tombstone silently kept the
  old tombstone time (MakeVol returns errVolumeExists and the error is
  ignored), making the recorded deletion older than the actual delete;
- GetBucketInfo(Deleted) only reported a tombstone when the bucket
  volume was already gone, hiding stale tombstones behind a live
  volume (listBucketsLocal already reported them).

PeerBucketMakeWithVersioningHandler is the single choke point for all
replicated bucket creations (hook fan-out, heal, syncToAllPeers), so
it now rejects makes whose lineage is older than (or missing compared
to) the local tombstone, and clears the tombstone when a genuinely
newer re-creation wins. MakeBucketHook falls back to a fresh timestamp
instead of propagating an unknown lineage, re-deletes refresh the
tombstone, and GetBucketInfo(Deleted) reports tombstones consistently.

Signed-off-by: Julien Laurenceau <[email protected]>
@Vonng

Vonng commented Oct 19, 2026

Copy link
Copy Markdown
Member

Thank you for the focused fix. This is not included in 20261018000000; keeping it open for next-cycle review.

The remaining acceptance is to verify stale and missing-lineage creates, concurrent delete/recreate, repeated deletion timestamps, and restart/offline-peer recovery on current main. Legitimate newer recreations must remain possible. This bucket-level tombstone work is separate from the object-version purge cases in #217.

@Vonng Vonng added the bug Something isn't working label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants