mirror of
https://github.com/pgsty/minio.git
synced 2026-11-10 17:45:32 +03:00
fix(ilm): report expiries that remove nothing, and name what one removed
An ILM expiry that is refused, because the rule no longer applies when
it is checked again under the object lock or Object Lock protects the
version, or that fails, for example for lack of quorum, left almost no
trace. The bulk noncurrent purge skipped such entries without audit,
trace, log or count; the scanner traced a refusal exactly like a
successful expiry; and nothing counted either. Operators could not see
why a version they expected gone was still there.
- Count every such expiry by reason in expiry_incomplete_total
{reason="not_applicable"|"locked"|"history_unavailable"|"error"}, in
metrics v2 and v3; the counting unit is one expiry attempt, and no
bucket or object is a label.
- Trace it with result=refused or result=failed and the reason. A
failure is also audited and logged once per object; a refusal changes
nothing and is not audited, since a split key is refused on every scan.
- Never announce it: no ObjectRemoved notification for a version that is
still there.
- Name a completed expiry by what its delete did. An expiry that
addressed no version and whose result is a delete marker created that
marker, also with the null version ID of the version it replaced; any
other removed the version it addressed, also a delete marker. The
scanner and the transitioned expiry took the identity from the queued
object instead: the expiry of a latest transitioned version in a
versioned bucket announced the removal of the version it kept, and the
removal of an expired delete marker was announced as a marker created.
Tests: classification of each error; a bulk purge with a refused, a
failed and a removed entry counts and traces the first two, audits only
the failure and announces only the removal; the expiry events name the
created marker for a latest version (versioned, suspended null,
transitioned) and the removed version for a noncurrent version and an
expired delete marker; both metrics versions export the counter by
reason. The #278 side-effect tests now tell removal traces from
refusal and failure traces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -216,12 +216,18 @@ func TestPoolsLifecycleBatchRejectionNotAnnounced(t *testing.T) {
|
||||
}
|
||||
// Both publishers deliver synchronously, so everything sent is buffered.
|
||||
var notified, traced []string
|
||||
refusedTraces := map[string]string{}
|
||||
for drained := false; !drained; {
|
||||
select {
|
||||
case ev := <-events:
|
||||
notified = append(notified, ev.S3.Object.VersionID)
|
||||
case tr := <-traces:
|
||||
if tr.FuncName == ILMExpiry {
|
||||
if r := tr.Custom["result"]; r != "" {
|
||||
// Not a removal: the expiry was refused or failed.
|
||||
refusedTraces[tr.Custom["version-id"]] = r
|
||||
continue
|
||||
}
|
||||
traced = append(traced, tr.Custom["version-id"])
|
||||
}
|
||||
default:
|
||||
@@ -234,4 +240,7 @@ func TestPoolsLifecycleBatchRejectionNotAnnounced(t *testing.T) {
|
||||
if len(traced) != 1 || traced[0] != eligible {
|
||||
t.Errorf("ILM expiry traces for %v, want only eligible %s (retained %s)", traced, eligible, retained)
|
||||
}
|
||||
if refusedTraces[retained] != "refused" {
|
||||
t.Errorf("the retained version's refusal is not traced: %v", refusedTraces)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user