This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch ty/TableModelGrammar in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 950272b67cad7f1bcd50d92cc5cb3e9552bf7c7a 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 (cherry picked from commit 25ed79191b82bddccd7c5844f23db07560f9c5ce) --- .../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
