mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
repl: resync orchestrator to use global shared lock (#16154)
This commit is contained in:
parent
71133105d7
commit
641ab24aec
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user