[#1906] writecache: Do not require read-only mode in Flush

It was needed before we started to flush during transition to
`degraded` mode. Now it is confusing.

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
This commit is contained in:
Evgenii Stratonikov 2022-11-08 15:20:58 +03:00 committed by fyrchik
parent aa478f1def
commit b0e94b6a6b
4 changed files with 2 additions and 13 deletions

View file

@ -2,8 +2,6 @@ package shard
import (
"errors"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard/mode"
)
// FlushWriteCachePrm represents parameters of a `FlushWriteCache` operation.
@ -20,8 +18,7 @@ func (p *FlushWriteCachePrm) SetIgnoreErrors(ignore bool) {
// but write-cache is disabled.
var errWriteCacheDisabled = errors.New("write-cache is disabled")
// FlushWriteCache moves writecache in read-only mode and flushes all data from it.
// After the operation writecache will remain read-only mode.
// FlushWriteCache flushes all data from the write-cache.
func (s *Shard) FlushWriteCache(p FlushWriteCachePrm) error {
if !s.hasWriteCache() {
return errWriteCacheDisabled
@ -38,9 +35,5 @@ func (s *Shard) FlushWriteCache(p FlushWriteCachePrm) error {
return ErrDegradedMode
}
if err := s.writeCache.SetMode(mode.ReadOnly); err != nil {
return err
}
return s.writeCache.Flush(p.ignoreErrors)
}