mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
bootstrap: Speed up bucket metadata loading (#19969)
Currently, bucket metadata is being loaded serially inside ListBuckets Objet API. Fix that by loading the bucket metadata as the number of erasure sets * 10, which is a good approximation.
This commit is contained in:
@@ -1053,11 +1053,11 @@ func serverMain(ctx *cli.Context) {
|
||||
bootLogIf(GlobalContext, globalEventNotifier.InitBucketTargets(GlobalContext, newObject))
|
||||
})
|
||||
|
||||
var buckets []BucketInfo
|
||||
var buckets []string
|
||||
// List buckets to initialize bucket metadata sub-sys.
|
||||
bootstrapTrace("listBuckets", func() {
|
||||
for {
|
||||
buckets, err = newObject.ListBuckets(GlobalContext, BucketOptions{})
|
||||
bucketsList, err := newObject.ListBuckets(GlobalContext, BucketOptions{NoMetadata: true})
|
||||
if err != nil {
|
||||
if configRetriableErrors(err) {
|
||||
logger.Info("Waiting for list buckets to succeed to initialize buckets.. possible cause (%v)", err)
|
||||
@@ -1067,6 +1067,10 @@ func serverMain(ctx *cli.Context) {
|
||||
bootLogIf(GlobalContext, fmt.Errorf("Unable to list buckets to initialize bucket metadata sub-system: %w", err))
|
||||
}
|
||||
|
||||
buckets = make([]string, len(bucketsList))
|
||||
for i := range bucketsList {
|
||||
buckets[i] = bucketsList[i].Name
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user