forked from TrueCloudLab/frostfs-node
[#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
|
@ -2,6 +2,7 @@ package policer
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/core/container"
|
||||
"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) {
|
||||
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++ {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
|
@ -153,6 +166,8 @@ func (p *Policer) processNodes(ctx *processPlacementContext, addr oid.Address,
|
|||
ctx.needLocalCopy = true
|
||||
|
||||
shortage--
|
||||
} else if nodes[i].IsMaintenance() {
|
||||
handleMaintenance(nodes[i])
|
||||
} else {
|
||||
if status := checkedNodes.processStatus(nodes[i]); status >= 0 {
|
||||
if status == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue