You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2019/11/02 04:42:01 UTC

[hbase] branch branch-2.1 updated: HBASE-23244 NPEs running Canary (#784)

This is an automated email from the ASF dual-hosted git repository.

stack pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new fce2fd9  HBASE-23244 NPEs running Canary (#784)
fce2fd9 is described below

commit fce2fd97dd5388dd43f0819acbdd8148a8a7834d
Author: Michael Stack <sa...@users.noreply.github.com>
AuthorDate: Fri Nov 1 21:40:23 2019 -0700

    HBASE-23244 NPEs running Canary (#784)
    
    Signed-off-by: Viraj Jasani <vi...@gmail.com>
---
 .../main/java/org/apache/hadoop/hbase/tool/CanaryTool.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
index 69bfbe3..8b462c6 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/tool/CanaryTool.java
@@ -492,7 +492,8 @@ public class CanaryTool implements Tool, Canary {
           sink.publishReadTiming(serverName, region, column, stopWatch.getTime());
         } catch (Exception 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 {
           if (rs != null) {
             rs.close();
@@ -1580,6 +1581,10 @@ public class CanaryTool implements Tool, Canary {
       try (RegionLocator regionLocator =
                admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
         for (HRegionLocation location: regionLocator.getAllRegionLocations()) {
+          if (location == null) {
+            LOG.warn("Null location");
+            continue;
+          }
           ServerName rs = location.getServerName();
           RegionInfo region = location.getRegion();
           tasks.add(new RegionTask(admin.getConnection(), region, rs, (RegionStdOutSink)sink,
@@ -1796,6 +1801,10 @@ public class CanaryTool implements Tool, Canary {
           try (RegionLocator regionLocator =
                    this.admin.getConnection().getRegionLocator(tableDesc.getTableName())) {
             for (HRegionLocation location : regionLocator.getAllRegionLocations()) {
+              if (location == null) {
+                LOG.warn("Null location");
+                continue;
+              }
               ServerName rs = location.getServerName();
               String rsName = rs.getHostname();
               RegionInfo r = location.getRegion();