mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
log formatting only the first time (#8846)
This commit is contained in:
parent
fc5213258e
commit
23e46f9dba
@ -109,7 +109,7 @@ func initTestXLObjLayer() (ObjectLayer, []string, error) {
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
endpoints := mustGetNewEndpoints(xlDirs...)
|
endpoints := mustGetNewEndpoints(xlDirs...)
|
||||||
format, err := waitForFormatXL(true, endpoints, 1, 16, "")
|
format, err := waitForFormatXL(true, endpoints, 1, 1, 16, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
removeRoots(xlDirs)
|
removeRoots(xlDirs)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -220,7 +220,7 @@ func IsServerResolvable(endpoint Endpoint) error {
|
|||||||
// connect to list of endpoints and load all XL disk formats, validate the formats are correct
|
// connect to list of endpoints and load all XL disk formats, validate the formats are correct
|
||||||
// and are in quorum, if no formats are found attempt to initialize all of them for the first
|
// and are in quorum, if no formats are found attempt to initialize all of them for the first
|
||||||
// time. additionally make sure to close all the disks used in this attempt.
|
// time. additionally make sure to close all the disks used in this attempt.
|
||||||
func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints, setCount, drivesPerSet int, deploymentID string) (*formatXLV3, error) {
|
func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints, zoneCount, setCount, drivesPerSet int, deploymentID string) (*formatXLV3, error) {
|
||||||
// Initialize all storage disks
|
// Initialize all storage disks
|
||||||
storageDisks, errs := initStorageDisksWithErrors(endpoints)
|
storageDisks, errs := initStorageDisksWithErrors(endpoints)
|
||||||
defer closeStorageDisks(storageDisks)
|
defer closeStorageDisks(storageDisks)
|
||||||
@ -256,6 +256,9 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
|
|||||||
|
|
||||||
// All disks report unformatted we should initialized everyone.
|
// All disks report unformatted we should initialized everyone.
|
||||||
if shouldInitXLDisks(sErrs) && firstDisk {
|
if shouldInitXLDisks(sErrs) && firstDisk {
|
||||||
|
logger.Info("Formatting %v zone, %v set(s), %v drives per set.",
|
||||||
|
zoneCount, setCount, drivesPerSet)
|
||||||
|
|
||||||
// Initialize erasure code format on disks
|
// Initialize erasure code format on disks
|
||||||
format, err := initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet, deploymentID)
|
format, err := initFormatXL(context.Background(), storageDisks, setCount, drivesPerSet, deploymentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -333,7 +336,7 @@ func connectLoadInitFormats(retryCount int, firstDisk bool, endpoints Endpoints,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Format disks before initialization of object layer.
|
// Format disks before initialization of object layer.
|
||||||
func waitForFormatXL(firstDisk bool, endpoints Endpoints, setCount, drivesPerSet int, deploymentID string) (format *formatXLV3, err error) {
|
func waitForFormatXL(firstDisk bool, endpoints Endpoints, zoneCount, setCount, drivesPerSet int, deploymentID string) (format *formatXLV3, err error) {
|
||||||
if len(endpoints) == 0 || setCount == 0 || drivesPerSet == 0 {
|
if len(endpoints) == 0 || setCount == 0 || drivesPerSet == 0 {
|
||||||
return nil, errInvalidArgument
|
return nil, errInvalidArgument
|
||||||
}
|
}
|
||||||
@ -360,7 +363,7 @@ func waitForFormatXL(firstDisk bool, endpoints Endpoints, setCount, drivesPerSet
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
format, err := connectLoadInitFormats(tries, firstDisk, endpoints, setCount, drivesPerSet, deploymentID)
|
format, err := connectLoadInitFormats(tries, firstDisk, endpoints, zoneCount, setCount, drivesPerSet, deploymentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tries++
|
tries++
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -193,7 +193,7 @@ func prepareXLSets32() (ObjectLayer, []string, error) {
|
|||||||
|
|
||||||
endpoints := append(endpoints1, endpoints2...)
|
endpoints := append(endpoints1, endpoints2...)
|
||||||
fsDirs := append(fsDirs1, fsDirs2...)
|
fsDirs := append(fsDirs1, fsDirs2...)
|
||||||
format, err := waitForFormatXL(true, endpoints, 2, 16, "")
|
format, err := waitForFormatXL(true, endpoints, 1, 2, 16, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
removeRoots(fsDirs)
|
removeRoots(fsDirs)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -76,18 +76,18 @@ func TestNewXLSets(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
endpoints := mustGetNewEndpoints(erasureDisks...)
|
endpoints := mustGetNewEndpoints(erasureDisks...)
|
||||||
_, err := waitForFormatXL(true, endpoints, 0, 16, "")
|
_, err := waitForFormatXL(true, endpoints, 1, 0, 16, "")
|
||||||
if err != errInvalidArgument {
|
if err != errInvalidArgument {
|
||||||
t.Fatalf("Expecting error, got %s", err)
|
t.Fatalf("Expecting error, got %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = waitForFormatXL(true, nil, 1, 16, "")
|
_, err = waitForFormatXL(true, nil, 1, 1, 16, "")
|
||||||
if err != errInvalidArgument {
|
if err != errInvalidArgument {
|
||||||
t.Fatalf("Expecting error, got %s", err)
|
t.Fatalf("Expecting error, got %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes all erasure disks
|
// Initializes all erasure disks
|
||||||
format, err := waitForFormatXL(true, endpoints, 1, 16, "")
|
format, err := waitForFormatXL(true, endpoints, 1, 1, 16, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Unable to format disks for erasure, %s", err)
|
t.Fatalf("Unable to format disks for erasure, %s", err)
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,7 @@ func newXLZones(endpointZones EndpointZones) (ObjectLayer, error) {
|
|||||||
)
|
)
|
||||||
local := endpointZones.FirstLocal()
|
local := endpointZones.FirstLocal()
|
||||||
for i, ep := range endpointZones {
|
for i, ep := range endpointZones {
|
||||||
logger.Info("Formatting %v zone, %v set(s), %v drives per set.",
|
formats[i], err = waitForFormatXL(local, ep.Endpoints, i+1,
|
||||||
i+1, ep.SetCount, ep.DrivesPerSet)
|
|
||||||
formats[i], err = waitForFormatXL(local, ep.Endpoints,
|
|
||||||
ep.SetCount, ep.DrivesPerSet, deploymentID)
|
ep.SetCount, ep.DrivesPerSet, deploymentID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user