mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -05:00
parent
e39de65367
commit
1f07545e2a
@ -314,6 +314,11 @@ func shouldInitXLDisks(errs []error) bool {
|
|||||||
return countErrs(errs, errUnformattedDisk) == len(errs)
|
return countErrs(errs, errUnformattedDisk) == len(errs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if unformatted disks are equal to write quorum.
|
||||||
|
func quorumUnformattedDisks(errs []error) bool {
|
||||||
|
return countErrs(errs, errUnformattedDisk) >= (len(errs)/2)+1
|
||||||
|
}
|
||||||
|
|
||||||
// loadFormatXLAll - load all format config from all input disks in parallel.
|
// loadFormatXLAll - load all format config from all input disks in parallel.
|
||||||
func loadFormatXLAll(storageDisks []StorageAPI) ([]*formatXLV3, []error) {
|
func loadFormatXLAll(storageDisks []StorageAPI) ([]*formatXLV3, []error) {
|
||||||
// Initialize sync waitgroup.
|
// Initialize sync waitgroup.
|
||||||
|
@ -145,11 +145,21 @@ func connectLoadInitFormats(firstDisk bool, endpoints EndpointList, setCount, dr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if shouldInitXLDisks(sErrs) {
|
// All disks report unformatted we should initialized everyone.
|
||||||
if !firstDisk {
|
if shouldInitXLDisks(sErrs) && firstDisk {
|
||||||
|
return initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return error when quorum unformatted disks - indicating we are
|
||||||
|
// waiting for first server to be online.
|
||||||
|
if quorumUnformattedDisks(sErrs) && !firstDisk {
|
||||||
return nil, errNotFirstDisk
|
return nil, errNotFirstDisk
|
||||||
}
|
}
|
||||||
return initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet)
|
|
||||||
|
// Return error when quorum unformatted disks but waiting for rest
|
||||||
|
// of the servers to be online.
|
||||||
|
if quorumUnformattedDisks(sErrs) && firstDisk {
|
||||||
|
return nil, errFirstDiskWait
|
||||||
}
|
}
|
||||||
|
|
||||||
// Following function is added to fix a regressions which was introduced
|
// Following function is added to fix a regressions which was introduced
|
||||||
@ -219,6 +229,10 @@ func waitForFormatXL(ctx context.Context, firstDisk bool, endpoints EndpointList
|
|||||||
// Fresh setup, wait for first server to be up.
|
// Fresh setup, wait for first server to be up.
|
||||||
logger.Info("Waiting for the first server to format the disks.")
|
logger.Info("Waiting for the first server to format the disks.")
|
||||||
continue
|
continue
|
||||||
|
case errFirstDiskWait:
|
||||||
|
// Fresh setup, wait for other servers to come up.
|
||||||
|
logger.Info("Waiting for all other servers to be online to format the disks.")
|
||||||
|
continue
|
||||||
case errXLReadQuorum:
|
case errXLReadQuorum:
|
||||||
// no quorum available continue to wait for minimum number of servers.
|
// no quorum available continue to wait for minimum number of servers.
|
||||||
logger.Info("Waiting for a minimum of %d disks to come online (elapsed %s)\n", len(endpoints)/2, getElapsedTime())
|
logger.Info("Waiting for a minimum of %d disks to come online (elapsed %s)\n", len(endpoints)/2, getElapsedTime())
|
||||||
|
@ -62,3 +62,6 @@ var errInvalidRangeSource = errors.New("Range specified exceeds source object si
|
|||||||
// error returned by disks which are to be initialized are waiting for the
|
// error returned by disks which are to be initialized are waiting for the
|
||||||
// first server to initialize them in distributed set to initialize them.
|
// first server to initialize them in distributed set to initialize them.
|
||||||
var errNotFirstDisk = errors.New("Not first disk")
|
var errNotFirstDisk = errors.New("Not first disk")
|
||||||
|
|
||||||
|
// error returned by first disk waiting to initialize other servers.
|
||||||
|
var errFirstDiskWait = errors.New("Waiting on other disks")
|
||||||
|
Loading…
Reference in New Issue
Block a user