bharathv commented on a change in pull request #809: HBASE-23261 : Processing 
ZK BadVersionException during node transition
URL: https://github.com/apache/hbase/pull/809#discussion_r344329475
 
 

 ##########
 File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAssign.java
 ##########
 @@ -868,7 +868,15 @@ public static int transitionNode(ZooKeeperWatcher zkw, 
HRegionInfo region,
     try {
       rt = RegionTransition.createRegionTransition(
           endState, region.getRegionName(), serverName, payload);
-      if(!ZKUtil.setData(zkw, node, rt.toByteArray(), stat.getVersion())) {
+      boolean isDataSet;
+      try {
+        isDataSet = ZKUtil.setData(zkw, node, rt.toByteArray(), 
stat.getVersion());
+      } catch (KeeperException.BadVersionException e) {
 
 Review comment:
   Looking at all the callers of this, it appears to me that 
BadVersionException needs to be handled in setData(). Currently every call to 
this has this pattern,
   
   try {
   setData()
   } catch (BadVersionException e) {
   }
   
   Instead handle it in setData() and refactor the callers to read the return 
val? (on a related note, the javadoc for setData() seems incorrect. (===> If 
their is a version mismatch, method returns null).
   
   I don't have much context here but it seems reasonable to me that setData() 
should gracefully handle version mismatches.

----------------------------------------------------------------
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

Reply via email to