mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
HealBucket: create the bucket if it is missing in one of the disks. (#2924)
This commit is contained in:
committed by
Harshavardhana
parent
3349153058
commit
0320a77dc0
@@ -305,3 +305,27 @@ func (xl xlObjects) DeleteBucket(bucket string) error {
|
||||
// Success.
|
||||
return nil
|
||||
}
|
||||
|
||||
// Heal bucket - create buckets on disks where it does not exist.
|
||||
func healBucket(disks []StorageAPI, bucket string) error {
|
||||
bucketFound := false
|
||||
for _, disk := range disks {
|
||||
_, err := disk.StatVol(bucket)
|
||||
if err == nil {
|
||||
bucketFound = true
|
||||
}
|
||||
}
|
||||
if !bucketFound {
|
||||
return traceError(errVolumeNotFound)
|
||||
}
|
||||
for _, disk := range disks {
|
||||
err := disk.MakeVol(bucket)
|
||||
if err == nil {
|
||||
continue
|
||||
}
|
||||
if err != errVolumeExists {
|
||||
return traceError(err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user