mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
Heal bucket only on missing drives in quorum (#8883)
MakeVol shouldn't be called in heal bucket when bucket doesn't really exist in quorum.
This commit is contained in:
parent
1ffbb5c24c
commit
cf37c7997e
@ -92,11 +92,7 @@ func healBucket(ctx context.Context, storageDisks []StorageAPI, bucket string, w
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
makeErr := storageDisks[index].MakeVol(bucket)
|
return serr
|
||||||
if makeErr == nil {
|
|
||||||
afterState[index] = madmin.DriveStateOk
|
|
||||||
}
|
|
||||||
return makeErr
|
|
||||||
}
|
}
|
||||||
beforeState[index] = madmin.DriveStateOk
|
beforeState[index] = madmin.DriveStateOk
|
||||||
afterState[index] = madmin.DriveStateOk
|
afterState[index] = madmin.DriveStateOk
|
||||||
@ -106,12 +102,18 @@ func healBucket(ctx context.Context, storageDisks []StorageAPI, bucket string, w
|
|||||||
|
|
||||||
errs := g.Wait()
|
errs := g.Wait()
|
||||||
|
|
||||||
|
reducedErr := reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, writeQuorum-1)
|
||||||
|
if reducedErr == errVolumeNotFound {
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize heal result info
|
// Initialize heal result info
|
||||||
res = madmin.HealResultItem{
|
res = madmin.HealResultItem{
|
||||||
Type: madmin.HealItemBucket,
|
Type: madmin.HealItemBucket,
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
DiskCount: len(storageDisks),
|
DiskCount: len(storageDisks),
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range beforeState {
|
for i := range beforeState {
|
||||||
if storageDisks[i] != nil {
|
if storageDisks[i] != nil {
|
||||||
drive := storageDisks[i].String()
|
drive := storageDisks[i].String()
|
||||||
@ -128,11 +130,32 @@ func healBucket(ctx context.Context, storageDisks []StorageAPI, bucket string, w
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reducedErr := reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, writeQuorum)
|
// Initialize sync waitgroup.
|
||||||
|
g = errgroup.WithNErrs(len(storageDisks))
|
||||||
|
|
||||||
|
// Make a volume entry on all underlying storage disks.
|
||||||
|
for index := range storageDisks {
|
||||||
|
index := index
|
||||||
|
g.Go(func() error {
|
||||||
|
if beforeState[index] == madmin.DriveStateMissing {
|
||||||
|
makeErr := storageDisks[index].MakeVol(bucket)
|
||||||
|
if makeErr == nil {
|
||||||
|
afterState[index] = madmin.DriveStateOk
|
||||||
|
}
|
||||||
|
return makeErr
|
||||||
|
}
|
||||||
|
return errs[index]
|
||||||
|
}, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
errs = g.Wait()
|
||||||
|
|
||||||
|
reducedErr = reduceWriteQuorumErrs(ctx, errs, bucketOpIgnoredErrs, writeQuorum)
|
||||||
if reducedErr == errXLWriteQuorum {
|
if reducedErr == errXLWriteQuorum {
|
||||||
// Purge successfully created buckets if we don't have writeQuorum.
|
// Purge successfully created buckets if we don't have writeQuorum.
|
||||||
undoMakeBucket(storageDisks, bucket)
|
undoMakeBucket(storageDisks, bucket)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, reducedErr
|
return res, reducedErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user