Avoid data-transfer in distributed locking (#8004)

This commit is contained in:
Harshavardhana
2019-08-05 11:45:30 -07:00
committed by kannappanr
parent 843f481eb3
commit b52b90412b
4 changed files with 67 additions and 154 deletions

View File

@@ -891,9 +891,25 @@ func (sys *IAMSys) Init(objAPI ObjectLayer) error {
return errInvalidArgument
}
// Migrate IAM configuration
if err := doIAMConfigMigration(objAPI); err != nil {
return err
doneCh := make(chan struct{})
defer close(doneCh)
// Migrating IAM needs a retry mechanism for
// the following reasons:
// - Read quorum is lost just after the initialization
// of the object layer.
for range newRetryTimerSimple(doneCh) {
// Migrate IAM configuration
if err := doIAMConfigMigration(objAPI); err != nil {
if err == errDiskNotFound ||
strings.Contains(err.Error(), InsufficientReadQuorum{}.Error()) ||
strings.Contains(err.Error(), InsufficientWriteQuorum{}.Error()) {
logger.Info("Waiting for IAM subsystem to be initialized..")
continue
}
return err
}
break
}
if globalEtcdClient != nil {
@@ -902,9 +918,6 @@ func (sys *IAMSys) Init(objAPI ObjectLayer) error {
defer sys.watchIAMDisk(objAPI)
}
doneCh := make(chan struct{})
defer close(doneCh)
// Initializing IAM needs a retry mechanism for
// the following reasons:
// - Read quorum is lost just after the initialization