[#1088] writecache: Fix small flushed when persist

Signed-off-by: ZhangTao1596 <zhangtao@ngd.neo.org>
This commit is contained in:
ZhangTao1596 2022-01-19 17:51:58 +08:00 committed by fyrchik
parent 7c02a2e251
commit ac82899e85

View file

@ -79,12 +79,14 @@ func (c *cache) persistSmallObjects(objs []objectInfo) {
if err != nil { if err != nil {
overflowIndex = 0 overflowIndex = 0
} else { } else {
c.evictObjects(overflowIndex) c.evictObjects(len(objs) - overflowIndex)
} }
for i := 0; i < overflowIndex; i++ { for i := 0; i < overflowIndex; i++ {
storagelog.Write(c.log, storagelog.AddressField(objs[i].addr), storagelog.OpField("db PUT")) storagelog.Write(c.log, storagelog.AddressField(objs[i].addr), storagelog.OpField("db PUT"))
c.objCounters.IncDB() c.objCounters.IncDB()
}
for i := overflowIndex; i < len(objs); i++ {
c.flushed.Add(objs[i].addr, true) c.flushed.Add(objs[i].addr, true)
} }