You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ch...@apache.org on 2023/04/27 05:38:56 UTC

[bookkeeper] branch master updated: fix wrong update checkAllLedgersTime when ledgerReplication disabled (#3939)

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

chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new c765aea600 fix wrong update checkAllLedgersTime when ledgerReplication disabled (#3939)
c765aea600 is described below

commit c765aea600fde1a8ac7cb8a53a1157a372026894
Author: wenbingshen <ol...@gmail.com>
AuthorDate: Thu Apr 27 13:38:50 2023 +0800

    fix wrong update checkAllLedgersTime when ledgerReplication disabled (#3939)
    
    ### Motivation
    
    When ledgerReplication disabled, we don't need to register `checkAllLedgersTime` failedEvent because we already skipped the check and didn't encounter any exception.
    
    ```java
            Stopwatch stopwatch = Stopwatch.createStarted();
            boolean checkSuccess = false;
            try {
                if (!isLedgerReplicationEnabled()) {
                    LOG.info("Ledger replication disabled, skipping checkAllLedgers");
                    checkSuccess = true;    <= here
                    return;
                }
    
                LOG.info("Starting checkAllLedgers");
                checkAllLedgers();
                ......
                checkSuccess = true;
            } catch (InterruptedException ie) {
               ......
            } finally {
                if (!checkSuccess) {
                    long checkAllLedgersDuration = stopwatch.stop().elapsed(TimeUnit.MILLISECONDS);
                    auditorStats.getCheckAllLedgersTime()
                            .registerFailedEvent(checkAllLedgersDuration, TimeUnit.MILLISECONDS);
                }
            }
    ```
---
 .../org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java
index f6b7a6f36e..580fa60538 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorCheckAllLedgersTask.java
@@ -102,6 +102,7 @@ public class AuditorCheckAllLedgersTask extends AuditorTask {
         try {
             if (!isLedgerReplicationEnabled()) {
                 LOG.info("Ledger replication disabled, skipping checkAllLedgers");
+                checkSuccess = true;
                 return;
             }