Browse Source
decom: Fix infinite retry when the decom is canceled (#18143)
Also, use rand.Float64() since it is thread-safe; otherwise go race
will complain.
pull/18142/head
RELEASE.2023-09-30T07-02-29Z
Anis Eleuch
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
4 deletions
-
cmd/erasure-server-pool-decom.go
|
|
@ -735,8 +735,6 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool |
|
|
|
// Check if bucket is object locked.
|
|
|
|
lr, _ := globalBucketObjectLockSys.Get(bi.Name) |
|
|
|
|
|
|
|
r := rand.New(rand.NewSource(time.Now().UnixNano())) |
|
|
|
|
|
|
|
for setIdx, set := range pool.sets { |
|
|
|
set := set |
|
|
|
|
|
|
@ -947,11 +945,11 @@ func (z *erasureServerPools) decommissionPool(ctx context.Context, idx int, pool |
|
|
|
go decommissionEntry(entry) |
|
|
|
}, |
|
|
|
) |
|
|
|
if err == nil { |
|
|
|
if err == nil || errors.Is(err, context.Canceled) { |
|
|
|
break |
|
|
|
} |
|
|
|
setN := humanize.Ordinal(setIdx + 1) |
|
|
|
retryDur := time.Duration(r.Float64() * float64(5*time.Second)) |
|
|
|
retryDur := time.Duration(rand.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) |
|
|
|
} |
|
|
|