forked from TrueCloudLab/frostfs-node
[#1604] policer: Do not process the same node twice
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
84e1599997
commit
4538ccb12a
3 changed files with 5 additions and 4 deletions
|
@ -126,12 +126,11 @@ func (p *Policer) processRepNodes(ctx context.Context, requirements *placementRe
|
|||
} else {
|
||||
if status := checkedNodes.processStatus(nodes[i]); status.Processed() {
|
||||
if status == nodeHoldsObject {
|
||||
// node already contains replica, no need to replicate
|
||||
nodes = append(nodes[:i], nodes[i+1:]...)
|
||||
i--
|
||||
shortage--
|
||||
}
|
||||
|
||||
nodes = append(nodes[:i], nodes[i+1:]...)
|
||||
i--
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -155,6 +154,7 @@ func (p *Policer) processRepNodes(ctx context.Context, requirements *placementRe
|
|||
zap.Stringer("object", addr),
|
||||
zap.Error(err),
|
||||
)
|
||||
checkedNodes.set(nodes[i], nodeStatusUnknown)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ const (
|
|||
nodeNotProcessed nodeProcessStatus = iota
|
||||
nodeDoesNotHoldObject
|
||||
nodeHoldsObject
|
||||
nodeStatusUnknown
|
||||
)
|
||||
|
||||
func (st nodeProcessStatus) Processed() bool {
|
||||
|
|
|
@ -127,7 +127,7 @@ func TestProcessObject(t *testing.T) {
|
|||
nodeCount: 2,
|
||||
policy: `REP 2 REP 2`,
|
||||
placement: [][]int{{0, 1}, {0, 1}},
|
||||
wantReplicateTo: []int{1, 1}, // is this actually good?
|
||||
wantReplicateTo: []int{1},
|
||||
},
|
||||
{
|
||||
desc: "lock object must be replicated to all nodes",
|
||||
|
|
Loading…
Reference in a new issue