mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-04 05:16:23 +08:00
Merge pull request #3782 from ipfs/fix/bloom/put-no-cache
fix: remove bloom filter check on Put call in blockstore
This commit is contained in:
@ -142,10 +142,7 @@ func (b *bloomcache) Get(k *cid.Cid) (blocks.Block, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *bloomcache) Put(bl blocks.Block) error {
|
func (b *bloomcache) Put(bl blocks.Block) error {
|
||||||
if has, ok := b.hasCached(bl.Cid()); ok && has {
|
// See comment in PutMany
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err := b.blockstore.Put(bl)
|
err := b.blockstore.Put(bl)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
b.bloom.AddTS(bl.Cid().Bytes())
|
b.bloom.AddTS(bl.Cid().Bytes())
|
||||||
@ -155,7 +152,7 @@ func (b *bloomcache) Put(bl blocks.Block) error {
|
|||||||
|
|
||||||
func (b *bloomcache) PutMany(bs []blocks.Block) error {
|
func (b *bloomcache) PutMany(bs []blocks.Block) error {
|
||||||
// bloom cache gives only conclusive resulty if key is not contained
|
// bloom cache gives only conclusive resulty if key is not contained
|
||||||
// to reduce number of puts we need conclusive infomration if block is contained
|
// to reduce number of puts we need conclusive information if block is contained
|
||||||
// this means that PutMany can't be improved with bloom cache so we just
|
// this means that PutMany can't be improved with bloom cache so we just
|
||||||
// just do a passthrough.
|
// just do a passthrough.
|
||||||
err := b.blockstore.PutMany(bs)
|
err := b.blockstore.PutMany(bs)
|
||||||
|
Reference in New Issue
Block a user