forked from TrueCloudLab/frostfs-node
[#446] engine: Simplify logs for shard mode change
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
69b788a90b
commit
20b84f183a
1 changed files with 9 additions and 13 deletions
|
@ -83,32 +83,28 @@ func (e *StorageEngine) setModeLoop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *StorageEngine) moveToDegraded(sh *shard.Shard, errCount uint32) {
|
func (e *StorageEngine) moveToDegraded(sh *shard.Shard, errCount uint32) {
|
||||||
|
sid := sh.ID()
|
||||||
|
log := e.log.With(
|
||||||
|
zap.Stringer("shard_id", sid),
|
||||||
|
zap.Uint32("error count", errCount))
|
||||||
|
|
||||||
e.mtx.RLock()
|
e.mtx.RLock()
|
||||||
defer e.mtx.RUnlock()
|
defer e.mtx.RUnlock()
|
||||||
|
|
||||||
sid := sh.ID()
|
|
||||||
err := sh.SetMode(mode.DegradedReadOnly)
|
err := sh.SetMode(mode.DegradedReadOnly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.log.Error(logs.EngineFailedToMoveShardInDegradedreadonlyModeMovingToReadonly,
|
log.Error(logs.EngineFailedToMoveShardInDegradedreadonlyModeMovingToReadonly,
|
||||||
zap.Stringer("shard_id", sid),
|
|
||||||
zap.Uint32("error count", errCount),
|
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
|
|
||||||
err = sh.SetMode(mode.ReadOnly)
|
err = sh.SetMode(mode.ReadOnly)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.log.Error(logs.EngineFailedToMoveShardInReadonlyMode,
|
log.Error(logs.EngineFailedToMoveShardInReadonlyMode,
|
||||||
zap.Stringer("shard_id", sid),
|
|
||||||
zap.Uint32("error count", errCount),
|
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
} else {
|
} else {
|
||||||
e.log.Info(logs.EngineShardIsMovedInReadonlyModeDueToErrorThreshold,
|
log.Info(logs.EngineShardIsMovedInReadonlyModeDueToErrorThreshold)
|
||||||
zap.Stringer("shard_id", sid),
|
|
||||||
zap.Uint32("error count", errCount))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
e.log.Info(logs.EngineShardIsMovedInDegradedModeDueToErrorThreshold,
|
log.Info(logs.EngineShardIsMovedInDegradedModeDueToErrorThreshold)
|
||||||
zap.Stringer("shard_id", sid),
|
|
||||||
zap.Uint32("error count", errCount))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue