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

yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git

commit 39f152c6f3b96482ac71bd097fdbf304f0bbdd30
Author: Hang Chen <[email protected]>
AuthorDate: Wed Oct 26 10:52:43 2022 +0800

    skip replicasCheck when replication disabled (#3563)
    
    Descriptions of the changes in this PR:
    
    ### Motivation
    When disabled replication by the BookKeeper shell, the `replicasCheckTask` 
doesn't check the `replication disabled` flag and keeps checking the ledger 
replicas, which will lead to more disk IO.
    
    ### Changes
    Check the `replication disabled` flag before running `replicasCheckTask`
    
    (Describe: what changes you have made)
    
    (cherry picked from commit 1704ca43d6be0a49c7a311e9c42cd696f76c59ff)
---
 .../src/main/java/org/apache/bookkeeper/replication/Auditor.java    | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
index 8afb0cc74f..9ddc659fa6 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
@@ -1013,6 +1013,10 @@ public class Auditor implements AutoCloseable {
             @Override
             public void run() {
                 try {
+                    if 
(!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) {
+                        LOG.info("Ledger replication disabled, skipping 
replicasCheck task.");
+                        return;
+                    }
                     Stopwatch stopwatch = Stopwatch.createStarted();
                     LOG.info("Starting ReplicasCheck");
                     replicasCheck();
@@ -1068,6 +1072,8 @@ public class Auditor implements AutoCloseable {
                         numLedgersHavingLessThanWQReplicasOfAnEntryGuageValue
                                 
.set(numLedgersFoundHavingLessThanWQReplicasOfAnEntryValue);
                     }
+                } catch (ReplicationException.UnavailableException ue) {
+                    LOG.error("Underreplication manager unavailable running 
periodic check", ue);
                 }
             }
         }), initialDelay, interval, TimeUnit.SECONDS);

Reply via email to