mirror of
https://github.com/minio/minio.git
synced 2025-04-09 06:00:12 -04:00
fix: do not crash rebalance code instead set the object layer (#17465)
fixes #17421
This commit is contained in:
parent
b6b68be052
commit
65c31fab12
@ -141,6 +141,10 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
|
|||||||
}
|
}
|
||||||
|
|
||||||
z.decommissionCancelers = make([]context.CancelFunc, len(z.serverPools))
|
z.decommissionCancelers = make([]context.CancelFunc, len(z.serverPools))
|
||||||
|
|
||||||
|
// initialize the object layer.
|
||||||
|
setObjectLayer(z)
|
||||||
|
|
||||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
for {
|
for {
|
||||||
err := z.Init(ctx) // Initializes all pools.
|
err := z.Init(ctx) // Initializes all pools.
|
||||||
@ -159,6 +163,7 @@ func newErasureServerPools(ctx context.Context, endpointServerPools EndpointServ
|
|||||||
globalLocalDrivesMu.Lock()
|
globalLocalDrivesMu.Lock()
|
||||||
globalLocalDrives = localDrives
|
globalLocalDrives = localDrives
|
||||||
defer globalLocalDrivesMu.Unlock()
|
defer globalLocalDrivesMu.Unlock()
|
||||||
|
|
||||||
return z, nil
|
return z, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,12 +413,9 @@ func bootstrapTrace(msg string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func initServer(ctx context.Context, newObject ObjectLayer) error {
|
func initServerConfig(ctx context.Context, newObject ObjectLayer) error {
|
||||||
t1 := time.Now()
|
t1 := time.Now()
|
||||||
|
|
||||||
// Once the config is fully loaded, initialize the new object layer.
|
|
||||||
setObjectLayer(newObject)
|
|
||||||
|
|
||||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -633,6 +630,12 @@ func serverMain(ctx *cli.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !globalDisableFreezeOnBoot {
|
||||||
|
// Freeze the services until the bucket notification subsystem gets initialized.
|
||||||
|
bootstrapTrace("freezeServices")
|
||||||
|
freezeServices()
|
||||||
|
}
|
||||||
|
|
||||||
bootstrapTrace("newObjectLayer")
|
bootstrapTrace("newObjectLayer")
|
||||||
newObject, err := newObjectLayer(GlobalContext, globalEndpoints)
|
newObject, err := newObjectLayer(GlobalContext, globalEndpoints)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -645,31 +648,22 @@ func serverMain(ctx *cli.Context) {
|
|||||||
bootstrapTrace("newSharedLock")
|
bootstrapTrace("newSharedLock")
|
||||||
globalLeaderLock = newSharedLock(GlobalContext, newObject, "leader.lock")
|
globalLeaderLock = newSharedLock(GlobalContext, newObject, "leader.lock")
|
||||||
|
|
||||||
// Enable background operations for erasure coding
|
// Enable background operations on
|
||||||
|
//
|
||||||
|
// - Disk auto healing
|
||||||
|
// - MRF (most recently failed) healing
|
||||||
|
// - Background expiration routine for lifecycle policies
|
||||||
bootstrapTrace("initAutoHeal")
|
bootstrapTrace("initAutoHeal")
|
||||||
initAutoHeal(GlobalContext, newObject)
|
initAutoHeal(GlobalContext, newObject)
|
||||||
|
|
||||||
bootstrapTrace("initHealMRF")
|
bootstrapTrace("initHealMRF")
|
||||||
initHealMRF(GlobalContext, newObject)
|
initHealMRF(GlobalContext, newObject)
|
||||||
|
|
||||||
bootstrapTrace("initBackgroundExpiry")
|
bootstrapTrace("initBackgroundExpiry")
|
||||||
initBackgroundExpiry(GlobalContext, newObject)
|
initBackgroundExpiry(GlobalContext, newObject)
|
||||||
|
|
||||||
if !globalCLIContext.StrictS3Compat {
|
bootstrapTrace("initServerConfig")
|
||||||
logger.Info(color.RedBold("WARNING: Strict AWS S3 compatible incoming PUT, POST content payload validation is turned off, caution is advised do not use in production"))
|
if err = initServerConfig(GlobalContext, newObject); err != nil {
|
||||||
}
|
|
||||||
|
|
||||||
if globalActiveCred.Equal(auth.DefaultCredentials) {
|
|
||||||
msg := fmt.Sprintf("WARNING: Detected default credentials '%s', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables",
|
|
||||||
globalActiveCred)
|
|
||||||
logger.Info(color.RedBold(msg))
|
|
||||||
}
|
|
||||||
|
|
||||||
if !globalDisableFreezeOnBoot {
|
|
||||||
// Freeze the services until the bucket notification subsystem gets initialized.
|
|
||||||
freezeServices()
|
|
||||||
}
|
|
||||||
|
|
||||||
bootstrapTrace("initializing the server")
|
|
||||||
if err = initServer(GlobalContext, newObject); err != nil {
|
|
||||||
var cerr config.Err
|
var cerr config.Err
|
||||||
// For any config error, we don't need to drop into safe-mode
|
// For any config error, we don't need to drop into safe-mode
|
||||||
// instead its a user error and should be fixed by user.
|
// instead its a user error and should be fixed by user.
|
||||||
@ -685,12 +679,22 @@ func serverMain(ctx *cli.Context) {
|
|||||||
logger.LogIf(GlobalContext, err)
|
logger.LogIf(GlobalContext, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !globalCLIContext.StrictS3Compat {
|
||||||
|
logger.Info(color.RedBold("WARNING: Strict AWS S3 compatible incoming PUT, POST content payload validation is turned off, caution is advised do not use in production"))
|
||||||
|
}
|
||||||
|
|
||||||
|
if globalActiveCred.Equal(auth.DefaultCredentials) {
|
||||||
|
msg := fmt.Sprintf("WARNING: Detected default credentials '%s', we recommend that you change these values with 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD' environment variables",
|
||||||
|
globalActiveCred)
|
||||||
|
logger.Info(color.RedBold(msg))
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize users credentials and policies in background right after config has initialized.
|
// Initialize users credentials and policies in background right after config has initialized.
|
||||||
go func() {
|
go func() {
|
||||||
bootstrapTrace("globalIAMSys.Init")
|
bootstrapTrace("globalIAMSys.Init")
|
||||||
globalIAMSys.Init(GlobalContext, newObject, globalEtcdClient, globalRefreshIAMInterval)
|
globalIAMSys.Init(GlobalContext, newObject, globalEtcdClient, globalRefreshIAMInterval)
|
||||||
|
|
||||||
// Initialize
|
// Initialize Console UI
|
||||||
if globalBrowserEnabled {
|
if globalBrowserEnabled {
|
||||||
bootstrapTrace("initConsoleServer")
|
bootstrapTrace("initConsoleServer")
|
||||||
srv, err := initConsoleServer()
|
srv, err := initConsoleServer()
|
||||||
@ -721,7 +725,6 @@ func serverMain(ctx *cli.Context) {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if !globalDisableFreezeOnBoot {
|
if !globalDisableFreezeOnBoot {
|
||||||
bootstrapTrace("freezeServices")
|
|
||||||
defer unfreezeServices()
|
defer unfreezeServices()
|
||||||
defer bootstrapTrace("unfreezeServices")
|
defer bootstrapTrace("unfreezeServices")
|
||||||
t := time.AfterFunc(5*time.Minute, func() {
|
t := time.AfterFunc(5*time.Minute, func() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user