From 1be0c427262d8159ded8e7a1e75c424f6b81664d Mon Sep 17 00:00:00 2001 From: ZhangTao1596 Date: Wed, 8 Dec 2021 18:14:57 +0800 Subject: [PATCH] [#1022] writecache: Fix db counter decrement and flushed big object Signed-off-by: ZhangTao1596 --- pkg/local_object_storage/writecache/storage.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/local_object_storage/writecache/storage.go b/pkg/local_object_storage/writecache/storage.go index 350c2a795..d8a79b5d9 100644 --- a/pkg/local_object_storage/writecache/storage.go +++ b/pkg/local_object_storage/writecache/storage.go @@ -98,7 +98,6 @@ func (c *cache) deleteFromDB(keys [][]byte) error { if len(keys) == 0 { return nil } - var sz uint64 err := c.db.Update(func(tx *bbolt.Tx) error { b := tx.Bucket(defaultBucket) for i := range keys { @@ -109,7 +108,6 @@ func (c *cache) deleteFromDB(keys [][]byte) error { if err := b.Delete(keys[i]); err != nil { return err } - sz += uint64(len(has)) storagelog.Write(c.log, storagelog.AddressField(string(keys[i])), storagelog.OpField("db DELETE")) } return nil @@ -117,7 +115,9 @@ func (c *cache) deleteFromDB(keys [][]byte) error { if err != nil { return err } - c.objCounters.DecDB() + for range keys { + c.objCounters.DecDB() + } return nil }