mirror of
https://github.com/pgsty/minio.git
synced 2026-11-11 01:55:30 +03:00
94d91703b5
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>
59 lines
2.7 KiB
Go
59 lines
2.7 KiB
Go
// Copyright (c) 2024 MinIO, Inc.
|
|
//
|
|
// # This file is part of MinIO Object Storage stack
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const (
|
|
expiryPendingTasks = "expiry_pending_tasks"
|
|
transitionActiveTasks = "transition_active_tasks"
|
|
transitionPendingTasks = "transition_pending_tasks"
|
|
transitionMissedImmediateTasks = "transition_missed_immediate_tasks"
|
|
versionsScanned = "versions_scanned"
|
|
expiryIncompleteTotal = "expiry_incomplete_total"
|
|
)
|
|
|
|
var (
|
|
ilmExpiryPendingTasksMD = NewGaugeMD(expiryPendingTasks, "Number of pending ILM expiry tasks in the queue")
|
|
ilmTransitionActiveTasksMD = NewGaugeMD(transitionActiveTasks, "Number of active ILM transition tasks")
|
|
ilmTransitionPendingTasksMD = NewGaugeMD(transitionPendingTasks, "Number of pending ILM transition tasks in the queue")
|
|
ilmTransitionMissedImmediateTasksMD = NewCounterMD(transitionMissedImmediateTasks, "Number of missed immediate ILM transition tasks")
|
|
ilmVersionsScannedMD = NewCounterMD(versionsScanned, "Total number of object versions checked for ILM actions since server start")
|
|
ilmExpiryIncompleteTotalMD = NewCounterMD(expiryIncompleteTotal, "Total number of ILM expiry attempts since server start that ended without removing what they addressed, by reason", "reason")
|
|
)
|
|
|
|
// loadILMMetrics - `MetricsLoaderFn` for ILM metrics.
|
|
func loadILMMetrics(_ context.Context, m MetricValues, _ *metricsCache) error {
|
|
if globalExpiryState != nil {
|
|
m.Set(expiryPendingTasks, float64(globalExpiryState.PendingTasks()))
|
|
}
|
|
if globalTransitionState != nil {
|
|
m.Set(transitionActiveTasks, float64(globalTransitionState.ActiveTasks()))
|
|
m.Set(transitionPendingTasks, float64(globalTransitionState.PendingTasks()))
|
|
m.Set(transitionMissedImmediateTasks, float64(globalTransitionState.MissedImmediateTasks()))
|
|
}
|
|
m.Set(versionsScanned, float64(globalScannerMetrics.lifetime(scannerMetricILM)))
|
|
for reason, n := range globalILMIncomplete.snapshot() {
|
|
m.Set(expiryIncompleteTotal, float64(n), "reason", reason)
|
|
}
|
|
|
|
return nil
|
|
}
|