From ef1aa4f9365fed8758ed836a5994ae2229918ab7 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 3 Jun 2026 00:28:56 -0700 Subject: [PATCH] s3: defer a recently-unreachable owner that is also the current filer (#9808) Blanking preferred kept route-by-key reads from dialing a flagged owner first, but withFilerClientFailover always re-adds the current filer, so when the owner is the gateway's current filer it stayed in the candidate list and got dialed anyway. Treat a recently-unreachable filer as unhealthy in the health partition so it is deferred to the last-resort tail instead of tried before healthy replicas; preferred is still tried first, and a live owner is unaffected. --- weed/s3api/s3api_handlers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.go index 09fbbe81a..52c2d0cf3 100644 --- a/weed/s3api/s3api_handlers.go +++ b/weed/s3api/s3api_handlers.go @@ -58,16 +58,16 @@ func (s3a *S3ApiServer) withFilerClientFailover(preferred pb.ServerAddress, stre addCandidate(filer) } - // An explicit preferred owner is tried first even if health-flagged: demoting it - // behind a healthy replica would let that replica's authoritative NotFound mask a - // write that has only reached the owner. Health-order the rest, unhealthy ones - // last so a request still progresses when all are flagged. + // preferred (the routed owner) is tried first even when health-flagged, so a + // replica's authoritative NotFound can't mask a write that only reached the owner. + // A recently-unreachable filer counts as unhealthy, deferring a dead owner that is + // also the current filer to the tail rather than dialing it before healthy replicas. var healthy, unhealthy []pb.ServerAddress for _, filer := range candidates { if filer == preferred { continue } - if s3a.filerClient.ShouldSkipUnhealthyFiler(filer) { + if s3a.filerClient.ShouldSkipUnhealthyFiler(filer) || s3a.ownerRecentlyUnreachable(filer) { unhealthy = append(unhealthy, filer) } else { healthy = append(healthy, filer)