[ 
https://issues.apache.org/jira/browse/SOLR-14409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17084714#comment-17084714
 ] 

Andrzej Bialecki commented on SOLR-14409:
-----------------------------------------

This patch illustrates the problem.

This may be a bug in {{AddReplicaSuggester}} or in {{Suggester.isLessSerious / 
containsNewErrors}} .

{{AddReplicaSuggester}} tries all nodes but they all produce new violations - 
except for the one that already has a violation. So for all other nodes the 
condition in {{AddReplicaSuggester:55 if (!containsNewErrors(errs))}} is always 
false because they produce new errors. As a side-effect of this the variable 
{{leastSeriousViolation}} is never assigned.

Finally, for the node that already has a violation the change does not produce 
a new violation, it only increases the severity of the existing one - but the 
code doesn't check this because {{leastSeriousViolation}} is null, so it treats 
the current error as the least serious.

This may be the conceptual problem here - if there were no other errors then 
shouldn't the current errors be the most serious? but in this case there's 
already a pre-existing violation on this node so perhaps the 
{{leastSeriousViolation}} should always be initialized with the existing 
violations? (I tried it and many unit tests started failing...)

> Existing violations allow bypassing policy rules when adding new replicas
> -------------------------------------------------------------------------
>
>                 Key: SOLR-14409
>                 URL: https://issues.apache.org/jira/browse/SOLR-14409
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: AutoScaling
>    Affects Versions: master (9.0), 8.5, 8.6
>            Reporter: Andrzej Bialecki
>            Assignee: Andrzej Bialecki
>            Priority: Major
>         Attachments: SOLR-14409.patch
>
>
> Steps to reproduce:
>  * start with an empty cluster policy.
>  * create a collection with as many replicas as there are nodes.
>  * add one more replica to any node. Now this node has two replicas, all 
> other nodes have one. 
>  * define the following cluster policy:
> {code:java}
> { 'set-cluster-policy': [ {'replica': '<2', 'shard': '#ANY', 'node': '#ANY', 
> 'strict': true} ] } {code}
> This automatically creates a violation because of the existing layout.
>  * try adding one more replica. This should fail because no node satisfies 
> the rules (there must be at most 1 replica per node). However, the command 
> succeeds and adds replica to the node that already has 2 replicas, which 
> clearly violates the policy and makes matters even worse.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to