mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
s3api: bound route-by-key lookups at an unreachable owner filer (#12827)
* s3api: bound route-by-key lookups at an unreachable owner filer A route-by-key read (getObjectEntryRoutedByKey and the scoped .versions listing) asks the key's owner filer first, on context.Background(). When that owner sits behind a network partition that drops packets instead of refusing them, the lookup waits out gRPC's 20 s connect timeout before the failover walk asks the next filer. The owner is then skipped for only 2 s, so the next read of any key it owns dials it again and waits another 20 s. With the ring spread over two data centers, about half the keys stall every ~22 s for as long as the partition lasts (#12826). - The owner's attempt in the walk now gets a deadline, -s3.routedLookupTimeout (default 1s), when the owner is not the gateway's current filer. Past it the walk moves on to the next filer, as for any transport error, and flags the owner unreachable. The current filer and every later attempt stay unbounded, so a slow but reachable local filer still answers; 0 restores the unbounded lookup. The prior- owner probe during a ring rebalance gets the same bound. - The skip time of a failed owner is now -s3.unreachableOwnerTTL (default 2s, unchanged). Deployments that can see dropped-packet partitions can raise it so each owner is retried less often. - The S3 gateway's volume location lookups take -s3.volumeLookupTimeout per filer (default 5s, the FilerClient default, unchanged), so a vidMap miss need not wait 5 s per unreachable filer. The flags exist on weed s3 (without the s3. prefix), weed filer, weed server and weed mini. Tests (s3api_object_routed_read_deadline_test.go): an owner that never answers costs a read the deadline and is skipped by the next read (hangs without the change); with the deadline 0 a slow owner is still waited for; an owner that is the current filer is not timed out; a slow filer later in the walk is waited for; the scoped listing fails over at the deadline; the skip TTL honours the option and the default. * s3api: bound a routed listing only until the owner's first message The routed-lookup deadline covered the whole .versions stream at a remote owner. A reachable owner whose listing keeps streaming past it (a store scan trailing its first rows) was cut off mid-stream, and the failover walk refuses to replay a stream that already delivered entries, while listRetry does not retry DeadlineExceeded, so the listing failed outright where it used to succeed. Lift the deadline once the stream delivers its first message; an owner that never answers still fails over at it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+380
-9
No files matched your search
@@ -88,6 +88,16 @@ type S3ApiServerOption struct {
|
||||
// GetUser) need an explicit iam: grant instead of being allowed to every
|
||||
// authenticated identity.
|
||||
IamSelfServiceRequiresGrant bool
|
||||
// RoutedLookupTimeout bounds a route-by-key entry lookup at a key owner
|
||||
// that is not the current filer; past it the read fails over to the next
|
||||
// filer. 0 leaves the lookup unbounded.
|
||||
RoutedLookupTimeout time.Duration
|
||||
// UnreachableOwnerTTL is how long a key owner whose read just failed is
|
||||
// skipped by route-by-key reads. 0 uses defaultUnreachableOwnerTTL.
|
||||
UnreachableOwnerTTL time.Duration
|
||||
// VolumeLookupTimeout bounds each filer's answer to a volume location
|
||||
// lookup before the next filer is asked. 0 uses the FilerClient default.
|
||||
VolumeLookupTimeout time.Duration
|
||||
}
|
||||
|
||||
// s3ChunkCacheChunkSizeMB is the assumed chunk size (in MiB) used to convert
|
||||
@@ -250,6 +260,7 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl
|
||||
FilerGroup: option.FilerGroup,
|
||||
DiscoveryInterval: 5 * time.Minute,
|
||||
HomeFiler: option.HomeFiler,
|
||||
GrpcTimeout: option.VolumeLookupTimeout,
|
||||
})
|
||||
masterClient.SetOnPeerUpdateFn(filerClient.OnPeerUpdate)
|
||||
masterClient.SetOnVolumeLocationChangeFn(filerClient.OnVolumeLocationChange)
|
||||
@@ -262,7 +273,8 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl
|
||||
len(option.Filers), option.FilerGroup, option.Masters)
|
||||
} else {
|
||||
filerClient = wdclient.NewFilerClient(option.Filers, option.GrpcDialOption, option.DataCenter, &wdclient.FilerClientOption{
|
||||
HomeFiler: option.HomeFiler,
|
||||
HomeFiler: option.HomeFiler,
|
||||
GrpcTimeout: option.VolumeLookupTimeout,
|
||||
})
|
||||
glog.V(1).Infof("S3 API initialized FilerClient with %d filer(s) (no discovery)", len(option.Filers))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user