HealObject should succeed when only N/2 disks have data (#3952)

This commit is contained in:
Krishnan Parthasarathi
2017-03-22 22:45:16 +05:30
committed by Harshavardhana
parent fbfb4fc5a0
commit 417ec0df56
4 changed files with 38 additions and 7 deletions

View File

@@ -41,11 +41,18 @@ func reduceErrs(errs []error, ignoredErrs []error) (maxCount int, maxErr error)
}
errorCounts[err]++
}
max := 0
for err, count := range errorCounts {
if max < count {
switch {
case max < count:
max = count
maxErr = err
// Prefer `nil` over other error values with the same
// number of occurrences.
case max == count && err == nil:
maxErr = err
}
}
return max, maxErr