Only heal on disks where we are sure that healing is needed (#7148)

This commit is contained in:
Krishna Srinivas
2019-01-30 10:53:57 -08:00
committed by kannappanr
parent 2d9860e875
commit b18c0478e7
2 changed files with 42 additions and 10 deletions

View File

@@ -29,6 +29,9 @@ import (
"encoding/gob"
"encoding/hex"
"fmt"
"strings"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/cmd/rest"
xnet "github.com/minio/minio/pkg/net"
@@ -101,6 +104,15 @@ func toStorageErr(err error) error {
case errServerTimeMismatch.Error():
return errServerTimeMismatch
}
if strings.Contains(err.Error(), "Bitrot verification mismatch") {
var expected string
var received string
fmt.Sscanf(err.Error(), "Bitrot verification mismatch - expected %s received %s", &expected, &received)
// Go's Sscanf %s scans "," that comes after the expected hash, hence remove it. Providing "," in the format string does not help.
expected = strings.TrimSuffix(expected, ",")
bitrotErr := hashMismatchError{expected, received}
return bitrotErr
}
return err
}