This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 25ed79191b8 [IoTConsensus] Support hot reload of IoTConsensusConfig
(#13025)
25ed79191b8 is described below
commit 25ed79191b82bddccd7c5844f23db07560f9c5ce
Author: Xiangpeng Hu <[email protected]>
AuthorDate: Thu Jul 25 16:50:47 2024 +0800
[IoTConsensus] Support hot reload of IoTConsensusConfig (#13025)
* hot reload
* fix comment
---
.../src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java | 6 +++++-
.../org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java
index e883aaa7e79..b94781761e9 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensus.java
@@ -474,7 +474,11 @@ public class IoTConsensus implements IConsensus {
public void reloadConsensusConfig(ConsensusConfig consensusConfig) {
config = consensusConfig.getIotConsensusConfig();
- // only update region migration speed limit for now
+ for (IoTConsensusServerImpl impl : stateMachineMap.values()) {
+ impl.reloadConsensusConfig(config);
+ }
+
+ // update region migration speed limit
IoTConsensusRateLimiter.getInstance()
.init(config.getReplication().getRegionMigrationSpeedLimitBytesPerSecond());
}
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
index 1f5dbc41010..d3cec61dd30 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java
@@ -119,7 +119,7 @@ public class IoTConsensusServerImpl {
private final List<Peer> configuration;
private final AtomicLong searchIndex;
private final LogDispatcher logDispatcher;
- private final IoTConsensusConfig config;
+ private IoTConsensusConfig config;
private final ConsensusReqReader consensusReqReader;
private volatile boolean active;
private String newSnapshotDirName;
@@ -1038,6 +1038,11 @@ public class IoTConsensusServerImpl {
}
}
+ /** This method is used for hot reload of IoTConsensusConfig. */
+ public void reloadConsensusConfig(IoTConsensusConfig config) {
+ this.config = config;
+ }
+
/**
* This method is used for write of IoTConsensus SyncLog. By this method, we
can keep write order
* in follower the same as the leader. And besides order insurance, we can
make the