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 ccbfd065e13 [IOTDB-6190] Increase the threshold for Ratis to shut
itself down if it detects that a process is stuck (#11865)
ccbfd065e13 is described below
commit ccbfd065e136059b56e1cd13d3d4efd3db87191e
Author: Potato <[email protected]>
AuthorDate: Tue Jan 9 16:27:37 2024 +0800
[IOTDB-6190] Increase the threshold for Ratis to shut itself down if it
detects that a process is stuck (#11865)
Signed-off-by: OneSizeFitQuorum <[email protected]>
---
.../manager/consensus/ConsensusManager.java | 4 ++++
.../apache/iotdb/consensus/config/RatisConfig.java | 23 +++++++++++++---------
.../apache/iotdb/consensus/ratis/utils/Utils.java | 1 +
.../db/consensus/DataRegionConsensusImpl.java | 4 ++++
.../db/consensus/SchemaRegionConsensusImpl.java | 4 ++++
5 files changed, 27 insertions(+), 9 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
index b350109db92..1d82735e899 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/consensus/ConsensusManager.java
@@ -158,6 +158,10 @@ public class ConsensusManager {
TimeDuration.valueOf(
CONF.getConfigNodeRatisRequestTimeoutMs(),
TimeUnit.MILLISECONDS))
+ .setSlownessTimeout(
+ TimeDuration.valueOf(
+
CONF.getConfigNodeRatisRequestTimeoutMs() * 6,
+ TimeUnit.MILLISECONDS))
.setFirstElectionTimeoutMin(
TimeDuration.valueOf(
CONF.getRatisFirstElectionTimeoutMinMs(),
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/RatisConfig.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/RatisConfig.java
index ad40495972b..859665fe1a3 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/RatisConfig.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/RatisConfig.java
@@ -267,13 +267,7 @@ public class RatisConfig {
private TimeDuration timeoutMax = TimeDuration.valueOf(4,
TimeUnit.SECONDS);
private TimeDuration requestTimeout = TimeDuration.valueOf(20,
TimeUnit.SECONDS);
private TimeDuration sleepTime = TimeDuration.valueOf(1,
TimeUnit.SECONDS);
- /**
- * TODO: After introducing version 3.0 of Ratis, we plan to reduce the
value of this parameter
- * because a new parameter will be introduced later. For more details,
please refer to `<a
- *
href="https://lists.apache.org/thread/vxd97lpllqtdb8cdbt3nxvg1kv6kjfss">email</a>`.
It is
- * set to 100 years instead of Long.MAX_VALUE to avoid potential
overflows when shifting time.
- */
- private TimeDuration slownessTimeout = TimeDuration.valueOf(100 * 365L,
TimeUnit.DAYS);
+ private TimeDuration slownessTimeout = TimeDuration.valueOf(120,
TimeUnit.SECONDS);
private TimeDuration firstElectionTimeoutMin =
TimeDuration.valueOf(50, TimeUnit.MILLISECONDS);
@@ -1145,15 +1139,21 @@ public class RatisConfig {
public static class Utils {
private final int sleepDeviationThresholdMs;
+ private final int closeThresholdMs;
- private Utils(int sleepDeviationThresholdMs) {
+ private Utils(int sleepDeviationThresholdMs, int closeThresholdMs) {
this.sleepDeviationThresholdMs = sleepDeviationThresholdMs;
+ this.closeThresholdMs = closeThresholdMs;
}
public int getSleepDeviationThresholdMs() {
return sleepDeviationThresholdMs;
}
+ public int getCloseThresholdMs() {
+ return closeThresholdMs;
+ }
+
public static Utils.Builder newBuilder() {
return new Utils.Builder();
}
@@ -1161,14 +1161,19 @@ public class RatisConfig {
public static class Builder {
private int sleepDeviationThresholdMs = 4 * 1000;
+ private int closeThresholdMs = Integer.MAX_VALUE;
public Utils build() {
- return new Utils(sleepDeviationThresholdMs);
+ return new Utils(sleepDeviationThresholdMs, closeThresholdMs);
}
public void setSleepDeviationThresholdMs(int sleepDeviationThresholdMs) {
this.sleepDeviationThresholdMs = sleepDeviationThresholdMs;
}
+
+ public void setCloseThresholdMs(int closeThresholdMs) {
+ this.closeThresholdMs = closeThresholdMs;
+ }
}
}
}
diff --git
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/Utils.java
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/Utils.java
index c66ffa70ae8..29de306ba84 100644
---
a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/Utils.java
+++
b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/utils/Utils.java
@@ -327,6 +327,7 @@ public class Utils {
RaftServerConfigKeys.setSleepDeviationThreshold(
properties, config.getUtils().getSleepDeviationThresholdMs());
+ RaftServerConfigKeys.setCloseThreshold(properties,
config.getUtils().getCloseThresholdMs());
final TimeDuration clientMaxRetryGap =
getMaxRetrySleepTime(config.getClient());
RaftServerConfigKeys.RetryCache.setExpiryTime(properties,
clientMaxRetryGap);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java
index 8c41edd7f09..dcdd8bea4a4 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/DataRegionConsensusImpl.java
@@ -144,6 +144,10 @@ public class DataRegionConsensusImpl {
TimeDuration.valueOf(
CONF.getDataRatisConsensusRequestTimeoutMs(),
TimeUnit.MILLISECONDS))
+ .setSlownessTimeout(
+ TimeDuration.valueOf(
+
CONF.getDataRatisConsensusRequestTimeoutMs() * 6,
+ TimeUnit.MILLISECONDS))
.setFirstElectionTimeoutMin(
TimeDuration.valueOf(
CONF.getRatisFirstElectionTimeoutMinMs(),
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/SchemaRegionConsensusImpl.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/SchemaRegionConsensusImpl.java
index 711fa5d36a2..a2f4d95bc48 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/SchemaRegionConsensusImpl.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/SchemaRegionConsensusImpl.java
@@ -105,6 +105,10 @@ public class SchemaRegionConsensusImpl {
TimeDuration.valueOf(
CONF.getSchemaRatisConsensusRequestTimeoutMs(),
TimeUnit.MILLISECONDS))
+ .setSlownessTimeout(
+ TimeDuration.valueOf(
+
CONF.getSchemaRatisConsensusRequestTimeoutMs() * 6,
+ TimeUnit.MILLISECONDS))
.setFirstElectionTimeoutMin(
TimeDuration.valueOf(
CONF.getRatisFirstElectionTimeoutMinMs(),