WIP: Morph: Add unit tests #2

Closed
dstepanov-yadro wants to merge 233 commits from TrueCloudLab/frostfs-node:master into object-3608-morph-unit-tests
Showing only changes of commit 20b84f183a - Show all commits

View file

@ -83,32 +83,28 @@ func (e *StorageEngine) setModeLoop() {
}
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()
defer e.mtx.RUnlock()
sid := sh.ID()
err := sh.SetMode(mode.DegradedReadOnly)
if err != nil {
e.log.Error(logs.EngineFailedToMoveShardInDegradedreadonlyModeMovingToReadonly,
zap.Stringer("shard_id", sid),
zap.Uint32("error count", errCount),
log.Error(logs.EngineFailedToMoveShardInDegradedreadonlyModeMovingToReadonly,
zap.Error(err))
err = sh.SetMode(mode.ReadOnly)
if err != nil {
e.log.Error(logs.EngineFailedToMoveShardInReadonlyMode,
zap.Stringer("shard_id", sid),
zap.Uint32("error count", errCount),
log.Error(logs.EngineFailedToMoveShardInReadonlyMode,
zap.Error(err))
} else {
e.log.Info(logs.EngineShardIsMovedInReadonlyModeDueToErrorThreshold,
zap.Stringer("shard_id", sid),
zap.Uint32("error count", errCount))
log.Info(logs.EngineShardIsMovedInReadonlyModeDueToErrorThreshold)
}
} else {
e.log.Info(logs.EngineShardIsMovedInDegradedModeDueToErrorThreshold,
zap.Stringer("shard_id", sid),
zap.Uint32("error count", errCount))
log.Info(logs.EngineShardIsMovedInDegradedModeDueToErrorThreshold)
}
}