mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-23 22:40:39 +02:00
read cold remote objects straight from the origin while caching (#10731)
* refactor: extract remote mount resolution into shared helpers * refactor: share the adaptive remote cache wait policy * filer: stream cold remote reads from the origin while caching * s3: stream cold remote reads from the origin instead of 503 retries * test: cover the S3 origin stream-through path * remote mounts: match on path components and prefer the longest mount * fail short origin streams instead of silently truncating * s3: try the origin before failing a cold read on a local cache error * s3: gate origin streaming on the entry's resolved version * return the cache RPC's NotFound as a canonical status and classify it everywhere * filer: keep multipart-range cold reads on the retry path
This commit is contained in:
1 parent
a0347ca545
commit
db5a086d04
10 files changed
+509
-89
No files matched your search
@@ -7,14 +7,20 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// isFilerListNotFound reports whether a filer list error is a not-found.
|
||||
// Unlike lookups (normalized in filer_pb.LookupEntry), list errors cross gRPC
|
||||
// as raw status errors, so the sentinel survives only as text. Callers must
|
||||
// pass errors from paths without user-controlled segments that could spoof it.
|
||||
func isFilerListNotFound(err error) bool {
|
||||
return errors.Is(err, filer_pb.ErrNotFound) || strings.Contains(err.Error(), filer_pb.ErrNotFound.Error())
|
||||
// isFilerNotFound reports whether a filer error is a not-found.
|
||||
// Unlike lookups (normalized in filer_pb.LookupEntry), list and cache errors
|
||||
// cross gRPC as raw status errors, so the sentinel survives as codes.NotFound
|
||||
// or only as text. Callers must pass errors from paths without user-controlled
|
||||
// segments that could spoof it.
|
||||
func isFilerNotFound(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
return errors.Is(err, filer_pb.ErrNotFound) || status.Code(err) == codes.NotFound || strings.Contains(err.Error(), filer_pb.ErrNotFound.Error())
|
||||
}
|
||||
|
||||
// ErrorHandlers provide common error handling patterns for S3 API operations
|
||||
|
||||
Reference in new issue
Block a user