Merge pull request #5796 from filecoin-project/fix/return-after-cancel
fix: return buffers after canceling badger operation
This commit is contained in:
commit
06aaa668d6
@ -288,9 +288,6 @@ func (b *Blockstore) PutMany(blocks []blocks.Block) error {
|
|||||||
return ErrBlockstoreClosed
|
return ErrBlockstoreClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
batch := b.DB.NewWriteBatch()
|
|
||||||
defer batch.Cancel()
|
|
||||||
|
|
||||||
// toReturn tracks the byte slices to return to the pool, if we're using key
|
// toReturn tracks the byte slices to return to the pool, if we're using key
|
||||||
// prefixing. we can't return each slice to the pool after each Set, because
|
// prefixing. we can't return each slice to the pool after each Set, because
|
||||||
// badger holds on to the slice.
|
// badger holds on to the slice.
|
||||||
@ -304,6 +301,9 @@ func (b *Blockstore) PutMany(blocks []blocks.Block) error {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
batch := b.DB.NewWriteBatch()
|
||||||
|
defer batch.Cancel()
|
||||||
|
|
||||||
for _, block := range blocks {
|
for _, block := range blocks {
|
||||||
k, pooled := b.PooledStorageKey(block.Cid())
|
k, pooled := b.PooledStorageKey(block.Cid())
|
||||||
if pooled {
|
if pooled {
|
||||||
@ -342,9 +342,6 @@ func (b *Blockstore) DeleteMany(cids []cid.Cid) error {
|
|||||||
return ErrBlockstoreClosed
|
return ErrBlockstoreClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
batch := b.DB.NewWriteBatch()
|
|
||||||
defer batch.Cancel()
|
|
||||||
|
|
||||||
// toReturn tracks the byte slices to return to the pool, if we're using key
|
// toReturn tracks the byte slices to return to the pool, if we're using key
|
||||||
// prefixing. we can't return each slice to the pool after each Set, because
|
// prefixing. we can't return each slice to the pool after each Set, because
|
||||||
// badger holds on to the slice.
|
// badger holds on to the slice.
|
||||||
@ -358,6 +355,9 @@ func (b *Blockstore) DeleteMany(cids []cid.Cid) error {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
batch := b.DB.NewWriteBatch()
|
||||||
|
defer batch.Cancel()
|
||||||
|
|
||||||
for _, cid := range cids {
|
for _, cid := range cids {
|
||||||
k, pooled := b.PooledStorageKey(cid)
|
k, pooled := b.PooledStorageKey(cid)
|
||||||
if pooled {
|
if pooled {
|
||||||
|
Loading…
Reference in New Issue
Block a user