seiflotfy / cuckoofilter

Cuckoo Filter: Practically Better Than Bloom
MIT License
1.13k stars 109 forks source link

Is thread-safe concurrent by default? #41

Closed wenweih closed 3 years ago

wenweih commented 3 years ago

Hi, thanks for the contribution. May I have a question that InsertUnique is concurrency safe? Thanks for looking.

I had met this data race issue:

==================
WARNING: DATA RACE
Read at 0x00c0b79cac1c by goroutine 276:
  github.com/seiflotfy/cuckoofilter.(*bucket).getFingerprintIndex()
      /Users/wenwei/work/go/src/github.com/balabalabala/vendor/github.com/seiflotfy/cuckoofilter/bucket.go:33 +0x54
  github.com/seiflotfy/cuckoofilter.(*Filter).Lookup()
      /Users/wenwei/work/go/src/github.com/balabala/vendor/github.com/seiflotfy/cuckoofilter/cuckoofilter.go:37 +0xde
  github.com/seiflotfy/cuckoofilter.(*Filter).InsertUnique()
      /Users/wenwei/work/go/src/github.com/balabalavendor/github.com/seiflotfy/cuckoofilter/cuckoofilter.go:74 +0x5a
wenweih commented 3 years ago

Saw this discussion #18