File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2828import  org .apache .hadoop .conf .Configuration ;
2929import  org .apache .hadoop .hbase .HBaseInterfaceAudience ;
3030import  org .apache .hadoop .hbase .RegionMetrics ;
31+ import  org .apache .hadoop .hbase .ServerMetrics ;
3132import  org .apache .hadoop .hbase .ServerName ;
3233import  org .apache .hadoop .hbase .Size ;
3334import  org .apache .hadoop .hbase .TableName ;
@@ -256,8 +257,16 @@ public List<NormalizationPlan> computePlansForTable(final TableName table) {
256257  private  long  getRegionSizeMB (RegionInfo  hri ) {
257258    ServerName  sn  =
258259      masterServices .getAssignmentManager ().getRegionStates ().getRegionServerOfRegion (hri );
259-     RegionMetrics  regionLoad  =
260-       masterServices .getServerManager ().getLoad (sn ).getRegionMetrics ().get (hri .getRegionName ());
260+     if  (sn  == null ) {
261+       LOG .debug ("{} region was not found on any Server" , hri .getRegionNameAsString ());
262+       return  -1 ;
263+     }
264+     ServerMetrics  serverMetrics  = masterServices .getServerManager ().getLoad (sn );
265+     if  (serverMetrics  == null ) {
266+       LOG .debug ("server {} was not found in ServerManager" , sn .getServerName ());
267+       return  -1 ;
268+     }
269+     RegionMetrics  regionLoad  = serverMetrics .getRegionMetrics ().get (hri .getRegionName ());
261270    if  (regionLoad  == null ) {
262271      LOG .debug ("{} was not found in RegionsLoad" , hri .getRegionNameAsString ());
263272      return  -1 ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments