mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
Add retry logic for DataCoord GC minio bucket (#14095)
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
24e2faf110
commit
7c83b52de0
@ -340,15 +340,27 @@ func (s *Server) initGarbageCollection() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
has, err := cli.BucketExists(context.TODO(), Params.DataCoordCfg.MinioBucketName)
|
|
||||||
if err != nil {
|
checkBucketFn := func() error {
|
||||||
return err
|
has, err := cli.BucketExists(context.TODO(), Params.DataCoordCfg.MinioBucketName)
|
||||||
}
|
|
||||||
if !has {
|
|
||||||
err = cli.MakeBucket(context.TODO(), Params.DataCoordCfg.MinioBucketName, minio.MakeBucketOptions{})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if !has {
|
||||||
|
err = cli.MakeBucket(context.TODO(), Params.DataCoordCfg.MinioBucketName, minio.MakeBucketOptions{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
// retry times shall be two, just to prevent
|
||||||
|
// 1. bucket not exists
|
||||||
|
// 2. bucket is created by other componnent
|
||||||
|
// 3. datacoord try to create but failed with bucket already exists error
|
||||||
|
err = retry.Do(s.ctx, checkBucketFn, retry.Attempts(2))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user