From 8ab111cfb62db9720b17b56563107907240e0415 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Mon, 12 Apr 2021 15:55:40 +0100 Subject: [PATCH] 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. --- cmd/erasure.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/erasure.go b/cmd/erasure.go index 96d698406..74c435602 100644 --- a/cmd/erasure.go +++ b/cmd/erasure.go @@ -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))