This is an automated email from the ASF dual-hosted git repository. jackietien pushed a commit to branch ChangeConsensusName in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 96baa7e2ba205546d17f88c6d3f6f81a229c40cd Author: JackieTien97 <[email protected]> AuthorDate: Mon Oct 31 20:05:05 2022 +0800 Rename StandAloneConsensus to OneCopyConsensus --- .../OneCopyConsensus.java} | 23 +++++++++++----------- .../OneCopyServerImpl.java} | 6 +++--- .../OneCopyConsensusTest.java} | 4 ++-- .../{standalone => onecopy}/RecoveryTest.java | 2 +- .../Reference/ConfigNode-Config-Manual.md | 8 ++++---- .../Reference/ConfigNode-Config-Manual.md | 8 ++++---- .../resources/conf/iotdb-common.properties | 8 ++++---- 7 files changed, 29 insertions(+), 30 deletions(-) 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/standalone/StandAloneConsensusTest.java b/consensus/src/test/java/org/apache/iotdb/consensus/onecopy/OneCopyConsensusTest.java similarity index 99% 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..e4347caf0b 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); 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 98% 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..af73105997 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; 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/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,
