mirror of
https://github.com/minio/minio.git
synced 2025-04-17 17:30:07 -04:00
fix: revert allow offline disks on fresh start (#19052)
the PR in #16541 was incorrect and hand wrong assumptions about the overall setup, revert this since this expectation to have offline servers is wrong and we can end up with a bigger chicken and egg problem. This reverts commit 5996c8c4d5551941fc2d844f7f996d488ff501b1. Bonus: - preserve disk in globalLocalDrives properly upon connectDisks() - do not return 'nil' from newXLStorage(), getting it ready for the next set of changes for 'format.json' loading.
This commit is contained in:
parent
134db72bb7
commit
f961ec4aaf
@ -264,13 +264,22 @@ func (s *erasureSets) connectDisks() {
|
|||||||
disk.SetDiskLoc(s.poolIndex, setIndex, diskIndex)
|
disk.SetDiskLoc(s.poolIndex, setIndex, diskIndex)
|
||||||
disk.SetFormatData(formatData)
|
disk.SetFormatData(formatData)
|
||||||
s.erasureDisks[setIndex][diskIndex] = disk
|
s.erasureDisks[setIndex][diskIndex] = disk
|
||||||
s.erasureDisksMu.Unlock()
|
|
||||||
|
|
||||||
if disk.IsLocal() && globalIsDistErasure {
|
if disk.IsLocal() {
|
||||||
globalLocalDrivesMu.Lock()
|
globalLocalDrivesMu.Lock()
|
||||||
globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk
|
if globalIsDistErasure {
|
||||||
|
globalLocalSetDrives[s.poolIndex][setIndex][diskIndex] = disk
|
||||||
|
}
|
||||||
|
for i, ldisk := range globalLocalDrives {
|
||||||
|
_, k, l := ldisk.GetDiskLoc()
|
||||||
|
if k == setIndex && l == diskIndex {
|
||||||
|
globalLocalDrives[i] = disk
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
globalLocalDrivesMu.Unlock()
|
globalLocalDrivesMu.Unlock()
|
||||||
}
|
}
|
||||||
|
s.erasureDisksMu.Unlock()
|
||||||
}(endpoint)
|
}(endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,12 @@ func countErrs(errs []error, err error) int {
|
|||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if unformatted disks are equal to write quorum.
|
// 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 50%+1 of all the drives.
|
||||||
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
|
||||||
}
|
}
|
||||||
@ -773,9 +778,6 @@ 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 deploymentID != "" {
|
if deploymentID != "" {
|
||||||
@ -800,14 +802,8 @@ func initFormatErasure(ctx context.Context, storageDisks []StorageAPI, setCount,
|
|||||||
logger.Info(" - Drive: %s", disk.String())
|
logger.Info(" - Drive: %s", disk.String())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
var warning string
|
logger.Info(color.Yellow("WARNING:")+" Host %v has more than %v drives of set. "+
|
||||||
if wantAtMost == 0 {
|
"A host failure will result in data becoming unavailable.", host, wantAtMost)
|
||||||
warning = fmt.Sprintf("Host %v has all drives of set. ", host)
|
|
||||||
} else {
|
|
||||||
warning = fmt.Sprintf("Host %v has more than %v drives of set. ", host, wantAtMost)
|
|
||||||
}
|
|
||||||
logger.Info(color.Yellow("WARNING: ") + warning +
|
|
||||||
"A host failure will result in data becoming unavailable.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,15 +208,8 @@ 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 unformattedDisks && firstDisk {
|
if shouldInitErasureDisks(sErrs) && 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)
|
||||||
|
|
||||||
@ -232,6 +225,19 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
format, err = getFormatErasureInQuorum(formatConfigs)
|
format, err = getFormatErasureInQuorum(formatConfigs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogIf(GlobalContext, err)
|
logger.LogIf(GlobalContext, err)
|
||||||
|
@ -229,14 +229,24 @@ func makeFormatErasureMetaVolumes(disk StorageAPI) error {
|
|||||||
|
|
||||||
// Initialize a new storage disk.
|
// Initialize a new storage disk.
|
||||||
func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
||||||
path := ep.Path
|
s = &xlStorage{
|
||||||
if path, err = getValidPath(path); err != nil {
|
drivePath: ep.Path,
|
||||||
return nil, err
|
endpoint: ep,
|
||||||
|
globalSync: globalFSOSync,
|
||||||
|
poolIndex: -1,
|
||||||
|
setIndex: -1,
|
||||||
|
diskIndex: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
info, err := disk.GetInfo(path, true)
|
s.drivePath, err = getValidPath(ep.Path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
s.drivePath = ep.Path
|
||||||
|
return s, err
|
||||||
|
}
|
||||||
|
|
||||||
|
info, err := disk.GetInfo(s.drivePath, true)
|
||||||
|
if err != nil {
|
||||||
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !globalIsCICD && !globalIsErasureSD {
|
if !globalIsCICD && !globalIsErasureSD {
|
||||||
@ -247,7 +257,7 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||||||
// size less than or equal to the threshold as rootDrives.
|
// size less than or equal to the threshold as rootDrives.
|
||||||
rootDrive = info.Total <= globalRootDiskThreshold
|
rootDrive = info.Total <= globalRootDiskThreshold
|
||||||
} else {
|
} else {
|
||||||
rootDrive, err = disk.IsRootDisk(path, SlashSeparator)
|
rootDrive, err = disk.IsRootDisk(s.drivePath, SlashSeparator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -257,15 +267,6 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s = &xlStorage{
|
|
||||||
drivePath: path,
|
|
||||||
endpoint: ep,
|
|
||||||
globalSync: globalFSOSync,
|
|
||||||
poolIndex: -1,
|
|
||||||
setIndex: -1,
|
|
||||||
diskIndex: -1,
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanitize before setting it
|
// Sanitize before setting it
|
||||||
if info.NRRequests > 0 {
|
if info.NRRequests > 0 {
|
||||||
s.nrRequests = info.NRRequests
|
s.nrRequests = info.NRRequests
|
||||||
@ -285,11 +286,11 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||||||
formatData, formatFi, err := formatErasureMigrate(s.drivePath)
|
formatData, formatFi, err := formatErasureMigrate(s.drivePath)
|
||||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||||
if os.IsPermission(err) {
|
if os.IsPermission(err) {
|
||||||
return nil, errDiskAccessDenied
|
return s, errDiskAccessDenied
|
||||||
} else if isSysErrIO(err) {
|
} else if isSysErrIO(err) {
|
||||||
return nil, errFaultyDisk
|
return s, errFaultyDisk
|
||||||
}
|
}
|
||||||
return nil, err
|
return s, err
|
||||||
}
|
}
|
||||||
s.formatData = formatData
|
s.formatData = formatData
|
||||||
s.formatFileInfo = formatFi
|
s.formatFileInfo = formatFi
|
||||||
@ -297,7 +298,7 @@ func newXLStorage(ep Endpoint, cleanUp bool) (s *xlStorage, err error) {
|
|||||||
|
|
||||||
// Create all necessary bucket folders if possible.
|
// Create all necessary bucket folders if possible.
|
||||||
if err = makeFormatErasureMetaVolumes(s); err != nil {
|
if err = makeFormatErasureMetaVolumes(s); err != nil {
|
||||||
return nil, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(s.formatData) > 0 {
|
if len(s.formatData) > 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user