From 555bf91f2b5e6240350bc6d279f35165d4596634 Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Wed, 25 Mar 2020 00:02:54 +0100 Subject: [PATCH] HBASE-23983 Fixed Spotbugs complaint in RegionStates related to ignored return value Signed-off-by: Duo Zhang --- .../apache/hadoop/hbase/master/assignment/RegionStates.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java index 3ad61d426b75..b1c11af2b9bf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java @@ -126,7 +126,11 @@ RegionStateNode createRegionStateNode(RegionInfo regionInfo) { synchronized (regionsMapLock) { RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNode(regionInfo, regionInTransition)); - encodedRegionsMap.putIfAbsent(regionInfo.getEncodedName(), node); + + if (encodedRegionsMap.get(regionInfo.getEncodedName()) != node) { + encodedRegionsMap.put(regionInfo.getEncodedName(), node); + } + return node; } }