mirror of
https://github.com/minio/minio.git
synced 2025-03-31 01:33:41 -04: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.
|
// Loads bucket replication resync statuses into memory.
|
||||||
func (p *ReplicationPool) loadResync(ctx context.Context, buckets []BucketInfo, objAPI ObjectLayer) error {
|
func (p *ReplicationPool) loadResync(ctx context.Context, buckets []BucketInfo, objAPI ObjectLayer) error {
|
||||||
// Make sure only one node running resync on the cluster.
|
// Make sure only one node running resync on the cluster.
|
||||||
locker := objAPI.NewNSLock(minioMetaBucket, "replication/resync.lock")
|
ctx, cancel := globalLeaderLock.GetLock(ctx)
|
||||||
lkctx, err := locker.GetLock(ctx, replicationResyncLockTimeout)
|
defer cancel()
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
ctx = lkctx.Context()
|
|
||||||
defer lkctx.Cancel()
|
|
||||||
// No unlock for "leader" lock.
|
|
||||||
for index := range buckets {
|
for index := range buckets {
|
||||||
meta, err := loadBucketResyncMetadata(ctx, buckets[index].Name, objAPI)
|
meta, err := loadBucketResyncMetadata(ctx, buckets[index].Name, objAPI)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user