fix: remove bloom filter check on Put call in blockstore
To prevent put we need to have conclusive information if item is contained in the repo, bloom filter won't give this information. It only says if it is for sure not contained. License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Mar 14, 2017 at 00:57 UTC
9c194aa7e2febeab0cbd895067d7d90d82b137f9
1 file changed
+2
-5
blocks/blockstore/bloom_cache.go
+2
-5
@@ -142,10 +142,7 @@ func (b *bloomcache) Get(k *cid.Cid) (blocks.Block, error) {
142
}
143
144
func (b *bloomcache) Put(bl blocks.Block) error {
145
- if has, ok := b.hasCached(bl.Cid()); ok && has {
146
- return nil
147
- }
148
-
145
+ // See comment in PutMany
146
err := b.blockstore.Put(bl)
147
if err == nil {
148
b.bloom.AddTS(bl.Cid().Bytes())
@@ -155,7 +152,7 @@ func (b *bloomcache) Put(bl blocks.Block) error {
152
153
func (b *bloomcache) PutMany(bs []blocks.Block) error {
154
// bloom cache gives only conclusive resulty if key is not contained
158
- // to reduce number of puts we need conclusive infomration if block is contained
155
+ // to reduce number of puts we need conclusive information if block is contained
156
// this means that PutMany can't be improved with bloom cache so we just
157
// just do a passthrough.
158
err := b.blockstore.PutMany(bs)