change to a new bloom filter library

This commit is contained in:
Chris Lu
2021-08-29 21:26:38 -07:00
parent 05f32376eb
commit 5adfdd7982
3 changed files with 10 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/storage/idx"
. "github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/willf/bloom"
"github.com/tylertreat/BoomFilters"
)
type mapMetric struct {
@@ -93,10 +93,10 @@ func (mm *mapMetric) MaybeSetMaxFileKey(key NeedleId) {
func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
mm = &mapMetric{}
var bf *bloom.BloomFilter
var bf *boom.StableBloomFilter
buf := make([]byte, NeedleIdSize)
err = reverseWalkIndexFile(r, func(entryCount int64) {
bf = bloom.NewWithEstimates(uint(entryCount), 0.001)
bf = boom.NewDefaultStableBloomFilter(uint(entryCount), 0.001)
}, func(key NeedleId, offset Offset, size Size) error {
mm.MaybeSetMaxFileKey(key)