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.
This commit is contained in:
Harshavardhana 2016-06-29 02:05:29 -07:00 committed by Anand Babu (AB) Periasamy
parent b6b9e88e47
commit 3ac39ff107
3 changed files with 9 additions and 8 deletions

View File

@ -34,7 +34,7 @@ func mustEncodeData(data []byte, dataBlocks, parityBlocks int) [][]byte {
// Generates good encoded data with one parity block and data block missing. // Generates good encoded data with one parity block and data block missing.
func getGoodEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte { func getGoodEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte {
encodedData := mustEncodeData(data, dataBlocks, parityBlocks) encodedData := mustEncodeData(data, dataBlocks, parityBlocks)
encodedData[7] = nil encodedData[3] = nil
encodedData[1] = nil encodedData[1] = nil
return encodedData 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. // Generates bad encoded data with one parity block and data block with garbage data.
func getBadEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte { func getBadEncodedData(data []byte, dataBlocks, parityBlocks int) [][]byte {
encodedData := mustEncodeData(data, dataBlocks, parityBlocks) encodedData := mustEncodeData(data, dataBlocks, parityBlocks)
encodedData[7] = []byte("garbage") encodedData[3] = []byte("garbage")
encodedData[1] = []byte("garbage") encodedData[1] = []byte("garbage")
return encodedData return encodedData
} }
@ -71,6 +71,7 @@ type encodingMatrix struct {
// List of encoding matrices the tests will run on. // List of encoding matrices the tests will run on.
var encodingMatrices = []encodingMatrix{ var encodingMatrices = []encodingMatrix{
{3, 3}, // 3 data, 3 parity blocks.
{4, 4}, // 4 data, 4 parity blocks. {4, 4}, // 4 data, 4 parity blocks.
{5, 5}, // 5 data, 5 parity blocks. {5, 5}, // 5 data, 5 parity blocks.
{6, 6}, // 6 data, 6 parity blocks. {6, 6}, // 6 data, 6 parity blocks.

View File

@ -74,7 +74,7 @@ const (
// Maximum erasure blocks. // Maximum erasure blocks.
maxErasureBlocks = 16 maxErasureBlocks = 16
// Minimum erasure blocks. // Minimum erasure blocks.
minErasureBlocks = 8 minErasureBlocks = 6
) )
// Validate if input disks are sufficient for initializing XL. // 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. // 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) { if !isEven(totalDisks) {
return errXLNumDisks return errXLNumDisks
} }

View File

@ -45,9 +45,9 @@ func TestCheckSufficientDisks(t *testing.T) {
disks []string disks []string
expectedErr error expectedErr error
}{ }{
// Even number of disks '8'. // Even number of disks '6'.
{ {
disks[0:8], disks[0:6],
nil, nil,
}, },
// Even number of disks '12'. // Even number of disks '12'.
@ -66,9 +66,9 @@ func TestCheckSufficientDisks(t *testing.T) {
append(disks[0:16], "/mnt/unsupported"), append(disks[0:16], "/mnt/unsupported"),
errXLMaxDisks, errXLMaxDisks,
}, },
// Lesser than minimum number of disks < 8. // Lesser than minimum number of disks < 6.
{ {
disks[0:7], disks[0:5],
errXLMinDisks, errXLMinDisks,
}, },
// Odd number of disks, not divisible by '2'. // Odd number of disks, not divisible by '2'.