mirror of
https://github.com/minio/minio.git
synced 2025-11-20 09:56:07 -05:00
xl: Fix rare freeze after many disk/network errors (#4438)
xl.storageDisks is sometimes passed to some low-level XL functions. Some disks in xl.storageDisks are set to nil when they encounter some errors. This means all elements in xl.storageDisks will be nil after some time which lead to an unusable XL.
This commit is contained in:
committed by
Harshavardhana
parent
dce76d9307
commit
af8071c86a
@@ -357,6 +357,24 @@ func shuffleDisks(disks []StorageAPI, distribution []int) (shuffledDisks []Stora
|
||||
return shuffledDisks
|
||||
}
|
||||
|
||||
// evalDisks - returns a new slice of disks where nil is set if
|
||||
// the correspond error in errs slice is not nil
|
||||
func evalDisks(disks []StorageAPI, errs []error) []StorageAPI {
|
||||
if len(errs) != len(disks) {
|
||||
errorIf(errors.New("unexpected disks/errors slice length"), "unable to evaluate internal disks")
|
||||
return nil
|
||||
}
|
||||
newDisks := make([]StorageAPI, len(disks))
|
||||
for index := range errs {
|
||||
if errs[index] == nil {
|
||||
newDisks[index] = disks[index]
|
||||
} else {
|
||||
newDisks[index] = nil
|
||||
}
|
||||
}
|
||||
return newDisks
|
||||
}
|
||||
|
||||
// Errors specifically generated by getPartSizeFromIdx function.
|
||||
var (
|
||||
errPartSizeZero = errors.New("Part size cannot be zero")
|
||||
|
||||
Reference in New Issue
Block a user