Initialize global object layer after all subsystems have initialized (#6333)

This is to ensure that object API operations are not performed
on a server on which subsystems are yet to be initialized.
This commit is contained in:
Harshavardhana
2018-08-22 23:11:17 -07:00
committed by GitHub
parent 8601f29d95
commit b01e69e08f
4 changed files with 13 additions and 21 deletions

View File

@@ -313,10 +313,6 @@ func serverMain(ctx *cli.Context) {
logger.FatalIf(err, "Unable to initialize backend")
}
globalObjLayerMutex.Lock()
globalObjectAPI = newObject
globalObjLayerMutex.Unlock()
// Populate existing buckets to the etcd backend
if globalDNSConfig != nil {
initFederatorBackend(newObject)
@@ -326,7 +322,7 @@ func serverMain(ctx *cli.Context) {
globalConfigSys = NewConfigSys()
// Initialize config system.
if err = globalConfigSys.Init(newObjectLayerFn()); err != nil {
if err = globalConfigSys.Init(newObject); err != nil {
logger.Fatal(err, "Unable to initialize config system")
}
@@ -347,7 +343,7 @@ func serverMain(ctx *cli.Context) {
globalPolicySys = NewPolicySys()
// Initialize policy system.
if err := globalPolicySys.Init(newObjectLayerFn()); err != nil {
if err := globalPolicySys.Init(newObject); err != nil {
logger.Fatal(err, "Unable to initialize policy system")
}
@@ -355,10 +351,14 @@ func serverMain(ctx *cli.Context) {
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
// Initialize notification system.
if err := globalNotificationSys.Init(newObjectLayerFn()); err != nil {
if err := globalNotificationSys.Init(newObject); err != nil {
logger.Fatal(err, "Unable to initialize notification system")
}
globalObjLayerMutex.Lock()
globalObjectAPI = newObject
globalObjLayerMutex.Unlock()
// Prints the formatted startup message once object layer is initialized.
apiEndpoints := getAPIEndpoints(globalMinioAddr)
printStartupMessage(apiEndpoints)