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

Branimir Lambov commented on CASSANDRA-11139:
---------------------------------------------

It is broken even more than that. It's getting the node per DC count instead of 
the rack count, which means that the exception in practice always fires.
The second portion is not a problem, it works just as well with the rack 
adapter since we never ask for a second replica.

Patch (tests are still running):
|[code|https://github.com/blambov/cassandra/tree/11139]|[utest|http://cassci.datastax.com/job/blambov-11139-testall/]|[dtest|http://cassci.datastax.com/job/blambov-11139-dtest/]

> New token allocator is broken
> -----------------------------
>
>                 Key: CASSANDRA-11139
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11139
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Tommy Stendahl
>            Assignee: Branimir Lambov
>
> It looks like the logic in the if statment in 
> {{TokenAllocation.getStrategy()}} is broken.
> {code}
> if (replicas >= racks)
> {...}
> else if (racks == 1)
> {...}
> else
>     throw new ConfigurationException(String.format("Token allocation failed: 
> the number of racks %d in datacenter %s is lower than its replication factor 
> %d.", racks, dc, replicas));
> {code}
> I think the first if statment should be {{(replicas <= racks)}}, otherwise 
> this will be true if we have fewer racks then replicas and I guess that 
> should result in an exception.
> Also the {{if}} and the {{else if}} blocks should change place, it should be
> {code}
> if (racks == 1)
> {...}
> else if (replicas <= racks)
> {...}
> else
> {code}
> If {{replicas==1}} and {{racks==1}} I think you want the {{StrategyAdapter}} 
> from {{(racks==1)}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to