revert: remove access-frequency ILM tiering (#60)

Reverse the first-parent diff of a3df317ae0,
including the feature branch compatibility and mover follow-up fixes.
Retain the independent multi-pool correctness fixes from #178 and migrate
their shared test fixture away from access-tier code.

Tolerate retired ILM keys and XML, read old v9 statistics while writing v8,
and document migration without moving objects or rewriting their metadata.
Include regression coverage using a historical scanner/writer v9 fixture.

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-09-15 06:51:14 +08:00
parent 89637554d6
commit 9b76a21675
44 changed files with 581 additions and 5670 deletions
+4 -59
View File
@@ -26,7 +26,6 @@ import (
"strings"
"time"
"github.com/dustin/go-humanize"
"github.com/google/uuid"
"github.com/minio/minio/internal/bucket/object/lock"
"github.com/minio/minio/internal/bucket/replication"
@@ -102,56 +101,11 @@ func (a Action) Delete() bool {
// Lifecycle - Configuration for bucket lifecycle.
type Lifecycle struct {
XMLName xml.Name `xml:"LifecycleConfiguration"`
// AccessTierQuota caps how many bytes of this bucket access-based ILM
// may keep on the fastest pool, e.g. "500GiB". Empty means unlimited.
// It is bucket-wide rather than per-rule so it cannot be declared
// inconsistently by two rules matching the same object.
AccessTierQuota string `xml:"AccessTierQuota,omitempty"`
XMLName xml.Name `xml:"LifecycleConfiguration"`
Rules []Rule `xml:"Rule"`
ExpiryUpdatedAt *time.Time `xml:"ExpiryUpdatedAt,omitempty"`
}
// HasAccessTransition returns 'true' if any enabled rule carries a usable
// AccessTransition. Used as a cheap per-bucket gate before consulting the
// access tracker.
func (lc Lifecycle) HasAccessTransition() bool {
for _, rule := range lc.Rules {
if rule.Status == Disabled {
continue
}
if !rule.AccessTransition.IsNull() {
return true
}
}
return false
}
// AccessRule returns the first enabled rule matching obj that carries a usable
// AccessTransition, along with its rule ID.
func (lc Lifecycle) AccessRule(obj ObjectOpts) (AccessTransition, string, bool) {
for _, rule := range lc.FilterRules(obj) {
if !rule.AccessTransition.IsNull() {
return rule.AccessTransition, rule.ID, true
}
}
return AccessTransition{}, "", false
}
// AccessQuotaBytes returns the bucket-wide fast-pool byte cap, 0 meaning
// unlimited. The value is validated at PUT time, so a parse failure here is
// treated as unlimited rather than as an error.
func (lc Lifecycle) AccessQuotaBytes() uint64 {
if lc.AccessTierQuota == "" {
return 0
}
sz, err := humanize.ParseBytes(lc.AccessTierQuota)
if err != nil {
return 0
}
return sz
}
// HasTransition returns 'true' if lifecycle document has Transition enabled.
func (lc Lifecycle) HasTransition() bool {
for _, rule := range lc.Rules {
@@ -205,11 +159,11 @@ func (lc *Lifecycle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err e
}
lc.ExpiryUpdatedAt = &t
case "AccessTierQuota":
var q string
if err = d.DecodeElement(&q, &se); err != nil {
// Ignore the retired access-tier extension in stored configs.
// PUT uses this parser too, so it also accepts and drops it.
if err = d.Skip(); err != nil {
return err
}
lc.AccessTierQuota = q
default:
return xml.UnmarshalError(fmt.Sprintf("expected element type <Rule> but have <%s>", se.Name.Local))
}
@@ -260,9 +214,6 @@ func (lc Lifecycle) HasActiveRules(prefix string) bool {
if !rule.Transition.IsNull() { // this allows for Transition.Days to be zero.
return true
}
if !rule.AccessTransition.IsNull() {
return true
}
}
return false
}
@@ -303,12 +254,6 @@ func (lc Lifecycle) Validate(lr lock.Retention) error {
return errLifecycleNoRule
}
if lc.AccessTierQuota != "" {
if _, err := humanize.ParseBytes(lc.AccessTierQuota); err != nil {
return errAccessInvalidQuotaSize
}
}
// Validate all the rules in the lifecycle config
for _, r := range lc.Rules {
if err := r.Validate(); err != nil {