mirror of
https://github.com/minio/minio.git
synced 2025-02-03 09:55:59 -05:00
Avoid dangling deletes if disk not found (#16401)
This commit is contained in:
parent
c242e6c391
commit
b22b39de96
@ -937,19 +937,22 @@ func isObjectDangling(metaArr []FileInfo, errs []error, dataErrs []error) (valid
|
|||||||
// We can consider an object data not reliable
|
// We can consider an object data not reliable
|
||||||
// when xl.meta is not found in read quorum disks.
|
// when xl.meta is not found in read quorum disks.
|
||||||
// or when xl.meta is not readable in read quorum disks.
|
// or when xl.meta is not readable in read quorum disks.
|
||||||
danglingErrsCount := func(cerrs []error) (int, int) {
|
danglingErrsCount := func(cerrs []error) (int, int, int) {
|
||||||
var (
|
var (
|
||||||
notFoundCount int
|
notFoundCount int
|
||||||
corruptedCount int
|
corruptedCount int
|
||||||
|
diskNotFoundCount int
|
||||||
)
|
)
|
||||||
for _, readErr := range cerrs {
|
for _, readErr := range cerrs {
|
||||||
if errors.Is(readErr, errFileNotFound) || errors.Is(readErr, errFileVersionNotFound) {
|
if errors.Is(readErr, errFileNotFound) || errors.Is(readErr, errFileVersionNotFound) {
|
||||||
notFoundCount++
|
notFoundCount++
|
||||||
} else if errors.Is(readErr, errFileCorrupt) {
|
} else if errors.Is(readErr, errFileCorrupt) {
|
||||||
corruptedCount++
|
corruptedCount++
|
||||||
|
} else if errors.Is(readErr, errDiskNotFound) {
|
||||||
|
diskNotFoundCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return notFoundCount, corruptedCount
|
return notFoundCount, corruptedCount, diskNotFoundCount
|
||||||
}
|
}
|
||||||
|
|
||||||
ndataErrs := make([]error, len(dataErrs))
|
ndataErrs := make([]error, len(dataErrs))
|
||||||
@ -963,9 +966,12 @@ func isObjectDangling(metaArr []FileInfo, errs []error, dataErrs []error) (valid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notFoundMetaErrs, corruptedMetaErrs := danglingErrsCount(errs)
|
notFoundMetaErrs, corruptedMetaErrs, driveNotFoundMetaErrs := danglingErrsCount(errs)
|
||||||
notFoundPartsErrs, corruptedPartsErrs := danglingErrsCount(ndataErrs)
|
notFoundPartsErrs, corruptedPartsErrs, driveNotFoundPartsErrs := danglingErrsCount(ndataErrs)
|
||||||
|
|
||||||
|
if driveNotFoundMetaErrs > 0 || driveNotFoundPartsErrs > 0 {
|
||||||
|
return validMeta, false
|
||||||
|
}
|
||||||
for _, m := range metaArr {
|
for _, m := range metaArr {
|
||||||
if m.IsValid() {
|
if m.IsValid() {
|
||||||
validMeta = m
|
validMeta = m
|
||||||
|
Loading…
x
Reference in New Issue
Block a user