reddycharan commented on a change in pull request #2097: [Bk-Client] Check 
empty ledger-parent node while deleting ledger
URL: https://github.com/apache/bookkeeper/pull/2097#discussion_r284502059
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ZkUtils.java
 ##########
 @@ -134,8 +134,21 @@ public static void asyncDeleteFullPathOptimistic(final 
ZooKeeper zk, final Strin
             public void processResult(int rc, String path, Object ctx) {
                 if (rc == Code.OK.intValue()) {
                     String parent = new 
File(originalPath).getParent().replace("\\", "/");
-                    asyncDeleteFullPathOptimistic(zk, parent, -1, callback, 
leafNodePath);
+                    zk.getData(parent, false, (dRc, dPath, dCtx, data, stat) 
-> {
+                        if (Code.OK.intValue() == dRc && (stat != null && 
stat.getNumChildren() == 0)) {
+                            asyncDeleteFullPathOptimistic(zk, parent, -1, 
callback, leafNodePath);
+                        } else {
+                            // parent node is not empty so, complete the
+                            // callback
+                            if (path.equals(leafNodePath)) {
 
 Review comment:
   wondering what is the difference between the if/else cases here? since rc is 
OK here, will it not be the same?

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