[#1680] replicator: Consider nodes under maintenance as OK
Nodes under maintenance SHOULD not respond to object requests. Based on this, storage node's Policer SHOULD consider such nodes as problem ones. However, to prevent spam with the new replicas, on the contrary, Policer should consider them normal. Make `Policer.processNodes` to exclude elements if `IsMaintenance()` with shortage decreasing. Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
This commit is contained in:
parent
df5d7bf729
commit
e99e25b52f
2 changed files with 16 additions and 0 deletions
|
@ -23,6 +23,7 @@ Changelog for NeoFS Node
|
||||||
- Allow to evacuate shard data with `EvacuateShard` control RPC (#1800)
|
- Allow to evacuate shard data with `EvacuateShard` control RPC (#1800)
|
||||||
- Flush write-cache when moving shard to DEGRADED mode (#1825)
|
- Flush write-cache when moving shard to DEGRADED mode (#1825)
|
||||||
- Make `morph.cache_ttl` default value equal to morph block time (#1846)
|
- Make `morph.cache_ttl` default value equal to morph block time (#1846)
|
||||||
|
- Policer marks nodes under maintenance as OK without requests (#1680)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Description of command `netmap nodeinfo` (#1821)
|
- Description of command `netmap nodeinfo` (#1821)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package policer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
||||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/engine"
|
||||||
|
@ -142,6 +143,18 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr oid.Address,
|
||||||
nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) {
|
nodes []netmap.NodeInfo, shortage uint32, checkedNodes *nodeCache) {
|
||||||
prm := new(headsvc.RemoteHeadPrm).WithObjectAddress(addr)
|
prm := new(headsvc.RemoteHeadPrm).WithObjectAddress(addr)
|
||||||
|
|
||||||
|
handleMaintenance := func(node netmap.NodeInfo) {
|
||||||
|
// consider remote nodes under maintenance as problem OK. Such
|
||||||
|
// nodes MAY not respond with object, however, this is how we
|
||||||
|
// prevent spam with new replicas.
|
||||||
|
checkedNodes.submitReplicaHolder(node)
|
||||||
|
shortage--
|
||||||
|
|
||||||
|
p.log.Debug("consider node under maintenance as OK",
|
||||||
|
zap.String("node", hex.EncodeToString(node.PublicKey())),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
for i := 0; shortage > 0 && i < len(nodes); i++ {
|
for i := 0; shortage > 0 && i < len(nodes); i++ {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
@ -153,6 +166,8 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr oid.Address,
|
||||||
ctx.needLocalCopy = true
|
ctx.needLocalCopy = true
|
||||||
|
|
||||||
shortage--
|
shortage--
|
||||||
|
} else if nodes[i].IsMaintenance() {
|
||||||
|
handleMaintenance(nodes[i])
|
||||||
} else {
|
} else {
|
||||||
if status := checkedNodes.processStatus(nodes[i]); status >= 0 {
|
if status := checkedNodes.processStatus(nodes[i]); status >= 0 {
|
||||||
if status == 0 {
|
if status == 0 {
|
||||||
|
|
Loading…
Reference in a new issue