abs the count with prefer local

This commit is contained in:
kimchy 2011-07-23 01:31:12 +03:00
parent 0feb1fd216
commit 180f83828a
1 changed files with 1 additions and 1 deletions

View File

@ -162,7 +162,7 @@ public class IndexShardRoutingTable implements Iterable<ShardRouting> {
public ShardIterator preferLocalShardsIt(String nodeId) {
ArrayList<ShardRouting> ordered = new ArrayList<ShardRouting>(this.shards.size());
// fill it in a randomized fashion
int index = counter.getAndIncrement();
int index = Math.abs(counter.getAndIncrement());
for (int i = 0; i < this.shards.size(); i++) {
int loc = (index + i) % this.shards.size();
ordered.add(this.shards.get(loc));