mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-24 17:09:48 +00:00
abs the count with prefer local
This commit is contained in:
parent
0feb1fd216
commit
180f83828a
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user