fs: Check if cache root was added (#9945)

Fixes #9942
This commit is contained in:
Klaus Post 2020-06-30 09:32:36 -07:00 committed by GitHub
parent 90f36c1389
commit 27a1f3ed2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -280,6 +280,13 @@ func (fs *FSObjects) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter,
}
logger.LogIf(ctx, err)
cache.Info.BloomFilter = nil
if cache.root() == nil {
if intDataUpdateTracker.debug {
logger.Info(color.Green("CrawlAndGetDataUsage:") + " No root added. Adding empty")
}
cache.replace(cache.Info.Name, dataUsageRoot, dataUsageEntry{})
}
if cache.Info.LastUpdate.After(bCache.Info.LastUpdate) {
if intDataUpdateTracker.debug {
logger.Info(color.Green("CrawlAndGetDataUsage:")+" Saving bucket %q cache with %d entries", b.Name, len(cache.Cache))