Skip to content

Commit d21b451

Browse files
saintstackJenkins
authored andcommitted
HBASE-23244 NPEs running Canary (apache#784)
Signed-off-by: Viraj Jasani <virajjasani007@gmail.com> (cherry picked from commit 81a5dc1) Change-Id: Ibe354d6be6b33676518474a96e603cbe9141a8d6
1 parent c764c2c commit d21b451

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ public Void read() {
492492
sink.publishReadTiming(serverName, region, column, stopWatch.getTime());
493493
} catch (Exception e) {
494494
sink.publishReadFailure(serverName, region, column, e);
495-
sink.updateReadFailures(region.getRegionNameAsString(), serverName.getHostname());
495+
sink.updateReadFailures(region == null? "NULL": region.getRegionNameAsString(),
496+
serverName == null? "NULL": serverName.getHostname());
496497
} finally {
497498
if (rs != null) {
498499
rs.close();
@@ -1579,6 +1580,10 @@ private static List<Future<Void>> sniff(final Admin admin, final Sink sink,
15791580
try (RegionLocator regionLocator =
15801581
admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
15811582
for (HRegionLocation location: regionLocator.getAllRegionLocations()) {
1583+
if (location == null) {
1584+
LOG.warn("Null location");
1585+
continue;
1586+
}
15821587
ServerName rs = location.getServerName();
15831588
RegionInfo region = location.getRegion();
15841589
tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink)sink,
@@ -1795,6 +1800,10 @@ private Map<String, List<RegionInfo>> getAllRegionServerByName() {
17951800
try (RegionLocator regionLocator =
17961801
this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
17971802
for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
1803+
if (location == null) {
1804+
LOG.warn("Null location");
1805+
continue;
1806+
}
17981807
ServerName rs = location.getServerName();
17991808
String rsName = rs.getHostname();
18001809
RegionInfo r = location.getRegion();

0 commit comments

Comments
 (0)