Add retry logic for DataCoord GC minio bucket (#14095)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2021-12-23 21:48:25 +08:00 committed by GitHub
parent 24e2faf110
commit 7c83b52de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,6 +340,8 @@ func (s *Server) initGarbageCollection() error {
if err != nil {
return err
}
checkBucketFn := func() error {
has, err := cli.BucketExists(context.TODO(), Params.DataCoordCfg.MinioBucketName)
if err != nil {
return err
@ -350,6 +352,16 @@ func (s *Server) initGarbageCollection() error {
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
}
}
s.garbageCollector = newGarbageCollector(s.meta, GcOption{