mirror of
https://github.com/pgsty/minio.git
synced 2026-03-15 17:17:01 +01:00
Return bit-rot verified data instead of re-reading from disk (#5568)
- Data from disk was being read after bitrot verification to return data for GetObject. Strictly speaking this does not guarantee bitrot protection, as disks may return bad data even temporarily. - This fix reads data from disk, verifies data for bitrot and then returns data to the client directly.
This commit is contained in:
committed by
Harshavardhana
parent
52eea7b9c1
commit
ea8973b7d7
@@ -409,3 +409,28 @@ func TestJSONSave(t *testing.T) {
|
||||
t.Fatal("Size should not differ after jsonSave()", fi1.Size(), fi2.Size(), f.Name())
|
||||
}
|
||||
}
|
||||
|
||||
// Test ceilFrac
|
||||
func TestCeilFrac(t *testing.T) {
|
||||
cases := []struct {
|
||||
numerator, denominator, ceiling int64
|
||||
}{
|
||||
{0, 1, 0},
|
||||
{-1, 2, 0},
|
||||
{1, 2, 1},
|
||||
{1, 1, 1},
|
||||
{3, 2, 2},
|
||||
{54, 11, 5},
|
||||
{45, 11, 5},
|
||||
{-4, 3, -1},
|
||||
{4, -3, -1},
|
||||
{-4, -3, 2},
|
||||
{3, 0, 0},
|
||||
}
|
||||
for i, testCase := range cases {
|
||||
ceiling := ceilFrac(testCase.numerator, testCase.denominator)
|
||||
if ceiling != testCase.ceiling {
|
||||
t.Errorf("Case %d: Unexpected result: %d", i, ceiling)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user