You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2019/02/28 03:09:15 UTC

[GitHub] rdhabalia commented on a change in pull request #1940: [bk-gc] avoid blocking call while gc checking deleted ledger znode

rdhabalia commented on a change in pull request #1940: [bk-gc] avoid blocking call while gc checking deleted ledger znode
URL: https://github.com/apache/bookkeeper/pull/1940#discussion_r261032675
 
 

 ##########
 File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
 ##########
 @@ -166,14 +168,19 @@ public void gc(GarbageCleaner garbageCleaner) {
                     if (!ledgersInMetadata.contains(bkLid)) {
                         if (verifyMetadataOnGc) {
                             int rc = BKException.Code.OK;
+                            boolean isTimeOut = false;
                             try {
-                                result(ledgerManager.readLedgerMetadata(bkLid));
+                                result(ledgerManager.readLedgerMetadata(bkLid), this.conf.getZkTimeout(),
+                                        TimeUnit.MILLISECONDS);
                             } catch (BKException e) {
                                 rc = e.getCode();
+                            } catch (Exception e) {
+                                isTimeOut = true;
+                                LOG.warn("Failed to read ledger-metadata for {} from zk {}", bkLid, e.getMessage());
                             }
-                            if (rc != BKException.Code.NoSuchLedgerExistsException) {
+                            if (isTimeOut || rc != BKException.Code.NoSuchLedgerExistsException) {
 
 Review comment:
   sure, i have fixed it. I also realized that unfortunately I have made a mistake in timeunit of zkTimeout in ##1937 where caller was passing msec but ZkUtils at receiver was expecting into seconds. So, I have also made the change to accept zk-timeout in ms.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services