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

Michael W Moser edited comment on NIFI-14959 at 9/22/25 7:49 PM:
-----------------------------------------------------------------

I was able to confirm this bug on a 3-node cluster. "Partition by attribute" 
load balance strategy was only distributing flowfiles to 2 nodes, while 
favoring 1 of the nodes. The node at index 0 received roughly 2/N flowfiles, 
one node received 0 flowfiles, and the other nodes received 1/N flowfiles

Rather than modifying the input to the findIndex() method, perhaps we can fix 
the findIndex method itself.

[edit] - I tested this using attribute values based on 
{{{}$\{literal("A"):repeat(1,9){}}}} which can produce 9 unique values that I'm 
fairly certain would place at least some files in all 3 buckets of the load 
balance strategy.


was (Author: mosermw):
I was able to confirm this bug on a 3-node cluster.  "Partition by attribute" 
load balance strategy was only distributing flowfiles to 2 nodes, while 
favoring 1 of the nodes.  The node at index 0 received roughly 2/N flowfiles, 
one node received 0 flowfiles, and the other nodes received 1/N flowfiles

Rather than modifying the input to the findIndex() method, perhaps we can fix 
the findIndex method itself.

> Partition by attribute load balance strategy favors 1 node with more files
> --------------------------------------------------------------------------
>
>                 Key: NIFI-14959
>                 URL: https://issues.apache.org/jira/browse/NIFI-14959
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Andreas Koch
>            Assignee: Michael W Moser
>            Priority: Major
>
> CorrelationAttributePartitioner.findIndex always returns 0 if partitions == 2
> Ways to reproduce. Added static to findIndex
>  
> {code:java}
> for (int i = Integer.MIN_VALUE; i  < Integer.MAX_VALUE; i++) {
>    int idx = findIndex(i, 2);   
>    if (idx != 0) {
>       System.out.println(i);
>    }            
> } {code}
> Assuming the attribute value for "Partition by attribute" would result in an 
> even distribution, the node at index 0 receives roughly 2/N flowfiles, one 
> node receives 0 flowfiles, and the other nodes receive 1/N flowfiles.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to