From 3ac39ff10742da73a19e35a1e434254f5809e35b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 29 Jun 2016 02:05:29 -0700 Subject: [PATCH] XL: Change minimum disks supported to 6 now. (#2023) This change co-incides with another patch set which reduces the writeQuorum requirement. With the write quorum change it is now possible to support 6 disk configuration. --- erasure_test.go | 5 +++-- xl-v1.go | 4 ++-- xl-v1_test.go | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/erasure_test.go b/erasure_test.go index 7ea7bae8a..14a782c4a 100644 --- a/erasure_test.go +++ b/erasure_test.go @@ -34,7 +34,7 @@ func mustEncodeData(data []byte, dataBlocks, parityBlocks int) [][]byte { // Generates good encoded data with one parity block and data block missing. func getGoodEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte { encodedData := mustEncodeData(data, dataBlocks, parityBlocks) - encodedData[7] = nil + encodedData[3] = nil encodedData[1] = nil return encodedData } @@ -42,7 +42,7 @@ func getGoodEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte { // Generates bad encoded data with one parity block and data block with garbage data. func getBadEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte { encodedData := mustEncodeData(data, dataBlocks, parityBlocks) - encodedData[7] = []byte("garbage") + encodedData[3] = []byte("garbage") encodedData[1] = []byte("garbage") return encodedData } @@ -71,6 +71,7 @@ type encodingMatrix struct { // List of encoding matrices the tests will run on. var encodingMatrices = []encodingMatrix{ + {3, 3}, // 3 data, 3 parity blocks. {4, 4}, // 4 data, 4 parity blocks. {5, 5}, // 5 data, 5 parity blocks. {6, 6}, // 6 data, 6 parity blocks. diff --git a/xl-v1.go b/xl-v1.go index f5128736a..50711eaac 100644 --- a/xl-v1.go +++ b/xl-v1.go @@ -74,7 +74,7 @@ const ( // Maximum erasure blocks. maxErasureBlocks = 16 // Minimum erasure blocks. - minErasureBlocks = 8 + minErasureBlocks = 6 ) // Validate if input disks are sufficient for initializing XL. @@ -94,7 +94,7 @@ func checkSufficientDisks(disks []string) error { } // Verify if we have even number of disks. - // only combination of 8, 12, 16 are supported. + // only combination of 6, 8, 10, 12, 14, 16 are supported. if !isEven(totalDisks) { return errXLNumDisks } diff --git a/xl-v1_test.go b/xl-v1_test.go index e731f3459..c7af8e2d0 100644 --- a/xl-v1_test.go +++ b/xl-v1_test.go @@ -45,9 +45,9 @@ func TestCheckSufficientDisks(t *testing.T) { disks []string expectedErr error }{ - // Even number of disks '8'. + // Even number of disks '6'. { - disks[0:8], + disks[0:6], nil, }, // Even number of disks '12'. @@ -66,9 +66,9 @@ func TestCheckSufficientDisks(t *testing.T) { append(disks[0:16], "/mnt/unsupported"), errXLMaxDisks, }, - // Lesser than minimum number of disks < 8. + // Lesser than minimum number of disks < 6. { - disks[0:7], + disks[0:5], errXLMinDisks, }, // Odd number of disks, not divisible by '2'.