From ab85f46529ad2788f30650c02b7fc7672bab6232 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 11 Mar 2026 13:49:15 -0700 Subject: [PATCH] fix(s3api): clear negative cache in autoCreateBucket when bucket exists When autoCreateBucket finds the bucket already exists, remove it from the negative cache so subsequent requests don't unnecessarily trigger another auto-create attempt. --- weed/s3api/s3api_bucket_handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/weed/s3api/s3api_bucket_handlers.go b/weed/s3api/s3api_bucket_handlers.go index 53e2fce36..d3ea00904 100644 --- a/weed/s3api/s3api_bucket_handlers.go +++ b/weed/s3api/s3api_bucket_handlers.go @@ -544,6 +544,10 @@ func (s3a *S3ApiServer) autoCreateBucket(r *http.Request, bucket string) error { } else { glog.Warningf("autoCreateBucket: failed to get entry for existing bucket %s: %v", bucket, getErr) } + // Remove bucket from negative cache — it exists now + if s3a.bucketConfigCache != nil { + s3a.bucketConfigCache.RemoveNegativeCache(bucket) + } return nil } return fmt.Errorf("failed to auto-create bucket %s: %w", bucket, err)