You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by zh...@apache.org on 2019/05/17 07:39:18 UTC

[bookkeeper] branch master updated: [BK-CLIENT] Check empty ledger-parent node while deleting ledger

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 335c2ab  [BK-CLIENT] Check empty ledger-parent node while deleting ledger
335c2ab is described below

commit 335c2aba9bfd24eff224f1afae393026c17a2d5a
Author: Rajan Dhabalia <rd...@apache.org>
AuthorDate: Fri May 17 00:39:12 2019 -0700

    [BK-CLIENT] Check empty ledger-parent node while deleting ledger
    
    ### Motivation
    
    As discussed at [#4276](https://github.com/apache/pulsar/issues/4276), while deleting ledger, bk-client should check parent node is empty before issuing delete request for parent znode.
    
    
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Charan Reddy Guttapalem <re...@gmail.com>, Matteo Merli <mm...@apache.org>
    
    This closes #2097 from rdhabalia/led_del and squashes the following commits:
    
    f5c0ca36c [rdhabalia] return callback with ok
    ede5e9403 [rdhabalia] [Bk-Client] Check empty ledger-parent node while deleting ledger
    d35aa22ad [Charan Reddy Guttapalem] Move common placementpolicy components to TopologyAwareEnsemblePlacementPolicy.
    b4ca4537b [Charan Reddy Guttapalem] Move common placementpolicy components to TopologyAwareEnsemblePlacementPolicy.
    aa84c7fdd [Charan Reddy Guttapalem] GetListOfEntriesOfLedger implementation
    10859afb7 [Matteo Merli] Added HTTP handler to expose bookie state
    707ae5c85 [karanmehta93] ISSUE #2075: Bookieshell lastmark command isn't functional, always returning 0-0
    41b39c6ef [Charan Reddy Guttapalem] ISSUE #1967: make ledger creation and removal robust to zk connectionloss
    973d2ab0d [Matteo Merli] Use pure python implementation of MurmurHash
    9bb7e4b82 [Venkateswararao Jujjuri (JV)] Explicit error message if extent is not present on ZK (#2066)
    bd699e61d [mtang01] ISSUE #2067: reduce byte[] allocation in add entry
    7c62e1232 [karanmehta93] ISSUE #2073: ReadOnlyBookieTest#testBookieContinueWritingIfMulti…
    42e77802c [Ivan Kelly] DLog Namespace#openLog should declare LogNotFoundException
    86bce12b5 [Yong Zhang] Migrate command `ledgermetadata`
    407cb35e5 [Charan Reddy Guttapalem] ISSUE #1967: make ledger creation and removal robust to zk connectionloss
    eaa601404 [Like] Support asynchronous fence request for V2 ReadEntryProcessor
    d23b45ec8 [Ivan Kelly] Fix typo in overview page for 4.8.2
    44ee320b6 [Ivan Kelly] k
    316b71923 [Ivan Kelly] Wait for LAC update even if ledger fenced
    066621507 [Yong Zhang] Migrate command `updatecookie`
    6f3396801 [Yong Zhang] Migrate command `triggeraudit`
    60d993edf [Yong Zhang] Migrate command `autorecovery`
    ed008f278 [Yong Zhang] Migrate command `whoisauditor`
    5b8e0971a [Yong Zhang] Migrate command `Whatisinstanceid`
    90c79444d [Yong Zhang] Migrate command `rebuild-db-ledger-locations-index`
    848f8527f [Nicolas Michael] ISSUE #2053: Bugfix for Percentile Calculation in FastCodahale Timer Implementation
    06f2b6f50 [Yong Zhang] Migrate command `updateledgers`
    7ad5849b1 [Yong Zhang] Migrate command `regenerate-interleaved-storage-index-file`
    d4dbb6bfb [Dongfa,Huang] Avoid useless verify if LedgerEntryRequest completed
    5c150f283 [Enrico Olivelli] Release notes for 4.9.1
    1246826ba [Yong Zhang] Migrate command `recover`
    1d4cc71fd [Yong Zhang] Migrate command `localconsistencycheck`
    67f83620e [Yong Zhang] Migrate command `readledger`
    bfbd6b023 [Yong Zhang] Migrate command `decommission`
    d40b8b69f [Yong Zhang] Migrate command `readlog`
    95d145a15 [Yong Zhang] Migrate command `nukeexistingcluster`
    e2b1dc7f3 [Yong Zhang] Migrate command `listunderreplicated`
    0988e12c7 [bd2019us] ISSUE #2023: change cached thread pool to fixed thread pool
    6a6d7bbd9 [Yong Zhang] Migrate command `initnewcluster`
    c391fe58d [Yong Zhang] Migrate command `readlogmetadata`
    120d67737 [Yong Zhang] Migrate command `lostbookierecoverydelay`
    bf66235e5 [Yong Zhang] Migrate command `deleteledger`
    751e55fa4 [Arvin] ISSUE #2020: close db properly to avoid open RocksDB failure at the second time
    138a7ae85 [Yong Zhang] Migrate command `metadataformat`
    b043d1694 [Yong Zhang] Migrate command `listledgers`
    4573285db [Ivan Kelly] Docker autobuild hook
    e3d807a32 [Like] Fix IDE complain as there are multi choices for error code
    9524a9f4a [Yong Zhang] Migrate command `readjournal`
    6c3f33f55 [Yong Zhang] Fix when met unexpect entry id crashed
    e35a108c7 [Like] Fix error message for unrecognized number-of-bookies
    5902ee27b [Boyang Jerry Peng] fix potential NPE when releasing entry that is null
    6aa73ce05 [Ivan Kelly] [RELEASE] Update website to include documentation for 4.8.2
    1448d12aa [Yong Zhang] Migrate command `listfilesondisk`
    4de598379 [Yong Zhang] Issue #1987: Migrate command `convert-to-interleaved-storage`
    468743e7e [Matteo Merli] In DbLedgerStorage use default values when config key is present but empty
    f26a4cae0 [Ivan Kelly] Release notes for v4.8.2
    ec2636cd2 [Yong Zhang] Issue #1985: Migrate command `convert-to-db-storage`
    8cc7239ac [Yong Zhang] Issue #1982: Migrate command `bookiesanity`
    fa90f0185 [Yong Zhang] Issue #1980: Migrate command `ledger` from shell to bkctl
---
 .../src/main/java/org/apache/bookkeeper/util/ZkUtils.java     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ZkUtils.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ZkUtils.java
index cc0612f..9d6ba1a 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ZkUtils.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/ZkUtils.java
@@ -133,8 +133,17 @@ public class ZkUtils {
             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
+                            callback.processResult(Code.OK.intValue(), path, leafNodePath);
+                        }
+                    }, null);
                 } else {
+                    // parent node deletion fails.. so, complete the callback
                     if (path.equals(leafNodePath)) {
                         callback.processResult(rc, path, leafNodePath);
                     } else {