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 688460b670683adefc0a9e7629f40d1d48c5eb44
Author: gaozhangmin <[email protected]>
AuthorDate: Mon Dec 13 19:55:02 2021 +0800

    Ledger replicate supports throttle (#2778)
    
    Ledger replicating puts  heavy loads on cluster.
    Now,  ledger replicate only supports split fragments into small pieces.
     But, throttling is not supported.
    
    Add a confiuration `replicationRateByBytes `
    
    support throttling  read rate in bytes.
    
    Also bookkeeper shell recover command supports throttle.
    
    (cherry picked from commit a2d73416667a94597d507f9a27b1561d39366c98)
---
 .../bookkeeper/conf/ClientConfiguration.java       | 24 ++++++++++++++++++++++
 .../bookkeeper/conf/ServerConfiguration.java       | 23 +++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
index 935445174f..57f0323196 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ClientConfiguration.java
@@ -200,6 +200,30 @@ public class ClientConfiguration extends 
AbstractConfiguration<ClientConfigurati
     protected static final String 
CLIENT_CONNECT_BOOKIE_UNAVAILABLE_LOG_THROTTLING =
             "clientConnectBookieUnavailableLogThrottling";
 
+    protected static final String REPLICATION_RATE_BY_BYTES = 
"replicationRateByBytes";
+
+    /**
+     * Get the bytes rate of re-replication.
+     * Default value is -1 which it means entries will replicated without any 
throttling activity.
+     *
+     * @return bytes rate of re-replication.
+     */
+    public int getReplicationRateByBytes() {
+        return getInt(REPLICATION_RATE_BY_BYTES, -1);
+    }
+
+    /**
+     * Set the bytes rate of re-replication.
+     *
+     * @param rate bytes rate of re-replication.
+     *
+     * @return ClientConfiguration
+     */
+    public ClientConfiguration setReplicationRateByBytes(int rate) {
+        this.setProperty(REPLICATION_RATE_BY_BYTES, rate);
+        return this;
+    }
+
     /**
      * Construct a default client-side configuration.
      */
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
index 09a1c76cc5..6327599808 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/ServerConfiguration.java
@@ -216,6 +216,7 @@ public class ServerConfiguration extends 
AbstractConfiguration<ServerConfigurati
         "auditorAcquireConcurrentOpenLedgerOperationsTimeOutMSec";
     protected static final String IN_FLIGHT_READ_ENTRY_NUM_IN_LEDGER_CHECKER = 
"inFlightReadEntryNumInLedgerChecker";
 
+    protected static final String REPLICATION_RATE_BY_BYTES = 
"replicationRateByBytes";
 
     // Worker Thread parameters.
     protected static final String NUM_ADD_WORKER_THREADS = 
"numAddWorkerThreads";
@@ -3973,4 +3974,26 @@ public class ServerConfiguration extends 
AbstractConfiguration<ServerConfigurati
         this.setProperty(LEDGER_METADATA_ROCKSDB_CONF, 
ledgerMetadataRocksdbConf);
         return this;
     }
+
+    /**
+     * Get the bytes rate of re-replication.
+     * Default value is -1 which it means entries will replicated without any 
throttling activity.
+     *
+     * @return bytes rate of re-replication.
+     */
+    public int getReplicationRateByBytes() {
+        return getInt(REPLICATION_RATE_BY_BYTES, -1);
+    }
+
+    /**
+     * Set the rate of re-replication.
+     *
+     * @param rate bytes rate of re-replication.
+     *
+     * @return ServerConfiguration
+     */
+    public ServerConfiguration setReplicationRateByBytes(int rate) {
+        setProperty(REPLICATION_RATE_BY_BYTES, rate);
+        return this;
+    }
 }

Reply via email to