[#585] writecache: Fix DB counter
Some checks failed
DCO action / DCO (pull_request) Successful in 2m14s
Vulncheck / Vulncheck (pull_request) Successful in 2m44s
Build / Build Components (1.21) (pull_request) Successful in 2m54s
Build / Build Components (1.20) (pull_request) Successful in 3m5s
Tests and linters / Staticcheck (pull_request) Successful in 3m43s
Tests and linters / Lint (pull_request) Successful in 5m12s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m44s
Tests and linters / Tests (1.20) (pull_request) Successful in 21m5s
Tests and linters / Tests with -race (pull_request) Failing after 26m26s
Some checks failed
DCO action / DCO (pull_request) Successful in 2m14s
Vulncheck / Vulncheck (pull_request) Successful in 2m44s
Build / Build Components (1.21) (pull_request) Successful in 2m54s
Build / Build Components (1.20) (pull_request) Successful in 3m5s
Tests and linters / Staticcheck (pull_request) Successful in 3m43s
Tests and linters / Lint (pull_request) Successful in 5m12s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m44s
Tests and linters / Tests (1.20) (pull_request) Successful in 21m5s
Tests and linters / Tests with -race (pull_request) Failing after 26m26s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
58c8722c81
commit
2efe9cc1be
3 changed files with 31 additions and 5 deletions
|
@ -2,6 +2,7 @@ package writecachebbolt
|
|||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/blobstor/common"
|
||||
|
@ -49,9 +50,12 @@ func (c *cache) Delete(ctx context.Context, addr oid.Address) error {
|
|||
|
||||
if dataSize > 0 {
|
||||
storageType = writecache.StorageTypeDB
|
||||
var recordDeleted bool
|
||||
err := c.db.Update(func(tx *bbolt.Tx) error {
|
||||
b := tx.Bucket(defaultBucket)
|
||||
err := b.Delete([]byte(saddr))
|
||||
key := []byte(saddr)
|
||||
recordDeleted = b.Get(key) != nil
|
||||
err := b.Delete(key)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -62,6 +66,10 @@ func (c *cache) Delete(ctx context.Context, addr oid.Address) error {
|
|||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("db DELETE"),
|
||||
)
|
||||
if recordDeleted {
|
||||
c.objCounters.cDB.Add(math.MaxUint64)
|
||||
c.estimateCacheSize()
|
||||
}
|
||||
deleted = true
|
||||
return nil
|
||||
}
|
||||
|
@ -75,7 +83,7 @@ func (c *cache) Delete(ctx context.Context, addr oid.Address) error {
|
|||
storagelog.OpField("fstree DELETE"),
|
||||
)
|
||||
deleted = true
|
||||
c.estimateCacheSize()
|
||||
}
|
||||
|
||||
return metaerr.Wrap(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue