fix build

This commit is contained in:
Chris Lu 2021-08-30 02:03:08 -07:00
parent 44d0ac95f6
commit f811fd0903

View file

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