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 5996c8c4d5.

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:
Harshavardhana
2024-02-14 10:37:34 -08:00
committed by GitHub
parent 134db72bb7
commit f961ec4aaf
4 changed files with 54 additions and 42 deletions

View File

@@ -306,7 +306,12 @@ func countErrs(errs []error, err error) int {
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 {
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)
for j := 0; j < setDriveCount; j++ {
disk := storageDisks[i*setDriveCount+j]
if disk == nil {
continue
}
newFormat := format.Clone()
newFormat.Erasure.This = format.Erasure.Sets[i][j]
if deploymentID != "" {
@@ -800,14 +802,8 @@ func initFormatErasure(ctx context.Context, storageDisks []StorageAPI, setCount,
logger.Info(" - Drive: %s", disk.String())
}
})
var warning string
if wantAtMost == 0 {
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.")
logger.Info(color.Yellow("WARNING:")+" Host %v has more than %v drives of set. "+
"A host failure will result in data becoming unavailable.", host, wantAtMost)
}
}
}