initialize subsystems that are not dependent on buckets first (#16559)

This commit is contained in:
Harshavardhana 2023-02-07 12:46:47 -08:00 committed by GitHub
parent 095b518802
commit 747d475e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
} 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)