Skip to content

Commit b2e2abe

Browse files
authored
HBASE-27859 HMaster.getCompactionState can happen NPE when region state is closed (#5232)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
1 parent 047f077 commit b2e2abe

File tree

1 file changed

+5
-0
lines changed
  • hbase-server/src/main/java/org/apache/hadoop/hbase/master

1 file changed

+5
-0
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4208,6 +4208,11 @@ public CompactionState getCompactionState(final TableName tableName) {
42084208
continue;
42094209
}
42104210
RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
4211+
if (regionMetrics == null) {
4212+
LOG.warn("Can not get compaction details for the region: {} , it may be not online.",
4213+
regionInfo.getRegionNameAsString());
4214+
continue;
4215+
}
42114216
if (regionMetrics.getCompactionState() == CompactionState.MAJOR) {
42124217
if (compactionState == CompactionState.MINOR) {
42134218
compactionState = CompactionState.MAJOR_AND_MINOR;

0 commit comments

Comments
 (0)