mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
Fix healing whole file bitrot (#7123)
* Use 0-byte file for bitrot verification of whole-file-bitrot files Also pass the right checksum information for bitrot verification * Copy xlMeta info from latest meta except []checksums and []Parts while healing
This commit is contained in:
committed by
Harshavardhana
parent
74c2048ea9
commit
51ec61ee94
@@ -24,7 +24,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBitrotReaderWriter(t *testing.T) {
|
||||
func testBitrotReaderWriterAlgo(t *testing.T, bitrotAlgo BitrotAlgorithm) {
|
||||
tmpDir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -41,7 +41,7 @@ func TestBitrotReaderWriter(t *testing.T) {
|
||||
|
||||
disk.MakeVol(volume)
|
||||
|
||||
writer := newBitrotWriter(disk, volume, filePath, 35, HighwayHash256S, 10)
|
||||
writer := newBitrotWriter(disk, volume, filePath, 35, bitrotAlgo, 10)
|
||||
|
||||
_, err = writer.Write([]byte("aaaaaaaaaa"))
|
||||
if err != nil {
|
||||
@@ -61,7 +61,7 @@ func TestBitrotReaderWriter(t *testing.T) {
|
||||
}
|
||||
writer.(io.Closer).Close()
|
||||
|
||||
reader := newStreamingBitrotReader(disk, volume, filePath, 35, HighwayHash256S, 10)
|
||||
reader := newBitrotReader(disk, volume, filePath, 35, bitrotAlgo, bitrotWriterSum(writer), 10)
|
||||
b := make([]byte, 10)
|
||||
if _, err = reader.ReadAt(b, 0); err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -76,3 +76,9 @@ func TestBitrotReaderWriter(t *testing.T) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllBitrotAlgorithms(t *testing.T) {
|
||||
for bitrotAlgo := range bitrotAlgorithms {
|
||||
testBitrotReaderWriterAlgo(t, bitrotAlgo)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user