forked from TrueCloudLab/frostfs-node
[#1118] services/control: allow to reset error counter in SetShardMode
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
6ad2624552
commit
7fb15fa1d0
7 changed files with 147 additions and 104 deletions
|
@ -118,12 +118,15 @@ func (e *StorageEngine) iterateOverUnsortedShards(handler func(hashedShard) (sto
|
|||
// SetShardMode sets mode of the shard with provided identifier.
|
||||
//
|
||||
// Returns an error if shard mode was not set, or shard was not found in storage engine.
|
||||
func (e *StorageEngine) SetShardMode(id *shard.ID, m shard.Mode) error {
|
||||
func (e *StorageEngine) SetShardMode(id *shard.ID, m shard.Mode, resetErrorCounter bool) error {
|
||||
e.mtx.RLock()
|
||||
defer e.mtx.RUnlock()
|
||||
|
||||
for shID, sh := range e.shards {
|
||||
if id.String() == shID {
|
||||
if resetErrorCounter {
|
||||
sh.errorCount.Store(0)
|
||||
}
|
||||
return sh.SetMode(m)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue