You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2024/08/05 12:58:48 UTC

(iotdb) branch fix_transfer_leader_frequency updated: finish

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

tanxinyu pushed a commit to branch fix_transfer_leader_frequency
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/fix_transfer_leader_frequency by this push:
     new d2d1769f172 finish
d2d1769f172 is described below

commit d2d1769f17269be974da0a91dad60e08760b53c0
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Mon Aug 5 20:58:35 2024 +0800

    finish
    
    Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
 .../iotdb/confignode/procedure/env/RegionMaintainHandler.java  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java
index 7ef330f460f..4b51208e79f 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RegionMaintainHandler.java
@@ -666,7 +666,7 @@ public class RegionMaintainHandler {
    * @param originalDataNode The DataNode where the region locates
    */
   public void transferRegionLeader(TConsensusGroupId regionId, TDataNodeLocation originalDataNode)
-      throws ProcedureException {
+      throws ProcedureException, InterruptedException {
     // find new leader
     final int findNewLeaderTimeLimitSecond = 10;
     long startTime = System.nanoTime();
@@ -689,6 +689,10 @@ public class RegionMaintainHandler {
             && RATIS_CONSENSUS.equals(CONF.getDataRegionConsensusProtocolClass())) {
       final int MAX_RETRY_TIME = 10;
       int retryTime = 0;
+      long sleepTime =
+          (CONF.getSchemaRegionRatisRpcLeaderElectionTimeoutMaxMs()
+                  + CONF.getSchemaRegionRatisRpcLeaderElectionTimeoutMinMs())
+              / 2;
       while (true) {
         TRegionLeaderChangeResp resp =
             SyncDataNodeClientPool.getInstance()
@@ -702,7 +706,9 @@ public class RegionMaintainHandler {
           LOGGER.warn("[RemoveRegion] Ratis transfer leader fail, but procedure will continue.");
           return;
         }
-        LOGGER.warn("Call changeRegionLeader fail for the {} time", retryTime);
+        LOGGER.warn(
+            "Call changeRegionLeader fail for the {} time, will sleep {} ms", retryTime, sleepTime);
+        Thread.sleep(sleepTime);
       }
     }