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 (apache#5232)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
(cherry picked from commit b2e2abe)
(cherry picked from commit d8b9d82)
Change-Id: Iae2d47e8dbf1fd32bdd8d64ad784e6844cb4b8b7
  • Loading branch information
guluo2016 authored and Jenkins committed Jul 24, 2023
1 parent 8b18e28 commit 6c4d90e
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3862,6 +3862,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 6c4d90e

Please sign in to comment.