Browse Source

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.
pull/8607/head
Chris Lu 2 weeks ago
parent
commit
ab85f46529
  1. 4
      weed/s3api/s3api_bucket_handlers.go

4
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)

Loading…
Cancel
Save