Files
seaweedfs/weed/worker
3afc4e30bf worker: filer_ttl expires S3 objects in buckets without lifecycle rules (#13396)
* worker: filer_ttl expires S3 objects in buckets without lifecycle rules

The job skipped every entry carrying the S3 expiry flag, to leave
lifecycle expiry to s3_lifecycle. The filer puts that flag on any S3
object it gives a TTL, a filer.conf path rule's TTL as well, and
s3_lifecycle only evaluates buckets that have lifecycle rules. So the
rows of objects uploaded through S3 under a plain path TTL were never
removed unless something looked them up or listed their directory.

A flagged entry is now left to s3_lifecycle only in a bucket with
lifecycle rules, read with the loader that job uses. Elsewhere the job
expires it at the time the filer's lookups do, which for an S3 object
counts from its mtime.

* worker: filer_ttl leaves S3 objects to s3_lifecycle only where rules stamp TTLs

Lifecycle rules put a TTL on an object only in a bucket with the
lifecycle TTL fast path on. In any other bucket the TTL of a flagged
object came from a path rule, and s3_lifecycle, which expires by its
rules, never removes it: a bucket whose only rule aborts multipart
uploads, or expires another prefix, kept such objects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: filer_ttl leaves a bucket to s3_lifecycle only for a rule the fast path stamps

A fast-path bucket whose configuration is empty, or holds only rules
that expire nothing after days (abort multipart uploads, noncurrent
versions, tag filters), stamps no TTL, so its flagged objects carry the
path rule's TTL like any other bucket's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: filer_ttl defers only the objects a stamping rule matches

A fast-path rule stamps its TTL only on keys under its prefix and
within its size filters, so another object in the same bucket got its
TTL from the path rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: filer_ttl lists each rule once more for the S3 objects its cursor passed

The cursors saved so far moved past every S3 object, which the replay
skipped, and nothing lists a rule that has a cursor. They are now saved
under a new name, so after the upgrade each rule is new once: it is
listed, which removes the expired objects, and replayed from a fresh
cursor.

* worker: filer_ttl defers only a TTL the fast path stamped

A flagged object whose TTL differs from the one its matching fast-path
rules stamp got it from a path rule (a multipart upload, or an object
written before the rule), so filer_ttl expires it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: filer_ttl lists a rule again when its buckets' fast-path rules change

The replay moves past an object it leaves to s3_lifecycle. Each cursor
now keeps a signature of the fast-path rules of the buckets its rule
covers, and a different signature has the rule listed, which removes
the objects whose lifecycle rule was removed or changed once they are
due.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* worker: filer_ttl quotes the prefixes it hashes into a lifecycle signature

A prefix holding a tab or newline could make two rule lists hash alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: MapleWhiteZZZ <18653045+MapleWhiteZZZ@users.noreply.github.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 11:26:53 -08:00
..