[#790] writecache: Log each writing operation

Call `storagelog.Write` in all places after the successful writing op.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-06 17:28:55 +03:00 committed by Leonard Lyubich
parent 4f73c00776
commit 3258d9c616
5 changed files with 27 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import (
objectSDK "github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-node/pkg/core/object"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/fstree"
storagelog "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/internal/log"
"go.etcd.io/bbolt"
)
@ -21,6 +22,7 @@ func (c *cache) Delete(addr *objectSDK.Address) error {
c.mem = c.mem[:len(c.mem)-1]
c.curMemSize -= uint64(len(c.mem[i].data))
c.mtx.Unlock()
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("in-mem DELETE"))
return nil
}
}
@ -44,6 +46,7 @@ func (c *cache) Delete(addr *objectSDK.Address) error {
return err
}
c.dbSize.Sub(uint64(has))
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("db DELETE"))
return nil
}
@ -52,5 +55,9 @@ func (c *cache) Delete(addr *objectSDK.Address) error {
err = object.ErrNotFound
}
if err == nil {
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("fstree DELETE"))
}
return err
}