mirror of https://github.com/milvus-io/milvus.git
Refine Read method of MinioChunkManager (#22257)
Signed-off-by: jaime <yun.zhang@zilliz.com>pull/22313/head
parent
cd2e7fa535
commit
eac4523c79
|
@ -25,7 +25,6 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
@ -4735,8 +4734,8 @@ func (node *Proxy) CheckHealth(ctx context.Context, request *milvuspb.CheckHealt
|
|||
}
|
||||
|
||||
func (node *Proxy) RenameCollection(ctx context.Context, req *milvuspb.RenameCollectionRequest) (*commonpb.Status, error) {
|
||||
ctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, "Proxy-RefreshPolicyInfoCache")
|
||||
defer sp.End()
|
||||
sp, ctx := trace.StartSpanFromContextWithOperationName(ctx, "Proxy-RenameCollection")
|
||||
defer sp.Finish()
|
||||
|
||||
log := log.Ctx(ctx).With(
|
||||
zap.String("role", typeutil.ProxyRole),
|
||||
|
|
|
@ -235,6 +235,18 @@ func (mcm *MinioChunkManager) Read(ctx context.Context, filePath string) ([]byte
|
|||
}
|
||||
defer object.Close()
|
||||
|
||||
// Prefetch object data
|
||||
var empty []byte
|
||||
_, err = object.Read(empty)
|
||||
if err != nil {
|
||||
errResponse := minio.ToErrorResponse(err)
|
||||
if errResponse.Code == "NoSuchKey" {
|
||||
return nil, WrapErrNoSuchKey(filePath)
|
||||
}
|
||||
log.Warn("failed to read object", zap.String("path", filePath), zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
objectInfo, err := object.Stat()
|
||||
if err != nil {
|
||||
log.Warn("failed to stat object", zap.String("path", filePath), zap.Error(err))
|
||||
|
|
Loading…
Reference in New Issue