You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by yo...@apache.org on 2023/12/28 14:28:31 UTC
(iotdb) branch leader-election-time created (now 9f542105545)
This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a change to branch leader-election-time
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 9f542105545 Finish
This branch includes the following new commits:
new 9f542105545 Finish
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Finish
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongzao pushed a commit to branch leader-election-time
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 9f542105545c2e359cb062b3eca0195b0534650d
Author: YongzaoDan <53...@qq.com>
AuthorDate: Thu Dec 28 22:28:22 2023 +0800
Finish
---
.../org/apache/iotdb/confignode/manager/load/cache/LoadCache.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java
index f9a208d47c5..c0f9312b77e 100644
--- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java
+++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java
@@ -27,6 +27,7 @@ import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.cluster.NodeType;
import org.apache.iotdb.commons.cluster.RegionStatus;
+import org.apache.iotdb.commons.conf.CommonDescriptor;
import org.apache.iotdb.confignode.conf.ConfigNodeConfig;
import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor;
import org.apache.iotdb.confignode.manager.IManager;
@@ -65,6 +66,10 @@ public class LoadCache {
private static final ConfigNodeConfig CONF = ConfigNodeDescriptor.getInstance().getConf();
private static final long HEARTBEAT_INTERVAL = CONF.getHeartbeatIntervalInMs();
+ private static final long LEADER_ELECTION_WAITING_TIMEOUT =
+ Math.min(
+ 2 * CONF.getSchemaRegionRatisRpcLeaderElectionTimeoutMaxMs(),
+ CommonDescriptor.getInstance().getConfig().getConnectionTimeoutInMS());
// Map<NodeId, INodeCache>
private final Map<Integer, BaseNodeCache> nodeCacheMap;
@@ -536,8 +541,9 @@ public class LoadCache {
* @param regionGroupIds Specified RegionGroupIds
*/
public void waitForLeaderElection(List<TConsensusGroupId> regionGroupIds) {
+ long startTime = System.currentTimeMillis();
LOGGER.info("[RegionElection] Wait for leader election of RegionGroups: {}", regionGroupIds);
- for (int retry = 0; retry < 10; retry++) {
+ while (System.currentTimeMillis() - startTime <= LEADER_ELECTION_WAITING_TIMEOUT) {
AtomicBoolean allRegionLeaderElected = new AtomicBoolean(true);
regionGroupIds.forEach(
regionGroupId -> {