This is an automated email from the ASF dual-hosted git repository.
qiaojialin 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 954a33f9e1 Rename StandAloneConsensus to OneCopyConsensus (#7832)
954a33f9e1 is described below
commit 954a33f9e18c64c79440c07a7e91af6376504eb0
Author: Jackie Tien <[email protected]>
AuthorDate: Tue Nov 1 14:03:33 2022 +0800
Rename StandAloneConsensus to OneCopyConsensus (#7832)
---
.../iotdb/confignode/conf/ConfigNodeConfig.java | 6 +++---
.../confignode/conf/ConfigNodeStartupCheck.java | 16 +++++++--------
.../iotdb/confignode/manager/ConsensusManager.java | 6 +++---
.../manager/load/balancer/RouteBalancer.java | 2 +-
.../procedure/env/ConfigNodeProcedureEnv.java | 2 +-
.../procedure/env/DataNodeRemoveHandler.java | 4 ++--
.../apache/iotdb/consensus/ConsensusFactory.java | 8 ++++----
.../OneCopyConsensus.java} | 23 +++++++++++-----------
.../OneCopyServerImpl.java} | 6 +++---
.../multileader/MultiLeaderConsensusTest.java | 4 ++--
.../iotdb/consensus/multileader/RecoveryTest.java | 4 ++--
.../OneCopyConsensusTest.java} | 8 ++++----
.../{standalone => onecopy}/RecoveryTest.java | 6 +++---
.../iotdb/consensus/ratis/RatisConsensusTest.java | 4 ++--
.../Reference/ConfigNode-Config-Manual.md | 8 ++++----
.../Reference/ConfigNode-Config-Manual.md | 8 ++++----
.../org/apache/iotdb/it/env/ConfigNodeWrapper.java | 6 +++---
.../org/apache/iotdb/itbase/env/BaseConfig.java | 6 +++---
.../iotdb/confignode/it/IoTDBClusterNodeIT.java | 2 +-
.../confignode/it/IoTDBClusterPartitionIT.java | 6 +++---
.../it/IoTDBClusterRegionLeaderBalancingIT.java | 4 ++--
.../iotdb/confignode/it/IoTDBClusterRestartIT.java | 2 +-
.../confignode/it/IoTDBConfigNodeSnapshotIT.java | 2 +-
.../it/IoTDBConfigNodeSwitchLeaderIT.java | 6 +++---
.../resources/conf/iotdb-common.properties | 8 ++++----
.../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 4 ++--
.../apache/iotdb/db/engine/StorageEngineV2.java | 4 ++--
.../iotdb/db/engine/storagegroup/DataRegion.java | 4 ++--
.../db/metadata/schemaregion/SchemaEngine.java | 2 +-
.../schemaregion/SchemaRegionMemoryImpl.java | 6 ++++--
.../execution/executor/RegionWriteExecutor.java | 8 ++++----
.../java/org/apache/iotdb/db/service/DataNode.java | 4 ++--
.../java/org/apache/iotdb/db/wal/WALManager.java | 8 ++++----
.../iotdb/db/wal/recover/WALNodeRecoverTask.java | 2 +-
.../schemaRegion/SchemaRegionSnapshotTest.java | 2 +-
35 files changed, 101 insertions(+), 100 deletions(-)
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
index c4313e4b2c..f4e62c0e7b 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeConfig.java
@@ -50,16 +50,16 @@ public class ConfigNodeConfig {
private int partitionRegionId = 0;
/** ConfigNodeGroup consensus protocol */
- private String configNodeConsensusProtocolClass =
ConsensusFactory.RatisConsensus;
+ private String configNodeConsensusProtocolClass =
ConsensusFactory.RATIS_CONSENSUS;
/** DataNode schema region consensus protocol */
- private String schemaRegionConsensusProtocolClass =
ConsensusFactory.StandAloneConsensus;
+ private String schemaRegionConsensusProtocolClass =
ConsensusFactory.ONE_COPY_CONSENSUS;
/** The maximum number of SchemaRegion expected to be managed by each
DataNode. */
private double schemaRegionPerDataNode = 1.0;
/** DataNode data region consensus protocol */
- private String dataRegionConsensusProtocolClass =
ConsensusFactory.StandAloneConsensus;
+ private String dataRegionConsensusProtocolClass =
ConsensusFactory.ONE_COPY_CONSENSUS;
/** The maximum number of SchemaRegion expected to be managed by each
DataNode. */
private double dataRegionPerProcessor = 0.5;
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
index 006aa3043d..e96d46f7d2 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/conf/ConfigNodeStartupCheck.java
@@ -50,9 +50,9 @@ public class ConfigNodeStartupCheck {
/** Check whether the global configuration of the cluster is correct */
private void checkGlobalConfig() throws ConfigurationException {
- // When the ConfigNode consensus protocol is set to StandAlone,
+ // When the ConfigNode consensus protocol is set to ONE_COPY_CONSENSUS,
// the target_config_nodes needs to point to itself
- if
(CONF.getConfigNodeConsensusProtocolClass().equals(ConsensusFactory.StandAloneConsensus)
+ if
(CONF.getConfigNodeConsensusProtocolClass().equals(ConsensusFactory.ONE_COPY_CONSENSUS)
&&
(!CONF.getInternalAddress().equals(CONF.getTargetConfigNode().getIp())
|| CONF.getInternalPort() !=
CONF.getTargetConfigNode().getPort())) {
throw new ConfigurationException(
@@ -61,9 +61,9 @@ public class ConfigNodeStartupCheck {
CONF.getInternalAddress() + ":" + CONF.getInternalPort());
}
- // When the data region consensus protocol is set to StandAlone,
+ // When the data region consensus protocol is set to ONE_COPY_CONSENSUS,
// the data replication factor must be 1
- if
(CONF.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.StandAloneConsensus)
+ if
(CONF.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.ONE_COPY_CONSENSUS)
&& CONF.getDataReplicationFactor() != 1) {
throw new ConfigurationException(
"data_replication_factor",
@@ -71,9 +71,9 @@ public class ConfigNodeStartupCheck {
String.valueOf(1));
}
- // When the schema region consensus protocol is set to StandAlone,
+ // When the schema region consensus protocol is set to ONE_COPY_CONSENSUS,
// the schema replication factor must be 1
- if
(CONF.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.StandAloneConsensus)
+ if
(CONF.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.ONE_COPY_CONSENSUS)
&& CONF.getSchemaReplicationFactor() != 1) {
throw new ConfigurationException(
"schema_replication_factor",
@@ -84,12 +84,12 @@ public class ConfigNodeStartupCheck {
// When the schema region consensus protocol is set to
MultiLeaderConsensus,
// we should report an error
if (CONF.getSchemaRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
throw new ConfigurationException(
"schema_region_consensus_protocol_class",
String.valueOf(CONF.getSchemaRegionConsensusProtocolClass()),
String.format(
- "%s or %s", ConsensusFactory.StandAloneConsensus,
ConsensusFactory.RatisConsensus));
+ "%s or %s", ConsensusFactory.ONE_COPY_CONSENSUS,
ConsensusFactory.RATIS_CONSENSUS));
}
// The routing policy is limited
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConsensusManager.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConsensusManager.java
index b93b48e68a..9784e277e4 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConsensusManager.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConsensusManager.java
@@ -79,10 +79,10 @@ public class ConsensusManager {
// There is only one ConfigNodeGroup
consensusGroupId = new PartitionRegionId(CONF.getPartitionRegionId());
- if
(ConsensusFactory.StandAloneConsensus.equals(CONF.getConfigNodeConsensusProtocolClass()))
{
+ if
(ConsensusFactory.ONE_COPY_CONSENSUS.equals(CONF.getConfigNodeConsensusProtocolClass()))
{
consensusImpl =
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.StandAloneConsensus,
+ ConsensusFactory.ONE_COPY_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNode(
new TEndPoint(CONF.getInternalAddress(),
CONF.getConsensusPort()))
@@ -94,7 +94,7 @@ public class ConsensusManager {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.StandAloneConsensus)));
+ ConsensusFactory.ONE_COPY_CONSENSUS)));
} else {
// Implement local ConsensusLayer by ConfigNodeConfig
consensusImpl =
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
index 6ee52b0415..ee8a8bdd9a 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/balancer/RouteBalancer.java
@@ -61,7 +61,7 @@ public class RouteBalancer {
private static final Logger LOGGER =
LoggerFactory.getLogger(RouteBalancer.class);
private static final boolean isMultiLeader =
- ConsensusFactory.MultiLeaderConsensus.equals(
+ ConsensusFactory.MULTI_LEADER_CONSENSUS.equals(
ConfigNodeDescriptor.getInstance().getConf().getDataRegionConsensusProtocolClass());
public static final String LEADER_POLICY = "leader";
public static final String GREEDY_POLICY = "greedy";
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
index 0820a54851..e96fe4269b 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java
@@ -505,7 +505,7 @@ public class ConfigNodeProcedureEnv {
// Select leader greedily for multi-leader consensus protocol
if (TConsensusGroupType.DataRegion.equals(regionGroupId.getType())
- && ConsensusFactory.MultiLeaderConsensus.equals(
+ && ConsensusFactory.MULTI_LEADER_CONSENSUS.equals(
ConfigNodeDescriptor.getInstance().getConf().getDataRegionConsensusProtocolClass()))
{
List<Integer> availableDataNodes = new ArrayList<>();
for (Map.Entry<Integer, RegionStatus> statusEntry :
regionStatusMap.entrySet()) {
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/DataNodeRemoveHandler.java
b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/DataNodeRemoveHandler.java
index 6577653e38..324cb2466d 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/DataNodeRemoveHandler.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/DataNodeRemoveHandler.java
@@ -610,9 +610,9 @@ public class DataNodeRemoveHandler {
*/
private TSStatus checkClusterProtocol() {
TSStatus status = new
TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
- if
(CONF.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.StandAloneConsensus)
+ if
(CONF.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.ONE_COPY_CONSENSUS)
|| CONF.getSchemaRegionConsensusProtocolClass()
- .equals(ConsensusFactory.StandAloneConsensus)) {
+ .equals(ConsensusFactory.ONE_COPY_CONSENSUS)) {
status.setCode(TSStatusCode.REMOVE_DATANODE_FAILED.getStatusCode());
status.setMessage("standalone protocol is not supported to remove data
node");
}
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/ConsensusFactory.java
b/consensus/src/main/java/org/apache/iotdb/consensus/ConsensusFactory.java
index 8146fcf3a4..b60c6a0458 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/ConsensusFactory.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/ConsensusFactory.java
@@ -32,10 +32,10 @@ public class ConsensusFactory {
public static final String CONSTRUCT_FAILED_MSG =
"Construct consensusImpl failed, Please check your consensus className
%s";
- public static final String StandAloneConsensus =
- "org.apache.iotdb.consensus.standalone.StandAloneConsensus";
- public static final String RatisConsensus =
"org.apache.iotdb.consensus.ratis.RatisConsensus";
- public static final String MultiLeaderConsensus =
+ public static final String ONE_COPY_CONSENSUS =
+ "org.apache.iotdb.consensus.onecopy.OneCopyConsensus";
+ public static final String RATIS_CONSENSUS =
"org.apache.iotdb.consensus.ratis.RatisConsensus";
+ public static final String MULTI_LEADER_CONSENSUS =
"org.apache.iotdb.consensus.multileader.MultiLeaderConsensus";
private static final Logger logger =
LoggerFactory.getLogger(ConsensusFactory.class);
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneConsensus.java
b/consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensus.java
similarity index 91%
rename from
consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneConsensus.java
rename to
consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensus.java
index ee00b9021d..c6066bff51 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneConsensus.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensus.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.consensus.standalone;
+package org.apache.iotdb.consensus.onecopy;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
@@ -57,18 +57,18 @@ import java.util.concurrent.atomic.AtomicBoolean;
*
* <p>Notice: The stateMachine needs to implement WAL itself to ensure
recovery after a restart
*/
-class StandAloneConsensus implements IConsensus {
+class OneCopyConsensus implements IConsensus {
- private final Logger logger =
LoggerFactory.getLogger(StandAloneConsensus.class);
+ private final Logger logger =
LoggerFactory.getLogger(OneCopyConsensus.class);
private final TEndPoint thisNode;
private final int thisNodeId;
private final File storageDir;
private final IStateMachine.Registry registry;
- private final Map<ConsensusGroupId, StandAloneServerImpl> stateMachineMap =
+ private final Map<ConsensusGroupId, OneCopyServerImpl> stateMachineMap =
new ConcurrentHashMap<>();
- public StandAloneConsensus(ConsensusConfig config, Registry registry) {
+ public OneCopyConsensus(ConsensusConfig config, Registry registry) {
this.thisNode = config.getThisNodeEndPoint();
this.thisNodeId = config.getThisNodeId();
this.storageDir = new File(config.getStorageDir());
@@ -92,8 +92,8 @@ class StandAloneConsensus implements IConsensus {
ConsensusGroupId consensusGroupId =
ConsensusGroupId.Factory.create(
Integer.parseInt(items[0]), Integer.parseInt(items[1]));
- StandAloneServerImpl consensus =
- new StandAloneServerImpl(
+ OneCopyServerImpl consensus =
+ new OneCopyServerImpl(
new Peer(consensusGroupId, thisNodeId, thisNode),
registry.apply(consensusGroupId));
stateMachineMap.put(consensusGroupId, consensus);
@@ -105,12 +105,12 @@ class StandAloneConsensus implements IConsensus {
@Override
public void stop() throws IOException {
-
stateMachineMap.values().parallelStream().forEach(StandAloneServerImpl::stop);
+ stateMachineMap.values().parallelStream().forEach(OneCopyServerImpl::stop);
}
@Override
public ConsensusWriteResponse write(ConsensusGroupId groupId,
IConsensusRequest request) {
- StandAloneServerImpl impl = stateMachineMap.get(groupId);
+ OneCopyServerImpl impl = stateMachineMap.get(groupId);
if (impl == null) {
return ConsensusWriteResponse.newBuilder()
.setException(new ConsensusGroupNotExistException(groupId))
@@ -129,7 +129,7 @@ class StandAloneConsensus implements IConsensus {
@Override
public ConsensusReadResponse read(ConsensusGroupId groupId,
IConsensusRequest request) {
- StandAloneServerImpl impl = stateMachineMap.get(groupId);
+ OneCopyServerImpl impl = stateMachineMap.get(groupId);
if (impl == null) {
return ConsensusReadResponse.newBuilder()
.setException(new ConsensusGroupNotExistException(groupId))
@@ -156,8 +156,7 @@ class StandAloneConsensus implements IConsensus {
groupId,
k -> {
exist.set(false);
- StandAloneServerImpl impl =
- new StandAloneServerImpl(peers.get(0), registry.apply(groupId));
+ OneCopyServerImpl impl = new OneCopyServerImpl(peers.get(0),
registry.apply(groupId));
impl.start();
String path = buildPeerDir(groupId);
File file = new File(path);
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneServerImpl.java
b/consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyServerImpl.java
similarity index 92%
rename from
consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneServerImpl.java
rename to
consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyServerImpl.java
index b59f4e1f53..df8c993c22 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/standalone/StandAloneServerImpl.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/onecopy/OneCopyServerImpl.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.consensus.standalone;
+package org.apache.iotdb.consensus.onecopy;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.consensus.IStateMachine;
@@ -27,12 +27,12 @@ import
org.apache.iotdb.consensus.common.request.IConsensusRequest;
import java.io.File;
-public class StandAloneServerImpl implements IStateMachine {
+public class OneCopyServerImpl implements IStateMachine {
private final Peer peer;
private final IStateMachine stateMachine;
- public StandAloneServerImpl(Peer peer, IStateMachine stateMachine) {
+ public OneCopyServerImpl(Peer peer, IStateMachine stateMachine) {
this.peer = peer;
this.stateMachine = stateMachine;
}
diff --git
a/consensus/src/test/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensusTest.java
b/consensus/src/test/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensusTest.java
index ca17b52cd5..53bb885d84 100644
---
a/consensus/src/test/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensusTest.java
+++
b/consensus/src/test/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensusTest.java
@@ -88,7 +88,7 @@ public class MultiLeaderConsensusTest {
servers.add(
(MultiLeaderConsensus)
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.MultiLeaderConsensus,
+ ConsensusFactory.MULTI_LEADER_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNodeId(peers.get(i).getNodeId())
.setThisNode(peers.get(i).getEndpoint())
@@ -100,7 +100,7 @@ public class MultiLeaderConsensusTest {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.MultiLeaderConsensus))));
+ ConsensusFactory.MULTI_LEADER_CONSENSUS))));
servers.get(i).start();
}
}
diff --git
a/consensus/src/test/java/org/apache/iotdb/consensus/multileader/RecoveryTest.java
b/consensus/src/test/java/org/apache/iotdb/consensus/multileader/RecoveryTest.java
index 1c38644fbc..5600089c05 100644
---
a/consensus/src/test/java/org/apache/iotdb/consensus/multileader/RecoveryTest.java
+++
b/consensus/src/test/java/org/apache/iotdb/consensus/multileader/RecoveryTest.java
@@ -47,7 +47,7 @@ public class RecoveryTest {
public void constructConsensus() throws IOException {
consensusImpl =
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.MultiLeaderConsensus,
+ ConsensusFactory.MULTI_LEADER_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNodeId(1)
.setThisNode(new TEndPoint("0.0.0.0", 9000))
@@ -59,7 +59,7 @@ public class RecoveryTest {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.MultiLeaderConsensus)));
+ ConsensusFactory.MULTI_LEADER_CONSENSUS)));
consensusImpl.start();
}
diff --git
a/consensus/src/test/java/org/apache/iotdb/consensus/standalone/StandAloneConsensusTest.java
b/consensus/src/test/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensusTest.java
similarity index 98%
rename from
consensus/src/test/java/org/apache/iotdb/consensus/standalone/StandAloneConsensusTest.java
rename to
consensus/src/test/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensusTest.java
index 6a386c5e1a..151c3763c0 100644
---
a/consensus/src/test/java/org/apache/iotdb/consensus/standalone/StandAloneConsensusTest.java
+++
b/consensus/src/test/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensusTest.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.iotdb.consensus.standalone;
+package org.apache.iotdb.consensus.onecopy;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
@@ -57,7 +57,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-public class StandAloneConsensusTest {
+public class OneCopyConsensusTest {
private IConsensus consensusImpl;
private final TestEntry entry1 = new TestEntry(0);
@@ -126,7 +126,7 @@ public class StandAloneConsensusTest {
public void setUp() throws Exception {
consensusImpl =
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.StandAloneConsensus,
+ ConsensusFactory.ONE_COPY_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNodeId(1)
.setThisNode(new TEndPoint("0.0.0.0", 6667))
@@ -146,7 +146,7 @@ public class StandAloneConsensusTest {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.StandAloneConsensus)));
+ ConsensusFactory.ONE_COPY_CONSENSUS)));
consensusImpl.start();
}
diff --git
a/consensus/src/test/java/org/apache/iotdb/consensus/standalone/RecoveryTest.java
b/consensus/src/test/java/org/apache/iotdb/consensus/onecopy/RecoveryTest.java
similarity index 95%
rename from
consensus/src/test/java/org/apache/iotdb/consensus/standalone/RecoveryTest.java
rename to
consensus/src/test/java/org/apache/iotdb/consensus/onecopy/RecoveryTest.java
index 6288439d12..409d4f1bd3 100644
---
a/consensus/src/test/java/org/apache/iotdb/consensus/standalone/RecoveryTest.java
+++
b/consensus/src/test/java/org/apache/iotdb/consensus/onecopy/RecoveryTest.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.iotdb.consensus.standalone;
+package org.apache.iotdb.consensus.onecopy;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.commons.consensus.ConsensusGroupId;
@@ -46,7 +46,7 @@ public class RecoveryTest {
public void constructConsensus() throws IOException {
consensusImpl =
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.StandAloneConsensus,
+ ConsensusFactory.ONE_COPY_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNodeId(1)
.setThisNode(new TEndPoint("0.0.0.0", 9000))
@@ -58,7 +58,7 @@ public class RecoveryTest {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.StandAloneConsensus)));
+ ConsensusFactory.ONE_COPY_CONSENSUS)));
consensusImpl.start();
}
diff --git
a/consensus/src/test/java/org/apache/iotdb/consensus/ratis/RatisConsensusTest.java
b/consensus/src/test/java/org/apache/iotdb/consensus/ratis/RatisConsensusTest.java
index c7348ecaa5..041b9a0172 100644
---
a/consensus/src/test/java/org/apache/iotdb/consensus/ratis/RatisConsensusTest.java
+++
b/consensus/src/test/java/org/apache/iotdb/consensus/ratis/RatisConsensusTest.java
@@ -74,7 +74,7 @@ public class RatisConsensusTest {
int finalI = i;
servers.add(
ConsensusFactory.getConsensusImpl(
- ConsensusFactory.RatisConsensus,
+ ConsensusFactory.RATIS_CONSENSUS,
ConsensusConfig.newBuilder()
.setThisNodeId(peers.get(i).getNodeId())
.setThisNode(peers.get(i).getEndpoint())
@@ -87,7 +87,7 @@ public class RatisConsensusTest {
new IllegalArgumentException(
String.format(
ConsensusFactory.CONSTRUCT_FAILED_MSG,
- ConsensusFactory.RatisConsensus))));
+ ConsensusFactory.RATIS_CONSENSUS))));
servers.get(i).start();
}
}
diff --git a/docs/UserGuide/Reference/ConfigNode-Config-Manual.md
b/docs/UserGuide/Reference/ConfigNode-Config-Manual.md
index 1672d1c35e..1840d39bcc 100644
--- a/docs/UserGuide/Reference/ConfigNode-Config-Manual.md
+++ b/docs/UserGuide/Reference/ConfigNode-Config-Manual.md
@@ -166,9 +166,9 @@ The global configuration of cluster is in ConfigNode.
|Name| data\_region\_consensus\_protocol\_class |
|:---:|:---|
-|Description| Consensus protocol of data replicas, StandAloneConsensus could
only be used in 1 replica,larger than 1 replicas could use MultiLeaderConsensus
or RatisConsensus |
+|Description| Consensus protocol of data replicas, OneCopyConsensus could only
be used in 1 replica,larger than 1 replicas could use MultiLeaderConsensus or
RatisConsensus |
|Type| String |
-|Default| org.apache.iotdb.consensus.standalone.StandAloneConsensus |
+|Default| org.apache.iotdb.consensus.onecopy.OneCopyConsensus |
|Effective|Only allowed to be modified in first start up|
* schema\_replication\_factor
@@ -185,9 +185,9 @@ The global configuration of cluster is in ConfigNode.
|Name| schema\_region\_consensus\_protocol\_class |
|:---:|:---|
-|Description| Consensus protocol of schema replicas, StandAloneConsensus could
only be used in 1 replica,larger than 1 replicas could only use RatisConsensus
| |
+|Description| Consensus protocol of schema replicas, OneCopyConsensus could
only be used in 1 replica,larger than 1 replicas could only use RatisConsensus
| |
|Type| String |
-|Default| org.apache.iotdb.consensus.standalone.StandAloneConsensus |
+|Default| org.apache.iotdb.consensus.onecopy.OneCopyConsensus |
|Effective|Only allowed to be modified in first start up|
diff --git a/docs/zh/UserGuide/Reference/ConfigNode-Config-Manual.md
b/docs/zh/UserGuide/Reference/ConfigNode-Config-Manual.md
index df58792880..7e76613d0c 100644
--- a/docs/zh/UserGuide/Reference/ConfigNode-Config-Manual.md
+++ b/docs/zh/UserGuide/Reference/ConfigNode-Config-Manual.md
@@ -163,9 +163,9 @@ IoTDB 集群的全局配置通过 ConfigNode 配置。
|名字| data\_region\_consensus\_protocol\_class |
|:---:|:---|
-|描述| 数据副本的共识协议,1 副本时可以使用 StandAloneConsensus 协议,多副本时可以使用 MultiLeaderConsensus
或 RatisConsensus |
+|描述| 数据副本的共识协议,1 副本时可以使用 OneCopyConsensus 协议,多副本时可以使用 MultiLeaderConsensus 或
RatisConsensus |
|类型| String |
-|默认值| org.apache.iotdb.consensus.standalone.StandAloneConsensus |
+|默认值| org.apache.iotdb.consensus.onecopy.OneCopyConsensus |
|改后生效方式|仅允许在第一次启动服务前修改|
* schema\_replication\_factor
@@ -181,9 +181,9 @@ IoTDB 集群的全局配置通过 ConfigNode 配置。
|名字| schema\_region\_consensus\_protocol\_class |
|:---:|:---|
-|描述| 元数据副本的共识协议,1 副本时可以使用 StandAloneConsensus 协议,多副本时只能使用 RatisConsensus |
+|描述| 元数据副本的共识协议,1 副本时可以使用 OneCopyConsensus 协议,多副本时只能使用 RatisConsensus |
|类型| String |
-|默认值| org.apache.iotdb.consensus.standalone.StandAloneConsensus |
+|默认值| org.apache.iotdb.consensus.onecopy.OneCopyConsensus |
|改后生效方式|仅允许在第一次启动服务前修改|
* region\_allocate\_strategy
diff --git
a/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNodeWrapper.java
b/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNodeWrapper.java
index 5f9a454b1a..8253b64110 100644
---
a/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNodeWrapper.java
+++
b/integration-test/src/main/java/org/apache/iotdb/it/env/ConfigNodeWrapper.java
@@ -55,13 +55,13 @@ public class ConfigNodeWrapper extends AbstractNodeWrapper {
properties.setProperty(IoTDBConstant.CN_TARGET_CONFIG_NODES,
this.targetConfigNodes);
properties.setProperty(
"config_node_consensus_protocol_class",
- "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+ "org.apache.iotdb.consensus.onecopy.OneCopyConsensus");
properties.setProperty(
"schema_region_consensus_protocol_class",
- "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+ "org.apache.iotdb.consensus.onecopy.OneCopyConsensus");
properties.setProperty(
"data_region_consensus_protocol_class",
- "org.apache.iotdb.consensus.standalone.StandAloneConsensus");
+ "org.apache.iotdb.consensus.onecopy.OneCopyConsensus");
properties.setProperty("schema_replication_factor", "1");
properties.setProperty("data_replication_factor", "1");
properties.setProperty("cn_connection_timeout_ms", "30000");
diff --git
a/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java
b/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java
index d4fc88ac64..56ad0abe80 100644
--- a/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java
+++ b/integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseConfig.java
@@ -215,7 +215,7 @@ public interface BaseConfig {
}
default String getConfigNodeConsesusProtocolClass() {
- return "org.apache.iotdb.consensus.standalone.StandAloneConsensus";
+ return "org.apache.iotdb.consensus.onecopy.OneCopyConsensus";
}
default BaseConfig setSchemaRegionConsensusProtocolClass(
@@ -224,7 +224,7 @@ public interface BaseConfig {
}
default String getSchemaRegionConsensusProtocolClass() {
- return "org.apache.iotdb.consensus.standalone.StandAloneConsensus";
+ return "org.apache.iotdb.consensus.onecopy.OneCopyConsensus";
}
default BaseConfig setDataRegionConsensusProtocolClass(String
dataRegionConsensusProtocolClass) {
@@ -232,7 +232,7 @@ public interface BaseConfig {
}
default String getDataRegionConsensusProtocolClass() {
- return "org.apache.iotdb.consensus.standalone.StandAloneConsensus";
+ return "org.apache.iotdb.consensus.onecopy.OneCopyConsensus";
}
default BaseConfig setSchemaReplicationFactor(int schemaReplicationFactor) {
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterNodeIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterNodeIT.java
index 92479c93dc..68b80dd2f1 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterNodeIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterNodeIT.java
@@ -72,7 +72,7 @@ public class IoTDBClusterNodeIT {
protected static String originalConfigNodeConsensusProtocolClass;
protected static String originalSchemaRegionConsensusProtocolClass;
protected static String originalDataRegionConsensusProtocolClass;
- private static final String testConsensusProtocolClass =
ConsensusFactory.RatisConsensus;
+ private static final String testConsensusProtocolClass =
ConsensusFactory.RATIS_CONSENSUS;
@Before
public void setUp() throws Exception {
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterPartitionIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterPartitionIT.java
index 61f322cec2..9d8e011edc 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterPartitionIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterPartitionIT.java
@@ -103,10 +103,10 @@ public class IoTDBClusterPartitionIT {
ConfigFactory.getConfig().getSchemaRegionConsensusProtocolClass();
originalDataRegionConsensusProtocolClass =
ConfigFactory.getConfig().getDataRegionConsensusProtocolClass();
-
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RatisConsensus);
+
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
ConfigFactory.getConfig()
-
.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RatisConsensus);
-
ConfigFactory.getConfig().setDataRegionConsensusProtocolClass(ConsensusFactory.RatisConsensus);
+
.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
+
ConfigFactory.getConfig().setDataRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
originalSchemaReplicationFactor =
ConfigFactory.getConfig().getSchemaReplicationFactor();
originalDataReplicationFactor =
ConfigFactory.getConfig().getDataReplicationFactor();
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRegionLeaderBalancingIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRegionLeaderBalancingIT.java
index dac2189cc8..e043ff1209 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRegionLeaderBalancingIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRegionLeaderBalancingIT.java
@@ -58,10 +58,10 @@ public class IoTDBClusterRegionLeaderBalancingIT {
protected static String originalSchemaRegionConsensusProtocolClass;
private static final String testSchemaRegionConsensusProtocolClass =
- ConsensusFactory.RatisConsensus;
+ ConsensusFactory.RATIS_CONSENSUS;
protected static String originalDataRegionConsensusProtocolClass;
private static final String testDataRegionConsensusProtocolClass =
- ConsensusFactory.MultiLeaderConsensus;
+ ConsensusFactory.MULTI_LEADER_CONSENSUS;
protected static int originalSchemaReplicationFactor;
protected static int originalDataReplicationFactor;
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRestartIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRestartIT.java
index 5d69dec2e3..dbdecb01de 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRestartIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBClusterRestartIT.java
@@ -91,7 +91,7 @@ public class IoTDBClusterRestartIT {
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ratisConsensusProtocolClass);
ConfigFactory.getConfig().setSchemaRegionConsensusProtocolClass(ratisConsensusProtocolClass);
ConfigFactory.getConfig().setDataRegionConsensusProtocolClass(ratisConsensusProtocolClass);
-
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RatisConsensus);
+
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
originSchemaReplicationFactor =
ConfigFactory.getConfig().getSchemaReplicationFactor();
originalDataReplicationFactor =
ConfigFactory.getConfig().getDataReplicationFactor();
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
index 8f734928dd..df2f269ffd 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSnapshotIT.java
@@ -91,7 +91,7 @@ public class IoTDBConfigNodeSnapshotIT {
public void setUp() throws Exception {
originalConfigNodeConsensusProtocolClass =
ConfigFactory.getConfig().getConfigNodeConsesusProtocolClass();
-
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RatisConsensus);
+
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
originalRatisSnapshotTriggerThreshold =
ConfigFactory.getConfig().getRatisSnapshotTriggerThreshold();
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSwitchLeaderIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSwitchLeaderIT.java
index e71525fec1..3491e02616 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSwitchLeaderIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/IoTDBConfigNodeSwitchLeaderIT.java
@@ -78,11 +78,11 @@ public class IoTDBConfigNodeSwitchLeaderIT {
ConfigFactory.getConfig().getSchemaRegionConsensusProtocolClass();
originalDataRegionConsensusProtocolClass =
ConfigFactory.getConfig().getDataRegionConsensusProtocolClass();
-
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RatisConsensus);
+
ConfigFactory.getConfig().setConfigNodeConsesusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
ConfigFactory.getConfig()
-
.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RatisConsensus);
+
.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
ConfigFactory.getConfig()
-
.setDataRegionConsensusProtocolClass(ConsensusFactory.MultiLeaderConsensus);
+
.setDataRegionConsensusProtocolClass(ConsensusFactory.MULTI_LEADER_CONSENSUS);
originalSchemaReplicationFactor =
ConfigFactory.getConfig().getSchemaReplicationFactor();
originalDataReplicationFactor =
ConfigFactory.getConfig().getDataReplicationFactor();
diff --git a/node-commons/src/assembly/resources/conf/iotdb-common.properties
b/node-commons/src/assembly/resources/conf/iotdb-common.properties
index addf0d83d6..b613ac6cc9 100644
--- a/node-commons/src/assembly/resources/conf/iotdb-common.properties
+++ b/node-commons/src/assembly/resources/conf/iotdb-common.properties
@@ -994,10 +994,10 @@ trigger_forward_mqtt_pool_size=4
# SchemaRegion consensus protocol type.
# This parameter is unmodifiable after ConfigNode starts for the first time.
# These consensus protocols are currently supported:
-# 1. org.apache.iotdb.consensus.standalone.StandAloneConsensus(Consensus
patterns optimized specifically for single replica)
+# 1. org.apache.iotdb.consensus.onecopy.OneCopyConsensus(Consensus patterns
optimized specifically for single replica)
# 2. org.apache.iotdb.consensus.ratis.RatisConsensus(Raft protocol)
# Datatype: String
-#
schema_region_consensus_protocol_class=org.apache.iotdb.consensus.standalone.StandAloneConsensus
+#
schema_region_consensus_protocol_class=org.apache.iotdb.consensus.onecopy.OneCopyConsensus
# The maximum number of SchemaRegion expected to be managed by each DataNode.
# Notice: Since each StorageGroup requires at least one SchemaRegion to manage
its schema,
@@ -1008,11 +1008,11 @@ trigger_forward_mqtt_pool_size=4
# DataRegion consensus protocol type.
# This parameter is unmodifiable after ConfigNode starts for the first time.
# These consensus protocols are currently supported:
-# 1. org.apache.iotdb.consensus.standalone.StandAloneConsensus(Consensus
patterns optimized specifically for single replica)
+# 1. org.apache.iotdb.consensus.onecopy.OneCopyConsensus(Consensus patterns
optimized specifically for single replica)
# 2. org.apache.iotdb.consensus.multileader.MultiLeaderConsensus(weak
consistency, high performance)
# 3. org.apache.iotdb.consensus.ratis.RatisConsensus(Raft protocol)
# Datatype: String
-#
data_region_consensus_protocol_class=org.apache.iotdb.consensus.standalone.StandAloneConsensus
+#
data_region_consensus_protocol_class=org.apache.iotdb.consensus.onecopy.OneCopyConsensus
# The maximum number of DataRegion expected to be managed by each processor.
# Notice: Since each StorageGroup requires at least two DataRegions to manage
its data,
diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index f21c5a738d..cf3ebee2f0 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -888,14 +888,14 @@ public class IoTDBConfig {
* on startup and set this variable so that the correct class name can be
obtained later when the
* data region consensus layer singleton is initialized
*/
- private String dataRegionConsensusProtocolClass =
ConsensusFactory.RatisConsensus;
+ private String dataRegionConsensusProtocolClass =
ConsensusFactory.RATIS_CONSENSUS;
/**
* The consensus protocol class for schema region. The Datanode should
communicate with ConfigNode
* on startup and set this variable so that the correct class name can be
obtained later when the
* schema region consensus layer singleton is initialized
*/
- private String schemaRegionConsensusProtocolClass =
ConsensusFactory.RatisConsensus;
+ private String schemaRegionConsensusProtocolClass =
ConsensusFactory.RATIS_CONSENSUS;
/**
* The series partition executor class. The Datanode should communicate with
ConfigNode on startup
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngineV2.java
b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngineV2.java
index 24529820c0..76468f5fe2 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngineV2.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngineV2.java
@@ -210,7 +210,7 @@ public class StorageEngineV2 implements IService {
// wait until wal is recovered
if (!config.isClusterMode()
- ||
!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ ||
!config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
try {
WALRecoverManager.getInstance().recover();
} catch (WALException e) {
@@ -630,7 +630,7 @@ public class StorageEngineV2 implements IService {
if (config.isClusterMode()
&& config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
WALManager.getInstance()
.deleteWALNode(
region.getStorageGroupName() + FILE_NAME_SEPARATOR +
region.getDataRegionId());
diff --git
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
index 77a370864a..9dfe87c498 100755
---
a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
+++
b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/DataRegion.java
@@ -315,7 +315,7 @@ public class DataRegion {
// recover tsfiles unless consensus protocol is ratis and storage engine
is not ready
if (config.isClusterMode()
- &&
config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus)
+ &&
config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS)
&& !StorageEngineV2.getInstance().isAllSgReady()) {
logger.debug(
"Skip recovering data region {}[{}] when consensus protocol is ratis
and storage engine is not ready.",
@@ -3787,7 +3787,7 @@ public class DataRegion {
public IWALNode getWALNode() {
if (!config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
throw new UnsupportedOperationException();
}
// identifier should be same with getTsFileProcessor method
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaEngine.java
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaEngine.java
index c044886aad..9e90744995 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaEngine.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaEngine.java
@@ -129,7 +129,7 @@ public class SchemaEngine {
if (!(config.isClusterMode()
&& config
.getSchemaRegionConsensusProtocolClass()
- .equals(ConsensusFactory.RatisConsensus))
+ .equals(ConsensusFactory.RATIS_CONSENSUS))
&& config.getSyncMlogPeriodInMs() != 0) {
timedForceMLogThread =
IoTDBThreadPoolFactory.newSingleThreadScheduledExecutor(
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
index a9d1ff390a..dbacdae7d0 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/schemaregion/SchemaRegionMemoryImpl.java
@@ -222,7 +222,9 @@ public class SchemaRegionMemoryImpl implements
ISchemaRegion {
// In ratis mode, no matter create schemaRegion or recover schemaRegion,
the working dir should
// be clear first
if (config.isClusterMode()
- &&
config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ && config
+ .getSchemaRegionConsensusProtocolClass()
+ .equals(ConsensusFactory.RATIS_CONSENSUS)) {
File schemaRegionDir = new File(schemaRegionDirPath);
if (schemaRegionDir.exists()) {
FileUtils.deleteDirectory(schemaRegionDir);
@@ -255,7 +257,7 @@ public class SchemaRegionMemoryImpl implements
ISchemaRegion {
if (!(config.isClusterMode()
&& config
.getSchemaRegionConsensusProtocolClass()
- .equals(ConsensusFactory.RatisConsensus))) {
+ .equals(ConsensusFactory.RATIS_CONSENSUS))) {
usingMLog = true;
initMLog();
} else {
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
index 55edb9c7b5..72811cc815 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/execution/executor/RegionWriteExecutor.java
@@ -266,7 +266,7 @@ public class RegionWriteExecutor {
CreateTimeSeriesNode node, WritePlanNodeExecutionContext context) {
ISchemaRegion schemaRegion =
SchemaEngine.getInstance().getSchemaRegion((SchemaRegionId)
context.getRegionId());
- if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
context.getRegionWriteValidationRWLock().writeLock().lock();
try {
Map<Integer, MetadataException> failingMeasurementMap =
@@ -300,7 +300,7 @@ public class RegionWriteExecutor {
CreateAlignedTimeSeriesNode node, WritePlanNodeExecutionContext
context) {
ISchemaRegion schemaRegion =
SchemaEngine.getInstance().getSchemaRegion((SchemaRegionId)
context.getRegionId());
- if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
context.getRegionWriteValidationRWLock().writeLock().lock();
try {
Map<Integer, MetadataException> failingMeasurementMap =
@@ -332,7 +332,7 @@ public class RegionWriteExecutor {
CreateMultiTimeSeriesNode node, WritePlanNodeExecutionContext context)
{
ISchemaRegion schemaRegion =
SchemaEngine.getInstance().getSchemaRegion((SchemaRegionId)
context.getRegionId());
- if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
context.getRegionWriteValidationRWLock().writeLock().lock();
try {
List<TSStatus> failingStatus = new ArrayList<>();
@@ -405,7 +405,7 @@ public class RegionWriteExecutor {
InternalCreateTimeSeriesNode node, WritePlanNodeExecutionContext
context) {
ISchemaRegion schemaRegion =
SchemaEngine.getInstance().getSchemaRegion((SchemaRegionId)
context.getRegionId());
- if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ if
(config.getSchemaRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
context.getRegionWriteValidationRWLock().writeLock().lock();
try {
List<TSStatus> failingStatus = new ArrayList<>();
diff --git a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
index a7e6690295..b04108d598 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/DataNode.java
@@ -238,7 +238,7 @@ public class DataNode implements DataNodeMBean {
// In current implementation, only MultiLeader need separated memory
from Consensus
if (!config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
IoTDBDescriptor.getInstance().reclaimConsensusMemory();
}
@@ -315,7 +315,7 @@ public class DataNode implements DataNodeMBean {
// close wal when using ratis consensus
if (config.isClusterMode()
- &&
config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RatisConsensus))
{
+ &&
config.getDataRegionConsensusProtocolClass().equals(ConsensusFactory.RATIS_CONSENSUS))
{
config.setWalMode(WALMode.DISABLE);
}
registerManager.register(WALManager.getInstance());
diff --git a/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
b/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
index abacfe006f..0c64406932 100644
--- a/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/wal/WALManager.java
@@ -64,7 +64,7 @@ public class WALManager implements IService {
if (config.isClusterMode()
&& config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
walNodesManager = new FirstCreateStrategy();
} else if (config.getMaxWalNodesNum() == 0) {
walNodesManager = new ElasticStrategy();
@@ -76,7 +76,7 @@ public class WALManager implements IService {
public static String getApplicantUniqueId(String storageGroupName, boolean
sequence) {
return config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)
? storageGroupName
: storageGroupName
+ IoTDBConstant.FILE_NAME_SEPARATOR
@@ -99,7 +99,7 @@ public class WALManager implements IService {
|| !config.isClusterMode()
|| !config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
return;
}
@@ -113,7 +113,7 @@ public class WALManager implements IService {
|| !config.isClusterMode()
|| !config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
return;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/wal/recover/WALNodeRecoverTask.java
b/server/src/main/java/org/apache/iotdb/db/wal/recover/WALNodeRecoverTask.java
index 755bc3568d..bd73f4413c 100644
---
a/server/src/main/java/org/apache/iotdb/db/wal/recover/WALNodeRecoverTask.java
+++
b/server/src/main/java/org/apache/iotdb/db/wal/recover/WALNodeRecoverTask.java
@@ -96,7 +96,7 @@ public class WALNodeRecoverTask implements Runnable {
if (!config
.getDataRegionConsensusProtocolClass()
- .equals(ConsensusFactory.MultiLeaderConsensus)) {
+ .equals(ConsensusFactory.MULTI_LEADER_CONSENSUS)) {
// delete this wal node folder
FileUtils.deleteDirectory(logDirectory);
logger.info(
diff --git
a/server/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSnapshotTest.java
b/server/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSnapshotTest.java
index 2406c521a6..bb4f032fb4 100644
---
a/server/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSnapshotTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/metadata/schemaRegion/SchemaRegionSnapshotTest.java
@@ -67,7 +67,7 @@ public class SchemaRegionSnapshotTest {
config.setMppMode(true);
config.setClusterMode(true);
-
config.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RatisConsensus);
+
config.setSchemaRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS);
config.setAllocateMemoryForSchemaRegion(1024 * 1024 * 1024);
EnvironmentUtils.envSetUp();
}