mirror of
https://github.com/minio/minio.git
synced 2025-11-22 10:37:42 -05:00
data-usage: Avoid crawling duplicated call (#8843)
This fix will also picks 3 and not 4 disks from a single erasure set.
This commit is contained in:
@@ -198,16 +198,18 @@ func (xl xlObjects) GetMetrics(ctx context.Context) (*Metrics, error) {
|
||||
return &Metrics{}, NotImplemented{}
|
||||
}
|
||||
|
||||
// crawlAndGetDataUsage picks three random disks to crawl and get data usage
|
||||
func (xl xlObjects) crawlAndGetDataUsage(ctx context.Context, endCh <-chan struct{}) DataUsageInfo {
|
||||
|
||||
var randomDisks []StorageAPI
|
||||
for _, d := range xl.getLoadBalancedDisks() {
|
||||
if d == nil || !d.IsOnline() {
|
||||
continue
|
||||
}
|
||||
if len(randomDisks) > 3 {
|
||||
randomDisks = append(randomDisks, d)
|
||||
if len(randomDisks) >= 3 {
|
||||
break
|
||||
}
|
||||
randomDisks = append(randomDisks, d)
|
||||
}
|
||||
|
||||
var dataUsageResults = make([]DataUsageInfo, len(randomDisks))
|
||||
|
||||
Reference in New Issue
Block a user