[#1028] writecache: Mark big objects as flushed after write
Make `flushBigObjects` routine to mark objects which are written to `BlobStor`. This prevents already flushed objects from being written on the next iterator tick. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
bd4d17ef9e
commit
d246e5193b
1 changed files with 8 additions and 1 deletions
|
@ -117,13 +117,20 @@ func (c *cache) flushBigObjects() {
|
|||
select {
|
||||
case <-tick.C:
|
||||
_ = c.fsTree.Iterate(func(addr *objectSDK.Address, data []byte) error {
|
||||
if _, ok := c.store.flushed.Peek(addr.String()); ok {
|
||||
sAddr := addr.String()
|
||||
|
||||
if _, ok := c.store.flushed.Peek(sAddr); ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, err := c.blobstor.PutRaw(addr, data); err != nil {
|
||||
c.log.Error("cant flush object to blobstor", zap.Error(err))
|
||||
return nil
|
||||
}
|
||||
|
||||
// mark object as flushed
|
||||
c.store.flushed.Add(sAddr, false)
|
||||
|
||||
return nil
|
||||
})
|
||||
case <-c.closeCh:
|
||||
|
|
Loading…
Reference in a new issue