File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed 
server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -174,22 +174,21 @@ void run() {
174174        }
175175
176176        private  void  updateDesireBalanceMetrics (AllocationStats  allocationStats ) {
177-             var  nodesStatsAndWeights  = nodeAllocationStatsAndWeightsCalculator .nodesAllocationStatsAndWeights (
177+             var  nodeIDsToStatsAndWeights  = nodeAllocationStatsAndWeightsCalculator .nodesAllocationStatsAndWeights (
178178                allocation .metadata (),
179179                allocation .routingNodes (),
180180                allocation .clusterInfo (),
181181                desiredBalance 
182182            );
183-             Map <DiscoveryNode , NodeAllocationStatsAndWeight > filteredNodeAllocationStatsAndWeights  = new  HashMap <>(
184-                 nodesStatsAndWeights .size ()
183+             Map <DiscoveryNode , NodeAllocationStatsAndWeight > nodeToStatsAndWeights  = new  HashMap <>(
184+                 nodeIDsToStatsAndWeights .size ()
185185            );
186-             for  (var  nodeStatsAndWeight  : nodesStatsAndWeights .entrySet ()) {
186+             for  (var  nodeStatsAndWeight  : nodeIDsToStatsAndWeights .entrySet ()) {
187187                var  node  = allocation .nodes ().get (nodeStatsAndWeight .getKey ());
188-                 if  (node  != null ) {
189-                     filteredNodeAllocationStatsAndWeights .put (node , nodeStatsAndWeight .getValue ());
190-                 }
188+                 assert  node  != null ;
189+                 nodeToStatsAndWeights .put (node , nodeStatsAndWeight .getValue ());
191190            }
192-             desiredBalanceMetrics .updateMetrics (allocationStats , desiredBalance .weightsPerNode (), filteredNodeAllocationStatsAndWeights );
191+             desiredBalanceMetrics .updateMetrics (allocationStats , desiredBalance .weightsPerNode (), nodeToStatsAndWeights );
193192        }
194193
195194        private  boolean  allocateUnassignedInvariant () {
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments