diff --git a/cmd/server-main.go b/cmd/server-main.go index c109c4ef2..feb9f4d70 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -668,50 +668,35 @@ func serverMain(ctx *cli.Context) { // Background all other operations such as initializing bucket metadata etc. go func() { - // Initialize transition tier configuration manager + // Initialize data scanner. + initDataScanner(GlobalContext, newObject) + + // Initialize background replication initBackgroundReplication(GlobalContext, newObject) + + // Initialize background transition initBackgroundTransition(GlobalContext, newObject) + // Initialize batch job pool. globalBatchJobPool = newBatchJobPool(GlobalContext, newObject, 100) + // Initialize the license update job + initLicenseUpdateJob(GlobalContext, newObject) + go func() { + // Initialize transition tier configuration manager err := globalTierConfigMgr.Init(GlobalContext, newObject) if err != nil { logger.LogIf(GlobalContext, err) - } - - globalTierJournal, err = initTierDeletionJournal(GlobalContext) - if err != nil { - logger.FatalIf(err, "Unable to initialize remote tier pending deletes journal") + } else { + globalTierJournal, err = initTierDeletionJournal(GlobalContext) + if err != nil { + logger.FatalIf(err, "Unable to initialize remote tier pending deletes journal") + } } }() - // Initialize quota manager. - globalBucketQuotaSys.Init(newObject) - - initDataScanner(GlobalContext, newObject) - - // List buckets to heal, and be re-used for loading configs. - buckets, err := newObject.ListBuckets(GlobalContext, BucketOptions{}) - if err != nil { - logger.LogIf(GlobalContext, fmt.Errorf("Unable to list buckets to heal: %w", err)) - } - // initialize replication resync state. - go globalReplicationPool.initResync(GlobalContext, buckets, newObject) - - // Populate existing buckets to the etcd backend - if globalDNSConfig != nil { - // Background this operation. - go initFederatorBackend(buckets, newObject) - } - - // Initialize bucket metadata sub-system. - globalBucketMetadataSys.Init(GlobalContext, buckets, newObject) - - // Initialize site replication manager. - globalSiteReplicationSys.Init(GlobalContext, newObject) - - // Initialize bucket notification system + // Initialize bucket notification system first before loading bucket metadata. logger.LogIf(GlobalContext, globalEventNotifier.InitBucketTargets(GlobalContext, newObject)) // initialize the new disk cache objects. @@ -724,8 +709,28 @@ func serverMain(ctx *cli.Context) { setCacheObjectLayer(cacheAPI) } - // Initialize the license update job - initLicenseUpdateJob(GlobalContext, newObject) + // List buckets to heal, and be re-used for loading configs. + buckets, err := newObject.ListBuckets(GlobalContext, BucketOptions{}) + if err != nil { + logger.LogIf(GlobalContext, fmt.Errorf("Unable to list buckets to heal: %w", err)) + } + // initialize replication resync state. + go globalReplicationPool.initResync(GlobalContext, buckets, newObject) + + // Initialize bucket metadata sub-system. + globalBucketMetadataSys.Init(GlobalContext, buckets, newObject) + + // Initialize site replication manager after bucket metadat + globalSiteReplicationSys.Init(GlobalContext, newObject) + + // Initialize quota manager. + globalBucketQuotaSys.Init(newObject) + + // Populate existing buckets to the etcd backend + if globalDNSConfig != nil { + // Background this operation. + go initFederatorBackend(buckets, newObject) + } // Prints the formatted startup message, if err is not nil then it prints additional information as well. printStartupMessage(getAPIEndpoints(), err)