From a88cdeeee70fdaf2616dd3ebca4b6e9ada542b55 Mon Sep 17 00:00:00 2001 From: DevOps Audeo <230317265+devops-audeo@users.noreply.github.com> Date: Tue, 24 Nov 2026 10:46:30 +0100 Subject: [PATCH] fix(seaweedfs): Enable lifecycle TTL fast path on nodestore and profiles buckets SeaweedFS 4.4x stopped stamping the lifecycle expiration as a volume TTL on new objects unless the per-bucket lifecycle TTL fast path is enabled, which is off by default. Since the upgrade, new nodestore/profiles objects are written to TTL-less volumes and never expire. Enable the fast path right after setlifecycle and assert it in unit tests. Fixes #4580 Co-Authored-By: Claude Opus 5.5 --- _unit-test/bootstrap-s3-nodestore-test.sh | 7 +++++++ _unit-test/bootstrap-s3-profiles-test.sh | 7 +++++++ install/bootstrap-s3-nodestore.sh | 6 ++++++ install/bootstrap-s3-profiles.sh | 6 ++++++ 4 files changed, 26 insertions(+) diff --git a/_unit-test/bootstrap-s3-nodestore-test.sh b/_unit-test/bootstrap-s3-nodestore-test.sh index 2bd052f04..bcba59e32 100755 --- a/_unit-test/bootstrap-s3-nodestore-test.sh +++ b/_unit-test/bootstrap-s3-nodestore-test.sh @@ -13,4 +13,11 @@ for i in $(seq 1 5); do source install/bootstrap-s3-nodestore.sh done +# Ensure that the lifecycle TTL fast path is enabled, otherwise new objects never expire +fastpath_status=$(echo "s3.bucket.lifecycle.fastpath -name=nodestore" | $dc exec -T seaweedfs weed shell) +if ! echo "$fastpath_status" | grep -q "Lifecycle TTL fast path: enabled"; then + echo "Error: Expected the lifecycle TTL fast path to be enabled on the 'nodestore' bucket" + exit 1 +fi + report_success diff --git a/_unit-test/bootstrap-s3-profiles-test.sh b/_unit-test/bootstrap-s3-profiles-test.sh index 6cd0b229a..f8f9cba3f 100755 --- a/_unit-test/bootstrap-s3-profiles-test.sh +++ b/_unit-test/bootstrap-s3-profiles-test.sh @@ -20,6 +20,13 @@ if ! $dc exec seaweedfs s3cmd --access_key=sentry --secret_key=sentry --no-ssl - exit 1 fi +# Ensure that the lifecycle TTL fast path is enabled, otherwise new objects never expire +fastpath_status=$(echo "s3.bucket.lifecycle.fastpath -name=profiles" | $dc exec -T seaweedfs weed shell) +if ! echo "$fastpath_status" | grep -q "Lifecycle TTL fast path: enabled"; then + echo "Error: Expected the lifecycle TTL fast path to be enabled on the 'profiles' bucket" + exit 1 +fi + # Manual cleanup, otherwise `create-docker-volumes.sh` will fail $dc down -v --remove-orphans diff --git a/install/bootstrap-s3-nodestore.sh b/install/bootstrap-s3-nodestore.sh index 02a243d1c..898ed344d 100644 --- a/install/bootstrap-s3-nodestore.sh +++ b/install/bootstrap-s3-nodestore.sh @@ -88,6 +88,12 @@ EOF $dc exec seaweedfs sh -c "printf '%s' '$lifecycle_policy' > /tmp/nodestore-lifecycle-policy.xml" $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' setlifecycle /tmp/nodestore-lifecycle-policy.xml s3://nodestore $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://nodestore + + # SeaweedFS only stamps the lifecycle expiration as a volume TTL on new objects + # when the per-bucket lifecycle TTL fast path is enabled, off by default since + # SeaweedFS 4.32 (seaweedfs/seaweedfs#9825). + echo "Making sure the lifecycle TTL fast path is enabled..." + echo "s3.bucket.lifecycle.fastpath -name=nodestore -enable" | $dc exec -T seaweedfs weed shell fi echo "${_endgroup}" diff --git a/install/bootstrap-s3-profiles.sh b/install/bootstrap-s3-profiles.sh index dd684f4f4..c8b4cc42d 100644 --- a/install/bootstrap-s3-profiles.sh +++ b/install/bootstrap-s3-profiles.sh @@ -96,6 +96,12 @@ EOF echo "Making sure the bucket lifecycle policy is all set up correctly..." $s3cmd --access_key=sentry --secret_key=sentry --no-ssl --region=us-east-1 --host=localhost:8333 --host-bucket='localhost:8333/%(bucket)' getlifecycle s3://profiles + + # SeaweedFS only stamps the lifecycle expiration as a volume TTL on new objects + # when the per-bucket lifecycle TTL fast path is enabled, off by default since + # SeaweedFS 4.32 (seaweedfs/seaweedfs#9825). + echo "Making sure the lifecycle TTL fast path is enabled..." + echo "s3.bucket.lifecycle.fastpath -name=profiles -enable" | $dc exec -T seaweedfs weed shell fi echo "${_endgroup}" fi