File tree Expand file tree Collapse file tree 1 file changed +2
-16
lines changed
core/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change @@ -892,7 +892,6 @@ public boolean containsShard(ShardRouting shard) {
892
892
static final class ModelIndex {
893
893
private final String id ;
894
894
private final Map <ShardRouting , Decision > shards = new HashMap <>();
895
- private int numPrimaries = -1 ;
896
895
private int highestPrimary = -1 ;
897
896
898
897
public ModelIndex (String id ) {
@@ -924,26 +923,13 @@ public Collection<ShardRouting> getAllShards() {
924
923
return shards .keySet ();
925
924
}
926
925
927
- public int numPrimaries () {
928
- if (numPrimaries == -1 ) {
929
- int num = 0 ;
930
- for (ShardRouting shard : shards .keySet ()) {
931
- if (shard .primary ()) {
932
- num ++;
933
- }
934
- }
935
- return numPrimaries = num ;
936
- }
937
- return numPrimaries ;
938
- }
939
-
940
926
public Decision removeShard (ShardRouting shard ) {
941
- highestPrimary = numPrimaries = -1 ;
927
+ highestPrimary = -1 ;
942
928
return shards .remove (shard );
943
929
}
944
930
945
931
public void addShard (ShardRouting shard , Decision decision ) {
946
- highestPrimary = numPrimaries = -1 ;
932
+ highestPrimary = -1 ;
947
933
assert decision != null ;
948
934
assert !shards .containsKey (shard ) : "Shard already allocated on current node: " + shards .get (shard ) + " " + shard ;
949
935
shards .put (shard , decision );
You can’t perform that action at this time.
0 commit comments