mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 16:23:28 +03:00
xl: Fix healing empty directories (#8013)
After some extensive refactors, it turned out empty directories are not healed and heal status is also not reported correctly. This commit fixes it and adds the appropriate unit tests
This commit is contained in:
committed by
Harshavardhana
parent
4101d4917c
commit
c5ac901e8d
@@ -501,10 +501,14 @@ func (xl xlObjects) healObjectDir(ctx context.Context, bucket, object string, dr
|
||||
drive = storageDisks[i].String()
|
||||
}
|
||||
switch err {
|
||||
case nil:
|
||||
hr.Before.Drives[i] = madmin.HealDriveInfo{State: madmin.DriveStateOk}
|
||||
hr.After.Drives[i] = madmin.HealDriveInfo{State: madmin.DriveStateOk}
|
||||
case errDiskNotFound:
|
||||
hr.Before.Drives[i] = madmin.HealDriveInfo{State: madmin.DriveStateOffline}
|
||||
hr.After.Drives[i] = madmin.HealDriveInfo{State: madmin.DriveStateOffline}
|
||||
case errVolumeNotFound:
|
||||
case errVolumeNotFound, errFileNotFound:
|
||||
// Bucket or prefix/directory not found
|
||||
hr.Before.Drives[i] = madmin.HealDriveInfo{Endpoint: drive, State: madmin.DriveStateMissing}
|
||||
hr.After.Drives[i] = madmin.HealDriveInfo{Endpoint: drive, State: madmin.DriveStateMissing}
|
||||
default:
|
||||
@@ -517,7 +521,8 @@ func (xl xlObjects) healObjectDir(ctx context.Context, bucket, object string, dr
|
||||
}
|
||||
for i, err := range errs {
|
||||
switch err {
|
||||
case errVolumeNotFound:
|
||||
case errVolumeNotFound, errFileNotFound:
|
||||
// Bucket or prefix/directory not found
|
||||
merr := storageDisks[i].MakeVol(pathJoin(bucket, object))
|
||||
switch merr {
|
||||
case nil, errVolumeExists:
|
||||
|
||||
Reference in New Issue
Block a user