Skip to content

Commit

Permalink
HBASE-27859 HMaster.getCompactionState can happen NPE when region sta…
Browse files Browse the repository at this point in the history
…te is closed (#5232)

Signed-off-by: Duo Zhang <[email protected]>
Signed-off-by: Wellington Chevreuil <[email protected]>
  • Loading branch information
guluo2016 authored Jul 6, 2023
1 parent 047f077 commit b2e2abe
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4208,6 +4208,11 @@ public CompactionState getCompactionState(final TableName tableName) {
continue;
}
RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
if (regionMetrics == null) {
LOG.warn("Can not get compaction details for the region: {} , it may be not online.",
regionInfo.getRegionNameAsString());
continue;
}
if (regionMetrics.getCompactionState() == CompactionState.MAJOR) {
if (compactionState == CompactionState.MINOR) {
compactionState = CompactionState.MAJOR_AND_MINOR;
Expand Down

0 comments on commit b2e2abe

Please sign in to comment.