mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
parent
86a3319d41
commit
96997d2b21
@ -108,7 +108,6 @@ func (ahs *allHealState) healDriveCount() int {
|
|||||||
ahs.Lock()
|
ahs.Lock()
|
||||||
defer ahs.Unlock()
|
defer ahs.Unlock()
|
||||||
|
|
||||||
fmt.Println(ahs.healLocalDisks)
|
|
||||||
return len(ahs.healLocalDisks)
|
return len(ahs.healLocalDisks)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +129,6 @@ func (ahs *allHealState) popHealLocalDisks(healLocalDisks ...Endpoint) {
|
|||||||
for _, ep := range healLocalDisks {
|
for _, ep := range healLocalDisks {
|
||||||
delete(ahs.healLocalDisks, ep)
|
delete(ahs.healLocalDisks, ep)
|
||||||
}
|
}
|
||||||
fmt.Println(ahs.healLocalDisks)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ahs *allHealState) pushHealLocalDisks(healLocalDisks ...Endpoint) {
|
func (ahs *allHealState) pushHealLocalDisks(healLocalDisks ...Endpoint) {
|
||||||
@ -140,7 +138,6 @@ func (ahs *allHealState) pushHealLocalDisks(healLocalDisks ...Endpoint) {
|
|||||||
for _, ep := range healLocalDisks {
|
for _, ep := range healLocalDisks {
|
||||||
ahs.healLocalDisks[ep] = struct{}{}
|
ahs.healLocalDisks[ep] = struct{}{}
|
||||||
}
|
}
|
||||||
fmt.Println(ahs.healLocalDisks)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ahs *allHealState) periodicHealSeqsClean(ctx context.Context) {
|
func (ahs *allHealState) periodicHealSeqsClean(ctx context.Context) {
|
||||||
|
@ -178,9 +178,13 @@ func verifyServerSystemConfig(ctx context.Context, endpointZones EndpointZones)
|
|||||||
}
|
}
|
||||||
onlineServers++
|
onlineServers++
|
||||||
}
|
}
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
default:
|
||||||
// Sleep for a while - so that we don't go into
|
// Sleep for a while - so that we don't go into
|
||||||
// 100% CPU when half the endpoints are offline.
|
// 100% CPU when half the endpoints are offline.
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
retries++
|
retries++
|
||||||
// after 5 retries start logging that servers are not reachable yet
|
// after 5 retries start logging that servers are not reachable yet
|
||||||
if retries >= 5 {
|
if retries >= 5 {
|
||||||
@ -190,6 +194,7 @@ func verifyServerSystemConfig(ctx context.Context, endpointZones EndpointZones)
|
|||||||
}
|
}
|
||||||
offlineEndpoints = nil
|
offlineEndpoints = nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,14 +213,17 @@ func initSafeMode(ctx context.Context, newObject ObjectLayer) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If context was canceled
|
||||||
|
if errors.Is(err, context.Canceled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Prints the formatted startup message in safe mode operation.
|
// Prints the formatted startup message in safe mode operation.
|
||||||
// Drops-into safe mode where users need to now manually recover
|
// Drops-into safe mode where users need to now manually recover
|
||||||
// the server.
|
// the server.
|
||||||
printStartupSafeModeMessage(getAPIEndpoints(), err)
|
printStartupSafeModeMessage(getAPIEndpoints(), err)
|
||||||
|
|
||||||
// Initialization returned error reaching safe mode and
|
<-globalOSSignalCh
|
||||||
// not proceeding waiting for admin action.
|
|
||||||
handleSignals()
|
|
||||||
}
|
}
|
||||||
}(txnLk)
|
}(txnLk)
|
||||||
|
|
||||||
@ -276,7 +279,6 @@ func initSafeMode(ctx context.Context, newObject ObjectLayer) (err error) {
|
|||||||
// One of these retriable errors shall be retried.
|
// One of these retriable errors shall be retried.
|
||||||
if errors.Is(err, errDiskNotFound) ||
|
if errors.Is(err, errDiskNotFound) ||
|
||||||
errors.Is(err, errConfigNotFound) ||
|
errors.Is(err, errConfigNotFound) ||
|
||||||
errors.Is(err, context.Canceled) ||
|
|
||||||
errors.Is(err, context.DeadlineExceeded) ||
|
errors.Is(err, context.DeadlineExceeded) ||
|
||||||
errors.As(err, &rquorum) ||
|
errors.As(err, &rquorum) ||
|
||||||
errors.As(err, &wquorum) ||
|
errors.As(err, &wquorum) ||
|
||||||
@ -384,13 +386,15 @@ func startBackgroundOps(ctx context.Context, objAPI ObjectLayer) {
|
|||||||
|
|
||||||
// serverMain handler called for 'minio server' command.
|
// serverMain handler called for 'minio server' command.
|
||||||
func serverMain(ctx *cli.Context) {
|
func serverMain(ctx *cli.Context) {
|
||||||
|
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM)
|
||||||
|
|
||||||
|
go handleSignals()
|
||||||
|
|
||||||
setDefaultProfilerRates()
|
setDefaultProfilerRates()
|
||||||
|
|
||||||
// Initialize globalConsoleSys system
|
// Initialize globalConsoleSys system
|
||||||
globalConsoleSys = NewConsoleLogger(GlobalContext)
|
globalConsoleSys = NewConsoleLogger(GlobalContext)
|
||||||
|
|
||||||
signal.Notify(globalOSSignalCh, os.Interrupt, syscall.SIGTERM)
|
|
||||||
|
|
||||||
// Handle all server command args.
|
// Handle all server command args.
|
||||||
serverHandleCmdArgs(ctx)
|
serverHandleCmdArgs(ctx)
|
||||||
|
|
||||||
@ -444,6 +448,9 @@ func serverMain(ctx *cli.Context) {
|
|||||||
globalBackgroundHealState = newHealState()
|
globalBackgroundHealState = newHealState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize all sub-systems
|
||||||
|
newAllSubsystems()
|
||||||
|
|
||||||
// Configure server.
|
// Configure server.
|
||||||
handler, err := configureServerHandler(globalEndpoints)
|
handler, err := configureServerHandler(globalEndpoints)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -491,14 +498,14 @@ func serverMain(ctx *cli.Context) {
|
|||||||
for {
|
for {
|
||||||
// Additionally in distributed setup, validate the setup and configuration.
|
// Additionally in distributed setup, validate the setup and configuration.
|
||||||
err := verifyServerSystemConfig(GlobalContext, globalEndpoints)
|
err := verifyServerSystemConfig(GlobalContext, globalEndpoints)
|
||||||
if err == nil {
|
if err == nil || errors.Is(err, context.Canceled) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
logger.LogIf(GlobalContext, err, "Unable to initialize distributed setup, retrying.. after 5 seconds")
|
logger.LogIf(GlobalContext, err, "Unable to initialize distributed setup, retrying.. after 5 seconds")
|
||||||
select {
|
select {
|
||||||
case <-GlobalContext.Done():
|
case <-GlobalContext.Done():
|
||||||
return
|
return
|
||||||
case <-time.After(5 * time.Second):
|
case <-time.After(500 * time.Millisecond):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,8 +523,6 @@ func serverMain(ctx *cli.Context) {
|
|||||||
globalObjectAPI = newObject
|
globalObjectAPI = newObject
|
||||||
globalObjLayerMutex.Unlock()
|
globalObjLayerMutex.Unlock()
|
||||||
|
|
||||||
newAllSubsystems()
|
|
||||||
|
|
||||||
go startBackgroundOps(GlobalContext, newObject)
|
go startBackgroundOps(GlobalContext, newObject)
|
||||||
|
|
||||||
logger.FatalIf(initSafeMode(GlobalContext, newObject), "Unable to initialize server switching into safe-mode")
|
logger.FatalIf(initSafeMode(GlobalContext, newObject), "Unable to initialize server switching into safe-mode")
|
||||||
@ -549,7 +554,7 @@ func serverMain(ctx *cli.Context) {
|
|||||||
logger.StartupMessage(color.RedBold(msg))
|
logger.StartupMessage(color.RedBold(msg))
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSignals()
|
<-globalOSSignalCh
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
// Initialize object layer with the supplied disks, objectLayer is nil upon any error.
|
||||||
|
@ -18,8 +18,6 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -46,6 +44,9 @@ func handleSignals() {
|
|||||||
stopProcess := func() bool {
|
stopProcess := func() bool {
|
||||||
var err, oerr error
|
var err, oerr error
|
||||||
|
|
||||||
|
// send signal to various go-routines that they need to quit.
|
||||||
|
cancelGlobalContext()
|
||||||
|
|
||||||
if globalNotificationSys != nil {
|
if globalNotificationSys != nil {
|
||||||
globalNotificationSys.RemoveAllRemoteTargets()
|
globalNotificationSys.RemoveAllRemoteTargets()
|
||||||
}
|
}
|
||||||
@ -55,9 +56,6 @@ func handleSignals() {
|
|||||||
logger.LogIf(context.Background(), err)
|
logger.LogIf(context.Background(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send signal to various go-routines that they need to quit.
|
|
||||||
cancelGlobalContext()
|
|
||||||
|
|
||||||
if objAPI := newObjectLayerWithoutSafeModeFn(); objAPI != nil {
|
if objAPI := newObjectLayerWithoutSafeModeFn(); objAPI != nil {
|
||||||
oerr = objAPI.Shutdown(context.Background())
|
oerr = objAPI.Shutdown(context.Background())
|
||||||
logger.LogIf(context.Background(), oerr)
|
logger.LogIf(context.Background(), oerr)
|
||||||
@ -68,14 +66,8 @@ func handleSignals() {
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case err := <-globalHTTPServerErrorCh:
|
case <-globalHTTPServerErrorCh:
|
||||||
if objAPI := newObjectLayerWithoutSafeModeFn(); objAPI != nil {
|
exit(stopProcess())
|
||||||
objAPI.Shutdown(context.Background())
|
|
||||||
}
|
|
||||||
if err != nil && !errors.Is(err, http.ErrServerClosed) {
|
|
||||||
logger.Fatal(err, "Unable to start MinIO server")
|
|
||||||
}
|
|
||||||
exit(true)
|
|
||||||
case osSignal := <-globalOSSignalCh:
|
case osSignal := <-globalOSSignalCh:
|
||||||
logger.Info("Exiting on signal: %s", strings.ToUpper(osSignal.String()))
|
logger.Info("Exiting on signal: %s", strings.ToUpper(osSignal.String()))
|
||||||
exit(stopProcess())
|
exit(stopProcess())
|
||||||
|
Loading…
Reference in New Issue
Block a user