mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
usage: Fix buckets count calculation when no object is present (#8929)
XL crawling wrongly returns a zero buckets count when there are no objects uploaded in the server yet. The reason is data of the crawler of posix returns invalid result when all disks has zero objects. A simple fix is to always pick the crawling result of the first disk but choose over the result of the disk which has the most objects in it.
This commit is contained in:
parent
2d295a31de
commit
e934c3e2a2
@ -227,8 +227,10 @@ func (xl xlObjects) CrawlAndGetDataUsage(ctx context.Context, endCh <-chan struc
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
var dataUsageInfo DataUsageInfo
|
||||
for i := 0; i < len(dataUsageResults); i++ {
|
||||
var dataUsageInfo = dataUsageResults[0]
|
||||
// Pick the crawling result of the disk which has the most
|
||||
// number of objects in it.
|
||||
for i := 1; i < len(dataUsageResults); i++ {
|
||||
if dataUsageResults[i].ObjectsCount > dataUsageInfo.ObjectsCount {
|
||||
dataUsageInfo = dataUsageResults[i]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user