forked from TrueCloudLab/frostfs-node
[#2167] write-cache: Add "write-cache" to its logs
Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
eea2892109
commit
1608fd1c07
5 changed files with 44 additions and 8 deletions
|
@ -36,14 +36,22 @@ func (c *cache) Delete(addr oid.Address) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("db DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(saddr),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("db DELETE"),
|
||||
)
|
||||
c.objCounters.DecDB()
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err := c.fsTree.Delete(common.DeletePrm{Address: addr})
|
||||
if err == nil {
|
||||
storagelog.Write(c.log, storagelog.AddressField(saddr), storagelog.OpField("fstree DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(saddr),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("fstree DELETE"),
|
||||
)
|
||||
c.objCounters.DecFS()
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,11 @@ func (c *cache) initFlushMarks() {
|
|||
|
||||
_, err := c.fsTree.Delete(prm)
|
||||
if err == nil {
|
||||
storagelog.Write(c.log, storagelog.AddressField(addr), storagelog.OpField("fstree DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(addr),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("fstree DELETE"),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +87,11 @@ func (c *cache) initFlushMarks() {
|
|||
})
|
||||
if err == nil {
|
||||
for _, j := range indices {
|
||||
storagelog.Write(c.log, zap.String("address", m[j]), storagelog.OpField("db DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
zap.String("address", m[j]),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("db DELETE"),
|
||||
)
|
||||
}
|
||||
}
|
||||
lastKey = append([]byte(m[len(m)-1]), 0)
|
||||
|
|
|
@ -53,7 +53,11 @@ func (c *cache) putSmall(obj objectInfo) error {
|
|||
return b.Put([]byte(obj.addr), obj.data)
|
||||
})
|
||||
if err == nil {
|
||||
storagelog.Write(c.log, storagelog.AddressField(obj.addr), storagelog.OpField("db PUT"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(obj.addr),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("db PUT"),
|
||||
)
|
||||
c.objCounters.IncDB()
|
||||
}
|
||||
return nil
|
||||
|
@ -77,6 +81,11 @@ func (c *cache) putBig(addr string, prm common.PutPrm) error {
|
|||
c.mtx.Unlock()
|
||||
}
|
||||
c.objCounters.IncFS()
|
||||
storagelog.Write(c.log, storagelog.AddressField(addr), storagelog.OpField("fstree PUT"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(addr),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("fstree PUT"),
|
||||
)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -109,7 +109,11 @@ func (c *cache) deleteFromDB(keys []string) []string {
|
|||
})
|
||||
for i := 0; i < errorIndex; i++ {
|
||||
c.objCounters.DecDB()
|
||||
storagelog.Write(c.log, storagelog.AddressField(keys[i]), storagelog.OpField("db DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(keys[i]),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("db DELETE"),
|
||||
)
|
||||
}
|
||||
if err != nil {
|
||||
c.log.Error("can't remove objects from the database", zap.Error(err))
|
||||
|
@ -142,7 +146,11 @@ func (c *cache) deleteFromDisk(keys []string) []string {
|
|||
copyIndex++
|
||||
continue
|
||||
} else if err == nil {
|
||||
storagelog.Write(c.log, storagelog.AddressField(keys[i]), storagelog.OpField("fstree DELETE"))
|
||||
storagelog.Write(c.log,
|
||||
storagelog.AddressField(keys[i]),
|
||||
storagelog.StorageTypeField(wcStorageType),
|
||||
storagelog.OpField("fstree DELETE"),
|
||||
)
|
||||
c.objCounters.DecFS()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,9 @@ type cache struct {
|
|||
fsTree *fstree.FSTree
|
||||
}
|
||||
|
||||
// wcStorageType is used for write-cache operations logging.
|
||||
const wcStorageType = "write-cache"
|
||||
|
||||
type objectInfo struct {
|
||||
addr string
|
||||
data []byte
|
||||
|
|
Loading…
Reference in a new issue