This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch ml_add_peer
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/ml_add_peer by this push:
new ec2f755938 change active verification location for MulitLeaderConsensus
ec2f755938 is described below
commit ec2f755938b72570f156bd21de170dd6e6fdbd9c
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Wed Aug 31 15:32:51 2022 +0800
change active verification location for MulitLeaderConsensus
---
.../org/apache/iotdb/consensus/multileader/MultiLeaderConsensus.java | 5 +++++
.../apache/iotdb/consensus/multileader/MultiLeaderServerImpl.java | 4 ----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensus.java
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensus.java
index d091772811..33e59e361b 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensus.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderConsensus.java
@@ -44,6 +44,7 @@ import
org.apache.iotdb.consensus.multileader.client.AsyncMultiLeaderServiceClie
import
org.apache.iotdb.consensus.multileader.client.MultiLeaderConsensusClientPool.AsyncMultiLeaderServiceClientPoolFactory;
import org.apache.iotdb.consensus.multileader.service.MultiLeaderRPCService;
import
org.apache.iotdb.consensus.multileader.service.MultiLeaderRPCServiceProcessor;
+import org.apache.iotdb.rpc.RpcUtils;
import org.apache.iotdb.rpc.TSStatusCode;
import org.slf4j.Logger;
@@ -144,6 +145,10 @@ public class MultiLeaderConsensus implements IConsensus {
if (impl.isReadOnly()) {
status = new
TSStatus(TSStatusCode.READ_ONLY_SYSTEM_ERROR.getStatusCode());
status.setMessage("Fail to do non-query operations because system is
read-only.");
+ } else if (!impl.isActive()) {
+ // TODO: (xingtanzjr) whether we need to define a new status to indicate
the inactive status ?
+ status = RpcUtils.getStatus(TSStatusCode.WRITE_PROCESS_REJECT);
+ status.setMessage("peer is inactive and not ready to receive sync log
request.");
} else {
status = impl.write(request);
}
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderServerImpl.java
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderServerImpl.java
index d0d992454a..c5e88aab16 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderServerImpl.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/MultiLeaderServerImpl.java
@@ -117,10 +117,6 @@ public class MultiLeaderServerImpl {
* records the index of the log and writes locally, and then asynchronous
replication is performed
*/
public TSStatus write(IConsensusRequest request) {
- if (!active) {
- // TODO: (xingtanzjr) whether we need to define a new status to indicate
the inactive status ?
- return RpcUtils.getStatus(TSStatusCode.WRITE_PROCESS_REJECT);
- }
stateMachineLock.lock();
try {
if (needBlockWrite()) {