return underlying error with BackendDown{} error (#16738)

This commit is contained in:
jiuker 2023-03-04 15:56:53 +08:00 committed by GitHub
parent 4636d3a9c3
commit 9d062b37d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ import (
"github.com/minio/minio/internal/hash"
"github.com/minio/minio/internal/logger"
"github.com/minio/minio/internal/sync/errgroup"
xnet "github.com/minio/pkg/net"
"github.com/minio/pkg/wildcard"
)
@ -447,7 +448,10 @@ func (c *cacheObjects) GetObjectInfo(ctx context.Context, bucket, object string,
return cachedObjInfo, nil
}
c.cacheStats.incMiss()
return ObjectInfo{}, BackendDown{}
if xnet.IsNetworkOrHostDown(err, false) {
return ObjectInfo{}, BackendDown{Err: err.Error()}
}
return ObjectInfo{}, err
}
// Reaching here implies cache miss
c.cacheStats.incMiss()