mirror of https://github.com/minio/minio.git
scanner: Shuffle disks to scan (#12036)
Ensure random association between disk and bucket in each crawling iteration to ensure that ILM applies correctly to objects not present in all disks.
This commit is contained in:
parent
641150f2a2
commit
8ab111cfb6
|
@ -435,6 +435,11 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, bf
|
|||
}
|
||||
}()
|
||||
|
||||
// Shuffle disks to ensure a total randomness of bucket/disk association to ensure
|
||||
// that objects that are not present in all disks are accounted and ILM applied.
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
r.Shuffle(len(disks), func(i, j int) { disks[i], disks[j] = disks[j], disks[i] })
|
||||
|
||||
// Start one scanner per disk
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(disks))
|
||||
|
|
Loading…
Reference in New Issue