From 70d53ce91a4c1b81cf40a418e02d7ce65bade2e2 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 14 Sep 2025 22:49:03 -0700 Subject: [PATCH] s3: further improve filer consistency retry logic for CI environment - Increase retry attempts from 5 to 8 for both updateLatestVersionInDirectory and getLatestObjectVersion functions - Increase base delay from 50ms to 100ms with exponential backoff up to 6.4s - Add specific retry logic for 'no Extended metadata' race condition where .versions directory exists but metadata is not yet written - Add detailed timing logs to track retry delays and total wait times - Addresses persistent CI failures where even 5 retries with 400ms max delay were insufficient for filer store consistency in GitHub Actions environment --- weed/s3api/s3api_object_handlers_put.go | 9 +++-- weed/s3api/s3api_object_versioning.go | 53 ++++++++++++++++++------- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go index 0bb9d2795..dc97fb813 100644 --- a/weed/s3api/s3api_object_handlers_put.go +++ b/weed/s3api/s3api_object_handlers_put.go @@ -643,7 +643,7 @@ func (s3a *S3ApiServer) updateLatestVersionInDirectory(bucket, object, versionId // Get the current .versions directory entry with retry logic for filer consistency var versionsEntry *filer_pb.Entry var err error - maxRetries := 5 + maxRetries := 8 for attempt := 1; attempt <= maxRetries; attempt++ { versionsEntry, err = s3a.getEntry(bucketDir, versionsObjectPath) if err == nil { @@ -653,15 +653,16 @@ func (s3a *S3ApiServer) updateLatestVersionInDirectory(bucket, object, versionId glog.V(0).Infof("CI-DEBUG: updateLatestVersionInDirectory: attempt %d/%d failed to get .versions entry for %s/%s: %v", attempt, maxRetries, bucket, object, err) if attempt < maxRetries { - // Exponential backoff: 50ms, 100ms, 200ms, 400ms - delay := time.Millisecond * time.Duration(50 * (1 << (attempt - 1))) + // Exponential backoff with higher base: 100ms, 200ms, 400ms, 800ms, 1600ms, 3200ms, 6400ms + delay := time.Millisecond * time.Duration(100 * (1 << (attempt - 1))) + glog.V(0).Infof("CI-DEBUG: updateLatestVersionInDirectory: sleeping %v before retry %d", delay, attempt+1) time.Sleep(delay) } } if err != nil { glog.Errorf("updateLatestVersionInDirectory: failed to get .versions directory for %s/%s after %d attempts: %v", bucket, object, maxRetries, err) - glog.V(0).Infof("CI-DEBUG: updateLatestVersionInDirectory: FAILED to get .versions entry for %s/%s after %d attempts: %v", bucket, object, maxRetries, err) + glog.V(0).Infof("CI-DEBUG: updateLatestVersionInDirectory: FAILED to get .versions entry for %s/%s after %d attempts (total delay ~%dms): %v", bucket, object, maxRetries, (100*(1<