From 641ab24aec9fbea637522765aae8c765dfec52ef Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 1 Dec 2022 21:10:09 +0100 Subject: [PATCH] repl: resync orchestrator to use global shared lock (#16154) --- cmd/bucket-replication.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go index 42bd6c79d..9177246f1 100644 --- a/cmd/bucket-replication.go +++ b/cmd/bucket-replication.go @@ -2519,23 +2519,12 @@ func (p *ReplicationPool) startResyncRoutine(ctx context.Context, buckets []Buck } } -var replicationResyncLockTimeout = newDynamicTimeoutWithOpts(dynamicTimeoutOpts{ - timeout: 30 * time.Second, - minimum: 10 * time.Second, - retryInterval: time.Second, -}) - // Loads bucket replication resync statuses into memory. func (p *ReplicationPool) loadResync(ctx context.Context, buckets []BucketInfo, objAPI ObjectLayer) error { // Make sure only one node running resync on the cluster. - locker := objAPI.NewNSLock(minioMetaBucket, "replication/resync.lock") - lkctx, err := locker.GetLock(ctx, replicationResyncLockTimeout) - if err != nil { - return err - } - ctx = lkctx.Context() - defer lkctx.Cancel() - // No unlock for "leader" lock. + ctx, cancel := globalLeaderLock.GetLock(ctx) + defer cancel() + for index := range buckets { meta, err := loadBucketResyncMetadata(ctx, buckets[index].Name, objAPI) if err != nil {