Apache9 commented on a change in pull request #1287: HBASE-23983 Fixed Spotbugs
complaint in RegionStates related to ignored return value
URL: https://github.com/apache/hbase/pull/1287#discussion_r392545075
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java
##########
@@ -130,8 +130,7 @@ RegionStateNode createRegionStateNode(RegionInfo
regionInfo) {
synchronized (regionsMapLock) {
RegionStateNode node =
regionsMap.computeIfAbsent(regionInfo.getRegionName(),
key -> new RegionStateNode(regionInfo, regionInTransition));
- encodedRegionsMap.putIfAbsent(regionInfo.getEncodedName(), node);
- return node;
+ return encodedRegionsMap.putIfAbsent(regionInfo.getEncodedName(), node);
Review comment:
This is not correct, if there is no value yet putIfAbsent will returns
null...
And here I think we could add an assert, that putIfAbsent should always
return null, and then return the node above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services