Refine Read method of MinioChunkManager (#22235)

Signed-off-by: jaime <yun.zhang@zilliz.com>
pull/22325/head
jaime 2023-02-21 16:22:26 +08:00 committed by GitHub
parent 0ce70b4f10
commit 5936723904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -4411,7 +4411,7 @@ 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")
ctx, sp := otel.Tracer(typeutil.ProxyRole).Start(ctx, "Proxy-RenameCollection")
defer sp.End()
log := log.Ctx(ctx).With(

View File

@ -236,6 +236,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("bucket", mcm.bucketName), zap.String("path", filePath), zap.Error(err))