mirror of
https://github.com/minio/minio.git
synced 2025-04-22 19:35:47 -04:00
feat: allow offline disks on a fresh start (#16541)
This commit is contained in:
parent
21885f9457
commit
5996c8c4d5
@ -304,11 +304,6 @@ func countErrs(errs []error, err error) int {
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does all errors indicate we need to initialize all disks?.
|
|
||||||
func shouldInitErasureDisks(errs []error) bool {
|
|
||||||
return countErrs(errs, errUnformattedDisk) == len(errs)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if unformatted disks are equal to write quorum.
|
// Check if unformatted disks are equal to write quorum.
|
||||||
func quorumUnformattedDisks(errs []error) bool {
|
func quorumUnformattedDisks(errs []error) bool {
|
||||||
return countErrs(errs, errUnformattedDisk) >= (len(errs)/2)+1
|
return countErrs(errs, errUnformattedDisk) >= (len(errs)/2)+1
|
||||||
@ -750,6 +745,9 @@ func initFormatErasure(ctx context.Context, storageDisks []StorageAPI, setCount,
|
|||||||
hostCount := make(map[string]int, setDriveCount)
|
hostCount := make(map[string]int, setDriveCount)
|
||||||
for j := 0; j < setDriveCount; j++ {
|
for j := 0; j < setDriveCount; j++ {
|
||||||
disk := storageDisks[i*setDriveCount+j]
|
disk := storageDisks[i*setDriveCount+j]
|
||||||
|
if disk == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
newFormat := format.Clone()
|
newFormat := format.Clone()
|
||||||
newFormat.Erasure.This = format.Erasure.Sets[i][j]
|
newFormat.Erasure.This = format.Erasure.Sets[i][j]
|
||||||
if distributionAlgo != "" {
|
if distributionAlgo != "" {
|
||||||
@ -761,7 +759,6 @@ func initFormatErasure(ctx context.Context, storageDisks []StorageAPI, setCount,
|
|||||||
hostCount[disk.Hostname()]++
|
hostCount[disk.Hostname()]++
|
||||||
formats[i*setDriveCount+j] = newFormat
|
formats[i*setDriveCount+j] = newFormat
|
||||||
}
|
}
|
||||||
if len(hostCount) > 0 {
|
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
for host, count := range hostCount {
|
for host, count := range hostCount {
|
||||||
if count > wantAtMost {
|
if count > wantAtMost {
|
||||||
@ -783,7 +780,6 @@ func initFormatErasure(ctx context.Context, storageDisks []StorageAPI, setCount,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Mark all root disks down
|
// Mark all root disks down
|
||||||
markRootDisksAsDown(storageDisks, sErrs)
|
markRootDisksAsDown(storageDisks, sErrs)
|
||||||
|
@ -198,8 +198,15 @@ func connectLoadInitFormats(verboseLogging bool, firstDisk bool, endpoints Endpo
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return error when quorum unformatted disks - indicating we are
|
||||||
|
// waiting for first server to be online.
|
||||||
|
unformattedDisks := quorumUnformattedDisks(sErrs)
|
||||||
|
if unformattedDisks && !firstDisk {
|
||||||
|
return nil, nil, errNotFirstDisk
|
||||||
|
}
|
||||||
|
|
||||||
// All disks report unformatted we should initialized everyone.
|
// All disks report unformatted we should initialized everyone.
|
||||||
if shouldInitErasureDisks(sErrs) && firstDisk {
|
if unformattedDisks && firstDisk {
|
||||||
logger.Info("Formatting %s pool, %v set(s), %v drives per set.",
|
logger.Info("Formatting %s pool, %v set(s), %v drives per set.",
|
||||||
humanize.Ordinal(poolCount), setCount, setDriveCount)
|
humanize.Ordinal(poolCount), setCount, setDriveCount)
|
||||||
|
|
||||||
@ -215,19 +222,6 @@ func connectLoadInitFormats(verboseLogging bool, firstDisk bool, endpoints Endpo
|
|||||||
return storageDisks, format, nil
|
return storageDisks, format, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return error when quorum unformatted disks - indicating we are
|
|
||||||
// waiting for first server to be online.
|
|
||||||
unformattedDisks := quorumUnformattedDisks(sErrs)
|
|
||||||
if unformattedDisks && !firstDisk {
|
|
||||||
return nil, nil, errNotFirstDisk
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return error when quorum unformatted disks but waiting for rest
|
|
||||||
// of the servers to be online.
|
|
||||||
if unformattedDisks && firstDisk {
|
|
||||||
return nil, nil, errFirstDiskWait
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark all root disks down
|
// Mark all root disks down
|
||||||
markRootDisksAsDown(storageDisks, sErrs)
|
markRootDisksAsDown(storageDisks, sErrs)
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ import "errors"
|
|||||||
|
|
||||||
// DiscoveryDoc - parses the output from openid-configuration
|
// DiscoveryDoc - parses the output from openid-configuration
|
||||||
// for example https://accounts.google.com/.well-known/openid-configuration
|
// for example https://accounts.google.com/.well-known/openid-configuration
|
||||||
|
//
|
||||||
|
//nolint:unused
|
||||||
type DiscoveryDoc struct {
|
type DiscoveryDoc struct {
|
||||||
Issuer string `json:"issuer,omitempty"`
|
Issuer string `json:"issuer,omitempty"`
|
||||||
AuthEndpoint string `json:"authorization_endpoint,omitempty"`
|
AuthEndpoint string `json:"authorization_endpoint,omitempty"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user