Skip to content

fix(replication): replicate ILM-created delete markers and version purges - #240

Open
julienlau wants to merge 3 commits into
pgsty:mainfrom
julienlau:fix/replication-ilm-deletes
Open

julienlau wants to merge 3 commits into
pgsty:mainfrom
julienlau:fix/replication-ilm-deletes

Conversation

@julienlau

@julienlau julienlau commented Oct 16, 2026 •

Copy link
Copy Markdown

Problem

ILM-created deletions never replicated. When ILM expiry deleted an object on a versioned bucket with replication configured, the created delete marker (or the noncurrent version purge) carried no delete replication state:

  • the S3 DELETE path evaluates checkReplicateDelete while deleting (via EvalMetadataFn) and queues replication when the decision says so;
  • the scanner (applyExpiryOnNonTransitionedObjects), transitioned-object expiry (expireTransitionedObject) and the noncurrent-version bulk path (deleteObjectVersions) never did any of that.

Result: markers were persisted with an empty replication state and the heal path skipped them (queueReplicationHeal only queues markers whose stored status is Pending/Failed, and a queued delete with an empty state is a no-op because parseReplicateDecision("") yields no targets). Versioned buckets with ILM rules silently diverged from their replication targets and from site-replication peers: expired objects stayed alive on replicas and expired noncurrent versions were never purged there.

Matches the item "ILM-created delete markers are excluded from replication" in the MinIO AIStor release notes; the defect is inherited from the common upstream base.

Changes

  • applyExpiryOnNonTransitionedObjects (scanner) and expireTransitionedObject (transitioned/restored expiry) now evaluate the delete replication decision while deleting and queue the resulting marker/purge replication — exactly what the DELETE handler does for API-originated deletes. New audit event replicate:ilm:delete. The decision gate covers both DeleteAction and DeleteVersionAction, since the decommission and heal paths also deliver noncurrent expiries through the expiry queue.
  • Noncurrent versions removed by ILM now carry the pending version-purge state (ilmPurgeToDelete), so their removal is tombstoned with replication state, queued, and converges like API purges (including the Completed → version freed semantics).
  • Deletes of restored copies and DeleteAll (prefix) expiry stay local by design.

Testing

  • New TestReplicateILMExpiryDeleteMarker: ILM expiry on a versioned bucket with a replication target creates a marker with PENDING state, queues a replicate:ilm:delete task, replicates to the target and converges to COMPLETED.
  • New TestReplicateILMExpiryNoncurrentPurge: noncurrent version removal carries PENDING purge state, replicates the purge and frees the version on both sides.
  • Existing suites pass: delete-marker MRF recovery and purge semantics, delete operation exits, lifecycle/scanner unit tests, multi-delete handler suites.

Notes

  • On site-replicated buckets every site runs the scanner with the same ILM rules, so each site may expire an object independently; those markers now replicate across sites like API deletes do. Stacked marker versions across sites are the pre-existing ILM-across-SR artifact (each site already made its own marker), and the fork's stale-creation recheck keeps late creations from resurrecting purged markers.
  • Read-back of the composite ReplicationStatus for a completed delete marker can report empty (the upstream getInternalReplicationState maps the replication timestamp into the replica timestamp and the composite then returns the empty replica status). Display-only quirk, identical in upstream; tests assert the raw per-target state instead. Out of scope here.

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

…rges

ILM expiry created delete markers and purged noncurrent versions without
a delete replication decision: the S3 DELETE path evaluates the
replication decision while deleting, but the scanner and lifecycle
expiry paths never did. ILM-created deletions therefore carried no
replication state, were skipped by the heal path (which only queues
markers with a Pending/Failed status), and never reached replication
targets or site-replication peers - versioned buckets with ILM rules
silently diverged from their replicas.

- evaluate the delete replication decision for ILM expiry deletes
  (scanner applyExpiryOnNonTransitionedObjects and transitioned-object
  expiry) and queue the resulting marker/purge replication, audited as
  replicate:ilm:delete
- attach the pending version purge state to noncurrent versions removed
  by ILM so their purge replicates and converges like API purges

Expiry of restored copies and DeleteAll (prefix) expiry stay local by
design.

Signed-off-by: Julien Laurenceau <[email protected]>
Review findings on the ILM delete replication change:

- DeleteVersionAction also reaches applyExpiryOnNonTransitionedObjects
  from the decommission and heal paths via the expiry queue, not only
  through the scanner's bulk noncurrent expiry; the replication
  decision gate must cover it or those purges would skip replication.
- the noncurrent purge test captured the version ID of the second
  upload, purging the latest version instead of the noncurrent one;
  capture the first upload's version ID.
- the test replication pool helper left the replaced global pool in
  place after the test; restore the previous singleton.

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

Vonng commented Oct 19, 2026

Copy link
Copy Markdown
Member

Thank you for the patch and tests. This is not included in 20261018000000; keeping it open for next-cycle review.

Before merge, we need to confirm the intended ILM replication policy and validate marker creation, noncurrent-version purges, Object Lock, retries/offline recovery, and concurrent expiry at multiple sites against current main. Passing CI alone does not settle those behavior changes. #217 remains a separate follow-up.

@Vonng Vonng added the bug Something isn't working label Oct 27, 2026
Vonng added a commit that referenced this pull request Nov 7, 2026
The migration follow-up for #265 (PR #276) made lifecycle-created
deletes replication-aware: the scanner, the expiry of a transitioned
version and the bulk noncurrent purge evaluated the delete replication
decision and queued a delete marker or a version purge for the targets.
That is the content of the still-open PR #240. It changes behavior for
every bucket whose replication rule replicates deletes or delete
markers, the mc default: a target with longer retention loses versions
on the source's schedule, and a purge keeps its space as a pending
tombstone until the target confirms. SILO, like S3, does not replicate
lifecycle deletes; an opt-in can come later. The release did not
replicate them.

Remove exactly the replication parts: the decision callbacks and the
post-delete scheduling in applyExpiryOnNonTransitionedObjects and
expireTransitionedObject, the scheduling in deleteObjectVersions, and
ilmPurgeToDelete; the scanner builds noncurrent entries as before. The
rest of #276 stays: the hot-tier delete before the remote one, the
free-version retry record, the lifecycle-change fence and the migration
completion checks. API deletes still replicate, and the replication heal
still handles persisted pending markers and purges. As in the release,
the replication heal also resyncs an empty-state marker when
existing-object replication applies to it.

The delete-all variant of the scheduling, which queued a task with an
empty decision, goes with it.

Tests: the scanner's noncurrent purge, run with replication configured,
deletes the version at once and queues nothing; an ILM marker carries
no replication state and the heal leaves it unless existing-object
replication applies, in which case it is resynced as before; an API
version delete still queues a purge. The cross-pool batch, dispatch and
decommission tests now assert no replication, and a decommission whose
expiry used to wait for the target completes in one run. Adding back the
scanner's decision makes the first two fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Feng Ruohang <[email protected]>
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