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

sijie pushed a commit to branch branch-4.6
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.6 by this push:
     new 4db9903  Fix: fail create-ledger callback on ledgerId generation 
failure
4db9903 is described below

commit 4db9903fa38b10cd2058c37318d7f59376f32c44
Author: rdhabalia <[email protected]>
AuthorDate: Thu Dec 21 10:43:47 2017 -0800

    Fix: fail create-ledger callback on ledgerId generation failure
    
    ### Motivation
    
    Recently, we have seen that when bk-client tries to create-ledger and if 
bk-client lost the zk-connection then bk-client doesn't complete the 
createLedger-callback. We can see following exception when bk-client fails to 
generate ledgerId from zookeeper.
    ```
    05:43:35.364 [main-EventThread] ERROR o.a.b.meta.ZkLedgerIdGenerator       
- Could not generate new ledger id
    org.apache.zookeeper.KeeperException$ConnectionLossException: 
KeeperErrorCode = ConnectionLoss for /ledgers/idgen-long/HOB-0000000001/ID-
            at 
org.apache.zookeeper.KeeperException.create(KeeperException.java:99) 
~[zookeeper-3.4.6.jar:3.4.6-1569965]
            at 
org.apache.zookeeper.KeeperException.create(KeeperException.java:51) 
~[zookeeper-3.4.6.jar:3.4.6-1569965]
            at 
org.apache.bookkeeper.meta.ZkLedgerIdGenerator$1.processResult(ZkLedgerIdGenerator.java:78)
 ~[bookkeeper-server-4.3.1.56-yahoo.jar:4.3.1.56-yahoo]
            at 
org.apache.bookkeeper.util.ZkUtils$1.processResult(ZkUtils.java:79) 
[bookkeeper-server-4.3.1.56-yahoo.jar:4.3.1.56-yahoo]
            at 
org.apache.bookkeeper.zookeeper.ZooKeeperClient$9$1.processResult(ZooKeeperClient.java:527)
 [bookkeeper-server-4.3.1.56-yahoo.jar:4.3.1.56-yahoo]
            at 
org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:605) 
[zookeeper-3.4.6.jar:3.4.6-1569965]
            at 
org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498) 
[zookeeper-3.4.6.jar:3.4.6-1569965]
    ```
    
    ### Modifications
    
    - Bk-client handles and completes ledger-request callback on 
ledgerId-generation failure.
    
    Author: rdhabalia <[email protected]>
    
    Reviewers: Sijie Guo <[email protected]>, Matteo Merli <[email protected]>
    
    This closes #900 from rdhabalia/create_ledger_ap
    
    (cherry picked from commit b94773ae733e7aca0ff3b6807929ded026dfbe07)
    Signed-off-by: Sijie Guo <[email protected]>
---
 .../main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
index f410744..65cc887 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
@@ -111,6 +111,10 @@ public class LongZkLedgerIdGenerator implements 
LedgerIdGenerator {
                         
cb.operationComplete(BKException.Code.IllegalOpException, null);
                     }
 
+                } else {
+                    LOG.error("Failed to create long ledger ID path",
+                            
KeeperException.create(KeeperException.Code.get(rc)));
+                    cb.operationComplete(BKException.Code.ZKException, null);
                 }
             }
 

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to