forked from TrueCloudLab/frostfs-node
[#959] writecache: Avoid manipulation with cache in DEGRADED
mode
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
d433b49265
commit
3195142d67
6 changed files with 35 additions and 1 deletions
|
@ -155,7 +155,7 @@ func (c *cache) workerFlushBig(ctx context.Context) {
|
|||
select {
|
||||
case <-tick.C:
|
||||
c.modeMtx.RLock()
|
||||
if c.readOnly() {
|
||||
if c.readOnly() || c.noMetabase() {
|
||||
c.modeMtx.RUnlock()
|
||||
break
|
||||
}
|
||||
|
@ -281,6 +281,9 @@ func (c *cache) Flush(ctx context.Context, ignoreErrors, seal bool) error {
|
|||
|
||||
c.modeMtx.Lock() // exclusive lock to not to conflict with background flush
|
||||
defer c.modeMtx.Unlock()
|
||||
if c.noMetabase() {
|
||||
return ErrDegraded
|
||||
}
|
||||
|
||||
if err := c.flush(ctx, ignoreErrors); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue