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

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


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 0abcb064ae3 HBASE-28144 Canary publish read failure fails with NPE if 
region location is null (#5456)
0abcb064ae3 is described below

commit 0abcb064ae368139055dca187a77853f91beebf1
Author: Viraj Jasani <vjas...@apache.org>
AuthorDate: Tue Oct 10 20:51:04 2023 -0800

    HBASE-28144 Canary publish read failure fails with NPE if region location 
is null (#5456)
    
    Signed-off-by: Wellington Chevreuil <wchevre...@apache.org>
    Signed-off-by: David Manning <david.mann...@salesforce.com>
---
 .../org/apache/hadoop/hbase/tool/CanaryTool.java   | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

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 05107960f79..95c92536567 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
@@ -323,13 +323,15 @@ public class CanaryTool implements Tool, Canary {
     }
 
     private void incFailuresCountDetails(ServerName serverName, RegionInfo 
region) {
-      perServerFailuresCount.compute(serverName, (server, count) -> {
-        if (count == null) {
-          count = new LongAdder();
-        }
-        count.increment();
-        return count;
-      });
+      if (serverName != null) {
+        perServerFailuresCount.compute(serverName, (server, count) -> {
+          if (count == null) {
+            count = new LongAdder();
+          }
+          count.increment();
+          return count;
+        });
+      }
       perTableFailuresCount.compute(region.getTable().getNameAsString(), 
(tableName, count) -> {
         if (count == null) {
           count = new LongAdder();
@@ -340,18 +342,18 @@ public class CanaryTool implements Tool, Canary {
     }
 
     public void publishReadFailure(ServerName serverName, RegionInfo region, 
Exception e) {
-      incReadFailureCount();
-      incFailuresCountDetails(serverName, region);
       LOG.error("Read from {} on serverName={} failed", 
region.getRegionNameAsString(), serverName,
         e);
+      incReadFailureCount();
+      incFailuresCountDetails(serverName, region);
     }
 
     public void publishReadFailure(ServerName serverName, RegionInfo region,
       ColumnFamilyDescriptor column, Exception e) {
-      incReadFailureCount();
-      incFailuresCountDetails(serverName, region);
       LOG.error("Read from {} on serverName={}, columnFamily={} failed",
         region.getRegionNameAsString(), serverName, column.getNameAsString(), 
e);
+      incReadFailureCount();
+      incFailuresCountDetails(serverName, region);
     }
 
     public void publishReadTiming(ServerName serverName, RegionInfo region,
@@ -368,17 +370,17 @@ public class CanaryTool implements Tool, Canary {
     }
 
     public void publishWriteFailure(ServerName serverName, RegionInfo region, 
Exception e) {
+      LOG.error("Write to {} on {} failed", region.getRegionNameAsString(), 
serverName, e);
       incWriteFailureCount();
       incFailuresCountDetails(serverName, region);
-      LOG.error("Write to {} on {} failed", region.getRegionNameAsString(), 
serverName, e);
     }
 
     public void publishWriteFailure(ServerName serverName, RegionInfo region,
       ColumnFamilyDescriptor column, Exception e) {
-      incWriteFailureCount();
-      incFailuresCountDetails(serverName, region);
       LOG.error("Write to {} on {} {} failed", region.getRegionNameAsString(), 
serverName,
         column.getNameAsString(), e);
+      incWriteFailureCount();
+      incFailuresCountDetails(serverName, region);
     }
 
     public void publishWriteTiming(ServerName serverName, RegionInfo region,

Reply via email to