[#1143] shard: Introduce explicit Degraded mode

`Degraded` mode is set automatically after error counter is over the
threshold. `ReadOnly` mode can still be set by an administrator.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-03-17 14:55:25 +03:00 committed by fyrchik
parent 9eb70c18c3
commit 6472a170eb
21 changed files with 62 additions and 24 deletions

View file

@ -50,13 +50,13 @@ func (e *StorageEngine) reportShardError(
return
}
err = sh.SetMode(shard.ModeReadOnly)
err = sh.SetMode(shard.ModeDegraded)
if err != nil {
e.log.Error("failed to move shard in read-only mode",
e.log.Error("failed to move shard in degraded mode",
zap.Uint32("error count", errCount),
zap.Error(err))
} else {
e.log.Info("shard is moved in read-only due to error threshold",
e.log.Info("shard is moved in degraded mode due to error threshold",
zap.Stringer("shard_id", sh.ID()),
zap.Uint32("error count", errCount))
}