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 2021/09/23 14:07:28 UTC

[GitHub] [bookkeeper] nicoloboschi commented on a change in pull request #2805: replication stat num-under-replicated-ledgers changed as with the pro…

nicoloboschi commented on a change in pull request #2805:
URL: https://github.com/apache/bookkeeper/pull/2805#discussion_r714833082



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/ZkLedgerUnderreplicationManager.java
##########
@@ -854,6 +855,28 @@ public int getLostBookieRecoveryDelay() throws UnavailableException {
         }
     }
 
+    @Override
+    public void notifyUnderReplicationLedgerChanged(GenericCallback<Void> cb) throws UnavailableException {
+        LOG.debug("notifyUnderReplicationLedgerChanged()");
+        Watcher w = new Watcher() {
+            @Override
+            public void process(WatchedEvent e) {
+                if (e.getPath().contains("urL") && e.getType() == Event.EventType.NodeDeleted) {

Review comment:
       checking the event type is cheaper than the contains, I suggest to invert the conditions order
   
   I think it is better to use `getLedgerId(String path)` method instead of the String contains

##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
##########
@@ -691,6 +691,14 @@ public void start() {
                 submitShutdownTask();
             }
 
+            try {
+                this.ledgerUnderreplicationManager.notifyUnderReplicationLedgerChanged(new UnderReplicatedLedgersChangedCb());
+            }catch (UnavailableException ue) {

Review comment:
       missing a space before the 'catch'




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org