XL: Refactor usage of reduceErrs and consistent behavior. (#2240)

This refactor is also needed in lieu of our quorum
requirement change for the newly understood logic behind
klauspost/reedsolom implementation.
This commit is contained in:
Harshavardhana
2016-07-19 19:24:32 -07:00
committed by Anand Babu (AB) Periasamy
parent f67c930731
commit cef26fd6ea
10 changed files with 95 additions and 164 deletions
+5 -2
View File
@@ -30,9 +30,12 @@ import (
// value is greater than or equal to simple majority, since none of the equally
// maximal values would occur quorum or more number of times.
func reduceErrs(errs []error) (int, error) {
func reduceErrs(errs []error, ignoredErrs []error) error {
errorCounts := make(map[error]int)
for _, err := range errs {
if isErrIgnored(err, ignoredErrs) {
continue
}
errorCounts[err]++
}
max := 0
@@ -43,7 +46,7 @@ func reduceErrs(errs []error) (int, error) {
errMax = err
}
}
return max, errMax
return errMax
}
// Validates if we have quorum based on the errors related to disk only.