Browse Source

Remove total and active shard count from RoutingNodes (#87617)

These are not used any longer.
Armin Braun 3 years ago
parent
commit
a78616184e

+ 0 - 22
server/src/main/java/org/elasticsearch/cluster/routing/RoutingNodes.java

@@ -74,10 +74,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
 
 
     private int relocatingShards = 0;
     private int relocatingShards = 0;
 
 
-    private int activeShardCount = 0;
-
-    private int totalShardCount = 0;
-
     private final Map<String, Set<String>> attributeValuesByAttribute;
     private final Map<String, Set<String>> attributeValuesByAttribute;
     private final Map<String, Recoveries> recoveriesPerNode;
     private final Map<String, Recoveries> recoveriesPerNode;
 
 
@@ -116,7 +112,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
                 assert indexShard.primary != null;
                 assert indexShard.primary != null;
                 for (int copy = 0; copy < indexShard.size(); copy++) {
                 for (int copy = 0; copy < indexShard.size(); copy++) {
                     final ShardRouting shard = indexShard.shard(copy);
                     final ShardRouting shard = indexShard.shard(copy);
-                    totalShardCount++;
                     // to get all the shards belonging to an index, including the replicas,
                     // to get all the shards belonging to an index, including the replicas,
                     // we define a replica set and keep track of it. A replica set is identified
                     // we define a replica set and keep track of it. A replica set is identified
                     // by the ShardId, as this is common for primary and replicas.
                     // by the ShardId, as this is common for primary and replicas.
@@ -125,9 +120,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
                         // LinkedHashMap to preserve order
                         // LinkedHashMap to preserve order
                         nodesToShards.computeIfAbsent(shard.currentNodeId(), createRoutingNode).add(shard);
                         nodesToShards.computeIfAbsent(shard.currentNodeId(), createRoutingNode).add(shard);
                         assignedShardsAdd(shard);
                         assignedShardsAdd(shard);
-                        if (shard.active()) {
-                            activeShardCount++;
-                        }
                         if (shard.relocating()) {
                         if (shard.relocating()) {
                             relocatingShards++;
                             relocatingShards++;
                             ShardRouting targetShardRouting = shard.getTargetRelocatingShard();
                             ShardRouting targetShardRouting = shard.getTargetRelocatingShard();
@@ -169,8 +161,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
         this.inactivePrimaryCount = routingNodes.inactivePrimaryCount;
         this.inactivePrimaryCount = routingNodes.inactivePrimaryCount;
         this.inactiveShardCount = routingNodes.inactiveShardCount;
         this.inactiveShardCount = routingNodes.inactiveShardCount;
         this.relocatingShards = routingNodes.relocatingShards;
         this.relocatingShards = routingNodes.relocatingShards;
-        this.activeShardCount = routingNodes.activeShardCount;
-        this.totalShardCount = routingNodes.totalShardCount;
         this.attributeValuesByAttribute = Maps.newMapWithExpectedSize(routingNodes.attributeValuesByAttribute.size());
         this.attributeValuesByAttribute = Maps.newMapWithExpectedSize(routingNodes.attributeValuesByAttribute.size());
         for (Map.Entry<String, Set<String>> entry : routingNodes.attributeValuesByAttribute.entrySet()) {
         for (Map.Entry<String, Set<String>> entry : routingNodes.attributeValuesByAttribute.entrySet()) {
             this.attributeValuesByAttribute.put(entry.getKey(), new HashSet<>(entry.getValue()));
             this.attributeValuesByAttribute.put(entry.getKey(), new HashSet<>(entry.getValue()));
@@ -323,14 +313,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
         return relocatingShards;
         return relocatingShards;
     }
     }
 
 
-    public int getActiveShardCount() {
-        return activeShardCount;
-    }
-
-    public int getTotalShardCount() {
-        return totalShardCount;
-    }
-
     /**
     /**
      * Returns all shards that are not in the state UNASSIGNED with the same shard
      * Returns all shards that are not in the state UNASSIGNED with the same shard
      * ID as the given shard.
      * ID as the given shard.
@@ -870,8 +852,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
             && inactivePrimaryCount == that.inactivePrimaryCount
             && inactivePrimaryCount == that.inactivePrimaryCount
             && inactiveShardCount == that.inactiveShardCount
             && inactiveShardCount == that.inactiveShardCount
             && relocatingShards == that.relocatingShards
             && relocatingShards == that.relocatingShards
-            && activeShardCount == that.activeShardCount
-            && totalShardCount == that.totalShardCount
             && nodesToShards.equals(that.nodesToShards)
             && nodesToShards.equals(that.nodesToShards)
             && unassignedShards.equals(that.unassignedShards)
             && unassignedShards.equals(that.unassignedShards)
             && assignedShards.equals(that.assignedShards)
             && assignedShards.equals(that.assignedShards)
@@ -889,8 +869,6 @@ public class RoutingNodes extends AbstractCollection<RoutingNode> {
             inactivePrimaryCount,
             inactivePrimaryCount,
             inactiveShardCount,
             inactiveShardCount,
             relocatingShards,
             relocatingShards,
-            activeShardCount,
-            totalShardCount,
             attributeValuesByAttribute,
             attributeValuesByAttribute,
             recoveriesPerNode
             recoveriesPerNode
         );
         );