ivankelly commented on a change in pull request #641: Issue-596 Issue-583: Auto 
replication should honor ensemble placement policy
URL: https://github.com/apache/bookkeeper/pull/641#discussion_r145553949
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
 ##########
 @@ -271,22 +265,20 @@ private boolean rereplicate(long ledgerIdToReplicate) 
throws InterruptedExceptio
             underreplicationManager.markLedgerReplicated(ledgerIdToReplicate);
             getExceptionCounter("BKNoSuchLedgerExistsException").inc();
             return false;
-        } catch (BKReadException e) {
-            LOG.info("BKReadException while"
-                    + " opening ledger {} for replication."
-                    + " Enough Bookies might not have available"
-                    + " So, no harm to continue", ledgerIdToReplicate);
-            underreplicationManager
-                    .releaseUnderreplicatedLedger(ledgerIdToReplicate);
-            getExceptionCounter("BKReadException").inc();
-            return false;
-        } catch (BKBookieHandleNotAvailableException e) {
-            LOG.info("BKBookieHandleNotAvailableException while"
-                    + " opening ledger {} for replication."
+        } catch (BKException e) {
+            LOG.info("{} while"
+                    + " rereplicating ledger {}."
                     + " Enough Bookies might not have available"
-                    + " So, no harm to continue", ledgerIdToReplicate);
+                    + " So, no harm to continue",
+                e.getClass().getSimpleName(),
+                ledgerIdToReplicate);
             underreplicationManager
                     .releaseUnderreplicatedLedger(ledgerIdToReplicate);
+            getExceptionCounter(e.getClass().getSimpleName()).inc();
+
+            if (e instanceof BKNotEnoughBookiesException) {
 
 Review comment:
   Not a big fan of this. Maybe create a logErrorAndRelease(BKException e, long 
ledgerId) method to move out the common stuff and handle 
BKNotEnoughBookiesException in a different catch clause.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to