Skip to content

Commit

Permalink
HBASE-28144 Canary publish read failure fails with NPE if region loca…
Browse files Browse the repository at this point in the history
…tion is null (apache#5456)

Signed-off-by: Wellington Chevreuil <[email protected]>
Signed-off-by: David Manning <[email protected]>
  • Loading branch information
virajjasani committed Oct 11, 2023
1 parent 736595f commit dd13e64
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,15 @@ public void resetFailuresCountDetails() {
}

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();
Expand All @@ -340,18 +342,18 @@ private void incFailuresCountDetails(ServerName serverName, RegionInfo region) {
}

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,
Expand All @@ -368,17 +370,17 @@ public void publishReadTiming(ServerName serverName, RegionInfo region,
}

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,
Expand Down

0 comments on commit dd13e64

Please sign in to comment.