HBASE-23244 NPEs running Canary (#784)
Signed-off-by: Viraj Jasani <virajjasani007@gmail.com>
This commit is contained in:
parent
b8a4504a26
commit
c58e80fbe6
|
@ -492,7 +492,8 @@ public class CanaryTool implements Tool, Canary {
|
||||||
sink.publishReadTiming(serverName, region, column, stopWatch.getTime());
|
sink.publishReadTiming(serverName, region, column, stopWatch.getTime());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
sink.publishReadFailure(serverName, region, column, e);
|
sink.publishReadFailure(serverName, region, column, e);
|
||||||
sink.updateReadFailures(region.getRegionNameAsString(), serverName.getHostname());
|
sink.updateReadFailures(region == null? "NULL": region.getRegionNameAsString(),
|
||||||
|
serverName == null? "NULL": serverName.getHostname());
|
||||||
} finally {
|
} finally {
|
||||||
if (rs != null) {
|
if (rs != null) {
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -1579,6 +1580,10 @@ public class CanaryTool implements Tool, Canary {
|
||||||
try (RegionLocator regionLocator =
|
try (RegionLocator regionLocator =
|
||||||
admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
|
admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
|
||||||
for (HRegionLocation location: regionLocator.getAllRegionLocations()) {
|
for (HRegionLocation location: regionLocator.getAllRegionLocations()) {
|
||||||
|
if (location == null) {
|
||||||
|
LOG.warn("Null location");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ServerName rs = location.getServerName();
|
ServerName rs = location.getServerName();
|
||||||
RegionInfo region = location.getRegion();
|
RegionInfo region = location.getRegion();
|
||||||
tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink)sink,
|
tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink)sink,
|
||||||
|
@ -1795,6 +1800,10 @@ public class CanaryTool implements Tool, Canary {
|
||||||
try (RegionLocator regionLocator =
|
try (RegionLocator regionLocator =
|
||||||
this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
|
this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
|
||||||
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
|
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
|
||||||
|
if (location == null) {
|
||||||
|
LOG.warn("Null location");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ServerName rs = location.getServerName();
|
ServerName rs = location.getServerName();
|
||||||
String rsName = rs.getHostname();
|
String rsName = rs.getHostname();
|
||||||
RegionInfo r = location.getRegion();
|
RegionInfo r = location.getRegion();
|
||||||
|
|
Loading…
Reference in New Issue