mirror of
https://github.com/minio/minio.git
synced 2025-04-22 11:26:36 -04:00
fix: retry listing in decommissioning if it fails perpetually (#17682)
This commit is contained in:
parent
c0a5bdaed9
commit
bddd53d6d2
@ -696,7 +696,9 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
|
|||||||
// Check if bucket is object locked.
|
// Check if bucket is object locked.
|
||||||
lr, _ := globalBucketObjectLockSys.Get(bi.Name)
|
lr, _ := globalBucketObjectLockSys.Get(bi.Name)
|
||||||
|
|
||||||
for _, set := range pool.sets {
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
|
for setIdx, set := range pool.sets {
|
||||||
set := set
|
set := set
|
||||||
|
|
||||||
filterLifecycle := func(bucket, object string, fi FileInfo) bool {
|
filterLifecycle := func(bucket, object string, fi FileInfo) bool {
|
||||||
@ -895,16 +897,26 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool
|
|||||||
}
|
}
|
||||||
|
|
||||||
wk.Take()
|
wk.Take()
|
||||||
go func() {
|
go func(setIdx int) {
|
||||||
defer wk.Give()
|
defer wk.Give()
|
||||||
|
// We will perpetually retry listing if it fails, since we cannot
|
||||||
|
// possibly give up in this matter
|
||||||
|
for {
|
||||||
err := set.listObjectsToDecommission(ctx, bi,
|
err := set.listObjectsToDecommission(ctx, bi,
|
||||||
func(entry metaCacheEntry) {
|
func(entry metaCacheEntry) {
|
||||||
wk.Take()
|
wk.Take()
|
||||||
go decommissionEntry(entry)
|
go decommissionEntry(entry)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
logger.LogIf(ctx, err)
|
if err == nil {
|
||||||
}()
|
break
|
||||||
|
}
|
||||||
|
setN := humanize.Ordinal(setIdx + 1)
|
||||||
|
retryDur := time.Duration(r.Float64() * float64(5*time.Second))
|
||||||
|
logger.LogOnceIf(ctx, fmt.Errorf("listing objects from %s set failed with %v, retrying in %v", setN, err, retryDur), "decom-listing-failed"+setN)
|
||||||
|
time.Sleep(retryDur)
|
||||||
|
}
|
||||||
|
}(setIdx)
|
||||||
}
|
}
|
||||||
wk.Wait()
|
wk.Wait()
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user