mirror of
https://github.com/minio/minio.git
synced 2025-05-21 17:43:48 -04:00
Re-add missing bucket bloom filters (#9861)
This commit is contained in:
parent
4ac31ea82b
commit
1813ff9dfa
@ -120,8 +120,8 @@ func (b bloomFilter) containsDir(in string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// bytes returns the bloom filter serialized as a byte slice.
|
// bytes returns the bloom filter serialized as a byte slice.
|
||||||
func (b bloomFilter) bytes() []byte {
|
func (b *bloomFilter) bytes() []byte {
|
||||||
if b.BloomFilter == nil {
|
if b == nil || b.BloomFilter == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/bpool"
|
"github.com/minio/minio/pkg/bpool"
|
||||||
|
"github.com/minio/minio/pkg/color"
|
||||||
"github.com/minio/minio/pkg/dsync"
|
"github.com/minio/minio/pkg/dsync"
|
||||||
"github.com/minio/minio/pkg/madmin"
|
"github.com/minio/minio/pkg/madmin"
|
||||||
"github.com/minio/minio/pkg/sync/errgroup"
|
"github.com/minio/minio/pkg/sync/errgroup"
|
||||||
@ -260,6 +261,7 @@ func (er erasureObjects) crawlAndGetDataUsage(ctx context.Context, buckets []Buc
|
|||||||
},
|
},
|
||||||
Cache: make(map[string]dataUsageEntry, len(oldCache.Cache)),
|
Cache: make(map[string]dataUsageEntry, len(oldCache.Cache)),
|
||||||
}
|
}
|
||||||
|
bloom := bf.bytes()
|
||||||
|
|
||||||
// Put all buckets into channel.
|
// Put all buckets into channel.
|
||||||
bucketCh := make(chan BucketInfo, len(buckets))
|
bucketCh := make(chan BucketInfo, len(buckets))
|
||||||
@ -269,12 +271,21 @@ func (er erasureObjects) crawlAndGetDataUsage(ctx context.Context, buckets []Buc
|
|||||||
bucketCh <- b
|
bucketCh <- b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add existing buckets.
|
|
||||||
|
// Add existing buckets if changes or lifecycles.
|
||||||
for _, b := range buckets {
|
for _, b := range buckets {
|
||||||
e := oldCache.find(b.Name)
|
e := oldCache.find(b.Name)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
bucketCh <- b
|
|
||||||
cache.replace(b.Name, dataUsageRoot, *e)
|
cache.replace(b.Name, dataUsageRoot, *e)
|
||||||
|
lc, err := globalLifecycleSys.Get(b.Name)
|
||||||
|
activeLC := err == nil && lc.HasActiveRules("", true)
|
||||||
|
if activeLC || bf == nil || bf.containsDir(b.Name) {
|
||||||
|
bucketCh <- b
|
||||||
|
} else {
|
||||||
|
if intDataUpdateTracker.debug {
|
||||||
|
logger.Info(color.Green("crawlAndGetDataUsage:")+" Skipping bucket %v, not updated", b.Name)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,6 +353,7 @@ func (er erasureObjects) crawlAndGetDataUsage(ctx context.Context, buckets []Buc
|
|||||||
if cache.Info.Name == "" {
|
if cache.Info.Name == "" {
|
||||||
cache.Info.Name = bucket.Name
|
cache.Info.Name = bucket.Name
|
||||||
}
|
}
|
||||||
|
cache.Info.BloomFilter = bloom
|
||||||
if cache.Info.Name != bucket.Name {
|
if cache.Info.Name != bucket.Name {
|
||||||
logger.LogIf(ctx, fmt.Errorf("cache name mismatch: %s != %s", cache.Info.Name, bucket.Name))
|
logger.LogIf(ctx, fmt.Errorf("cache name mismatch: %s != %s", cache.Info.Name, bucket.Name))
|
||||||
cache.Info = dataUsageCacheInfo{
|
cache.Info = dataUsageCacheInfo{
|
||||||
@ -354,6 +366,7 @@ func (er erasureObjects) crawlAndGetDataUsage(ctx context.Context, buckets []Buc
|
|||||||
// Calc usage
|
// Calc usage
|
||||||
before := cache.Info.LastUpdate
|
before := cache.Info.LastUpdate
|
||||||
cache, err = disk.CrawlAndGetDataUsage(ctx, cache)
|
cache, err = disk.CrawlAndGetDataUsage(ctx, cache)
|
||||||
|
cache.Info.BloomFilter = nil
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogIf(ctx, err)
|
logger.LogIf(ctx, err)
|
||||||
if cache.Info.LastUpdate.After(before) {
|
if cache.Info.LastUpdate.After(before) {
|
||||||
|
@ -248,10 +248,7 @@ func (fs *FSObjects) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
totalCache.Info.BloomFilter = nil
|
|
||||||
if bf != nil {
|
|
||||||
totalCache.Info.BloomFilter = bf.bytes()
|
totalCache.Info.BloomFilter = bf.bytes()
|
||||||
}
|
|
||||||
|
|
||||||
// Clear totals.
|
// Clear totals.
|
||||||
var root dataUsageEntry
|
var root dataUsageEntry
|
||||||
|
Loading…
x
Reference in New Issue
Block a user