HBASE-15933 NullPointerException may be thrown from SimpleRegionNormalizer#getRegionSize()
This commit is contained in:
parent
a0f49c9884
commit
cfe868d56e
|
@ -140,7 +140,9 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
|
||||||
for (int i = 0; i < tableRegions.size(); i++) {
|
for (int i = 0; i < tableRegions.size(); i++) {
|
||||||
HRegionInfo hri = tableRegions.get(i);
|
HRegionInfo hri = tableRegions.get(i);
|
||||||
long regionSize = getRegionSize(hri);
|
long regionSize = getRegionSize(hri);
|
||||||
totalSizeMb += regionSize;
|
if (regionSize > 0) {
|
||||||
|
totalSizeMb += regionSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double avgRegionSize = totalSizeMb / (double) tableRegions.size();
|
double avgRegionSize = totalSizeMb / (double) tableRegions.size();
|
||||||
|
@ -204,6 +206,10 @@ public class SimpleRegionNormalizer implements RegionNormalizer {
|
||||||
getRegionServerOfRegion(hri);
|
getRegionServerOfRegion(hri);
|
||||||
RegionLoad regionLoad = masterServices.getServerManager().getLoad(sn).
|
RegionLoad regionLoad = masterServices.getServerManager().getLoad(sn).
|
||||||
getRegionsLoad().get(hri.getRegionName());
|
getRegionsLoad().get(hri.getRegionName());
|
||||||
|
if (regionLoad == null) {
|
||||||
|
LOG.debug(hri.getRegionNameAsString() + " was not found in RegionsLoad");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return regionLoad.getStorefileSizeMB();
|
return regionLoad.getStorefileSizeMB();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue