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/26 05:53:03 UTC

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

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

 ##########
 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:
   the comment here doesn't seem to be right to me for `isTimeout` case. Why not just move line 182 to line 176 in `catch BKException` block?

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