@ -140,7 +140,6 @@ type folderScanner struct {
oldCache dataUsageCache
oldCache dataUsageCache
newCache dataUsageCache
newCache dataUsageCache
withFilter * bloomFilter
withFilter * bloomFilter
waitForLowActiveIO func ( )
dataUsageCrawlMult float64
dataUsageCrawlMult float64
dataUsageCrawlDebug bool
dataUsageCrawlDebug bool
@ -155,7 +154,7 @@ type folderScanner struct {
// The returned cache will always be valid, but may not be updated from the existing.
// The returned cache will always be valid, but may not be updated from the existing.
// Before each operation waitForLowActiveIO is called which can be used to temporarily halt the crawler.
// Before each operation waitForLowActiveIO is called which can be used to temporarily halt the crawler.
// If the supplied context is canceled the function will return at the first chance.
// If the supplied context is canceled the function will return at the first chance.
func crawlDataFolder ( ctx context . Context , basePath string , cache dataUsageCache , waitForLowActiveIO func ( ) , getSize getSizeFn ) ( dataUsageCache , error ) {
func crawlDataFolder ( ctx context . Context , basePath string , cache dataUsageCache , getSize getSizeFn ) ( dataUsageCache , error ) {
t := UTCNow ( )
t := UTCNow ( )
logPrefix := color . Green ( "data-usage: " )
logPrefix := color . Green ( "data-usage: " )
@ -183,7 +182,6 @@ func crawlDataFolder(ctx context.Context, basePath string, cache dataUsageCache,
getSize : getSize ,
getSize : getSize ,
oldCache : cache ,
oldCache : cache ,
newCache : dataUsageCache { Info : cache . Info } ,
newCache : dataUsageCache { Info : cache . Info } ,
waitForLowActiveIO : waitForLowActiveIO ,
newFolders : nil ,
newFolders : nil ,
existingFolders : nil ,
existingFolders : nil ,
dataUsageCrawlMult : delayMult ,
dataUsageCrawlMult : delayMult ,
@ -376,7 +374,6 @@ func (f *folderScanner) scanQueuedLevels(ctx context.Context, folders []cachedFo
}
}
}
}
}
}
f . waitForLowActiveIO ( )
sleepDuration ( dataCrawlSleepPerFolder , f . dataUsageCrawlMult )
sleepDuration ( dataCrawlSleepPerFolder , f . dataUsageCrawlMult )
cache := dataUsageEntry { }
cache := dataUsageEntry { }
@ -424,7 +421,6 @@ func (f *folderScanner) scanQueuedLevels(ctx context.Context, folders []cachedFo
}
}
return nil
return nil
}
}
f . waitForLowActiveIO ( )
// Dynamic time delay.
// Dynamic time delay.
t := UTCNow ( )
t := UTCNow ( )
@ -484,7 +480,9 @@ func (f *folderScanner) scanQueuedLevels(ctx context.Context, folders []cachedFo
// If that doesn't bring it back we remove the folder and assume it was deleted.
// If that doesn't bring it back we remove the folder and assume it was deleted.
// This means that the next run will not look for it.
// This means that the next run will not look for it.
for k := range existing {
for k := range existing {
f . waitForLowActiveIO ( )
// Dynamic time delay.
t := UTCNow ( )
bucket , prefix := path2BucketObject ( k )
bucket , prefix := path2BucketObject ( k )
if f . dataUsageCrawlDebug {
if f . dataUsageCrawlDebug {
logger . Info ( color . Green ( "folder-scanner:" ) + " checking disappeared folder: %v/%v" , bucket , prefix )
logger . Info ( color . Green ( "folder-scanner:" ) + " checking disappeared folder: %v/%v" , bucket , prefix )
@ -498,6 +496,7 @@ func (f *folderScanner) scanQueuedLevels(ctx context.Context, folders []cachedFo
versionID : versionID ,
versionID : versionID ,
} , madmin . HealItemObject )
} , madmin . HealItemObject )
} )
} )
sleepDuration ( time . Since ( t ) , f . dataUsageCrawlMult )
if f . dataUsageCrawlDebug && err != nil {
if f . dataUsageCrawlDebug && err != nil {
logger . Info ( color . Green ( "healObjects:" ) + " checking returned value %v" , err )
logger . Info ( color . Green ( "healObjects:" ) + " checking returned value %v" , err )
@ -535,7 +534,6 @@ func (f *folderScanner) deepScanFolder(ctx context.Context, folder cachedFolder)
default :
default :
}
}
f . waitForLowActiveIO ( )
if typ & os . ModeDir != 0 {
if typ & os . ModeDir != 0 {
dirStack = append ( dirStack , entName )
dirStack = append ( dirStack , entName )
err := readDirFn ( path . Join ( dirStack ... ) , addDir )
err := readDirFn ( path . Join ( dirStack ... ) , addDir )