[#1022] writecache: Fix db counter decrement and flushed big object

Signed-off-by: ZhangTao1596 <zhangtao@ngd.neo.org>
This commit is contained in:
ZhangTao1596 2021-12-08 18:14:57 +08:00 committed by Alex Vanin
parent 2a031c5542
commit 1be0c42726

View file

@ -98,7 +98,6 @@ func (c *cache) deleteFromDB(keys [][]byte) error {
if len(keys) == 0 { if len(keys) == 0 {
return nil return nil
} }
var sz uint64
err := c.db.Update(func(tx *bbolt.Tx) error { err := c.db.Update(func(tx *bbolt.Tx) error {
b := tx.Bucket(defaultBucket) b := tx.Bucket(defaultBucket)
for i := range keys { for i := range keys {
@ -109,7 +108,6 @@ func (c *cache) deleteFromDB(keys [][]byte) error {
if err := b.Delete(keys[i]); err != nil { if err := b.Delete(keys[i]); err != nil {
return err return err
} }
sz += uint64(len(has))
storagelog.Write(c.log, storagelog.AddressField(string(keys[i])), storagelog.OpField("db DELETE")) storagelog.Write(c.log, storagelog.AddressField(string(keys[i])), storagelog.OpField("db DELETE"))
} }
return nil return nil
@ -117,7 +115,9 @@ func (c *cache) deleteFromDB(keys [][]byte) error {
if err != nil { if err != nil {
return err return err
} }
for range keys {
c.objCounters.DecDB() c.objCounters.DecDB()
}
return nil return nil
} }