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 <zhangduo@apache.org>
Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
(cherry picked from commit b2e2abe)
  • Loading branch information
guluo2016 authored and Apache9 committed Jul 6, 2023
1 parent c4a1b44 commit de37c4c
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4146,6 +4146,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 de37c4c

Please sign in to comment.