mirror of
https://github.com/minio/minio.git
synced 2025-12-08 16:53:11 -05:00
fix: heal multiple buckets in bulk (#11029)
makes server startup, orders of magnitude faster with large number of buckets
This commit is contained in:
@@ -531,6 +531,31 @@ func (s *erasureSets) Shutdown(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MakeMultipleBuckets - make many buckets at once.
|
||||
func (s *erasureSets) MakeMultipleBuckets(ctx context.Context, buckets ...string) error {
|
||||
g := errgroup.WithNErrs(len(s.sets))
|
||||
|
||||
// Create buckets in parallel across all sets.
|
||||
for index := range s.sets {
|
||||
index := index
|
||||
g.Go(func() error {
|
||||
return s.sets[index].MakeMultipleBuckets(ctx, buckets...)
|
||||
}, index)
|
||||
}
|
||||
|
||||
errs := g.Wait()
|
||||
|
||||
// Return the first encountered error
|
||||
for _, err := range errs {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Success.
|
||||
return nil
|
||||
}
|
||||
|
||||
// MakeBucketLocation - creates a new bucket across all sets simultaneously,
|
||||
// then return the first encountered error
|
||||
func (s *erasureSets) MakeBucketWithLocation(ctx context.Context, bucket string, opts BucketOptions) error {
|
||||
|
||||
Reference in New Issue
Block a user