Browse Source

fix build

pull/2321/head
Chris Lu 3 years ago
parent
commit
f811fd0903
  1. 7
      weed/storage/needle_map_metric.go

7
weed/storage/needle_map_metric.go

@ -93,10 +93,10 @@ func (mm *mapMetric) MaybeSetMaxFileKey(key NeedleId) {
func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
mm = &mapMetric{}
var bf *boom.StableBloomFilter
var bf *boom.BloomFilter
buf := make([]byte, NeedleIdSize)
err = reverseWalkIndexFile(r, func(entryCount int64) {
bf = boom.NewDefaultStableBloomFilter(uint(entryCount), 0.001)
bf = boom.NewBloomFilter(uint(entryCount), 0.001)
}, func(key NeedleId, offset Offset, size Size) error {
mm.MaybeSetMaxFileKey(key)
@ -105,9 +105,8 @@ func newNeedleMapMetricFromIndexFile(r *os.File) (mm *mapMetric, err error) {
mm.FileByteCounter += uint64(size)
}
if !bf.Test(buf) {
if !bf.TestAndAdd(buf) {
mm.FileCounter++
bf.Add(buf)
} else {
// deleted file
mm.DeletionCounter++

Loading…
Cancel
Save