fix(ilm): notify on batch noncurrent version expiry (#7116)

The batch `NewerNoncurrentVersions` expiry path took a lifecycle event
argument and ignored it: after `delete_objects` committed it only evicted
the cache and scheduled replication deletes, so a successful noncurrent
version expiry was invisible to notification subscribers while the
equivalent current-version path emitted a lifecycle expiration event.

Emit that event from the batch path too, reusing the existing lifecycle
audit sink and event contract. Only entries that actually mutated
something are announced, and cache eviction and replication scheduling
keep their existing order and admission — the event is derived from the
committed result and a send failure never rolls back a delete.

"No error" is not enough to prove a mutation: the disk layer skips an
absent version and reports success, so a batch entry for a version that
was already gone came back indistinguishable from a committed delete.
The delete plan already resolves whether the source exists, so carry that
`source_missing` result on `DeletedObject` and let the lifecycle path
stay silent for versions it did not remove.

backlog#2202
This commit is contained in:
Zhengchao An
2026-09-04 18:25:10 +08:00
committed by GitHub
parent f16a30b231
commit 7ff578ff20
6 changed files with 340 additions and 9 deletions
+10
View File
@@ -243,6 +243,16 @@ impl ObjectToDelete {
#[derive(Debug, Default, Clone)]
pub struct DeletedObject {
pub delete_marker: bool,
/// True when the delete plan looked the target up and found no such
/// object or version.
///
/// The lookup only runs when the plan needs the source (Object Lock
/// check, replication decision, tier journal, or an expected identity),
/// so this proves absence and never proves presence: it stays false when
/// no lookup ran. Callers that must not announce a delete that removed
/// nothing need this, because the disk layer treats an absent version as
/// an idempotent success and reports `found` regardless.
pub source_missing: bool,
pub delete_marker_version_id: Option<Uuid>,
pub object_name: String,
pub version_id: Option<Uuid>,