You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/08/18 02:11:14 UTC
[iotdb] 09/09: build success
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch consensus_module_refactor
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit f5ddf3843970d8037669d3885030f8b3cda08dd2
Author: BUAAserein <18...@buaa.edu.cn>
AuthorDate: Fri Aug 18 00:45:28 2023 +0800
build success
---
.../common/response/ConsensusGenericResponse.java | 64 -----------------
.../common/response/ConsensusReadResponse.java | 69 ------------------
.../common/response/ConsensusResponse.java | 39 ----------
.../common/response/ConsensusWriteResponse.java | 82 ----------------------
.../iotdb/consensus/ratis/RatisConsensus.java | 18 -----
.../consensus/simple/SimpleConsensusTest.java | 6 +-
.../iotdb/db/service/RegionMigrateService.java | 19 ++---
.../execution/executor/RegionReadExecutorTest.java | 26 +++----
.../executor/RegionWriteExecutorTest.java | 8 +--
.../DataNodeInternalRPCServiceImplTest.java | 4 +-
10 files changed, 28 insertions(+), 307 deletions(-)
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusGenericResponse.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusGenericResponse.java
deleted file mode 100644
index acf67f23393..00000000000
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusGenericResponse.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.consensus.common.response;
-
-import org.apache.iotdb.consensus.exception.ConsensusException;
-
-public class ConsensusGenericResponse extends ConsensusResponse {
-
- private final boolean success;
-
- public ConsensusGenericResponse(ConsensusException exception, boolean success) {
- super(exception);
- this.success = success;
- }
-
- public boolean isSuccess() {
- return success;
- }
-
- @Override
- public String toString() {
- return "ConsensusGenericResponse{" + "success=" + success + "} " + super.toString();
- }
-
- public static ConsensusGenericResponse.Builder newBuilder() {
- return new ConsensusGenericResponse.Builder();
- }
-
- public static class Builder {
- private boolean success;
- private ConsensusException exception;
-
- public ConsensusGenericResponse build() {
- return new ConsensusGenericResponse(exception, success);
- }
-
- public ConsensusGenericResponse.Builder setException(ConsensusException exception) {
- this.exception = exception;
- return this;
- }
-
- public ConsensusGenericResponse.Builder setSuccess(boolean success) {
- this.success = success;
- return this;
- }
- }
-}
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusReadResponse.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusReadResponse.java
deleted file mode 100644
index 7c3a45bd90b..00000000000
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusReadResponse.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.consensus.common.response;
-
-import org.apache.iotdb.consensus.common.DataSet;
-import org.apache.iotdb.consensus.exception.ConsensusException;
-
-public class ConsensusReadResponse extends ConsensusResponse {
-
- private final DataSet dataset;
-
- public ConsensusReadResponse(ConsensusException exception, DataSet dataset) {
- super(exception);
- this.dataset = dataset;
- }
-
- public DataSet getDataset() {
- return dataset;
- }
-
- public boolean isSuccess() {
- return exception == null;
- }
-
- @Override
- public String toString() {
- return "ConsensusReadResponse{" + "dataset=" + dataset + ", exception=" + exception + "}";
- }
-
- public static ConsensusReadResponse.Builder newBuilder() {
- return new ConsensusReadResponse.Builder();
- }
-
- public static class Builder {
- private ConsensusException exception;
- private DataSet dataset;
-
- public ConsensusReadResponse build() {
- return new ConsensusReadResponse(exception, dataset);
- }
-
- public ConsensusReadResponse.Builder setException(ConsensusException exception) {
- this.exception = exception;
- return this;
- }
-
- public ConsensusReadResponse.Builder setDataSet(DataSet dataset) {
- this.dataset = dataset;
- return this;
- }
- }
-}
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusResponse.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusResponse.java
deleted file mode 100644
index 4b4beff769d..00000000000
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusResponse.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.consensus.common.response;
-
-import org.apache.iotdb.consensus.exception.ConsensusException;
-
-public abstract class ConsensusResponse {
- protected final ConsensusException exception;
-
- protected ConsensusResponse(ConsensusException exception) {
- this.exception = exception;
- }
-
- public ConsensusException getException() {
- return exception;
- }
-
- @Override
- public String toString() {
- return "exception=" + exception;
- }
-}
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusWriteResponse.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusWriteResponse.java
deleted file mode 100644
index fdb7626c1d5..00000000000
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/common/response/ConsensusWriteResponse.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.consensus.common.response;
-
-import org.apache.iotdb.common.rpc.thrift.TSStatus;
-import org.apache.iotdb.consensus.exception.ConsensusException;
-import org.apache.iotdb.rpc.TSStatusCode;
-
-public class ConsensusWriteResponse extends ConsensusResponse {
-
- private final TSStatus status;
-
- public ConsensusWriteResponse(ConsensusException exception, TSStatus status) {
- super(exception);
- this.status = status;
- }
-
- public TSStatus getStatus() {
- return status;
- }
-
- @Override
- public String toString() {
- return "ConsensusWriteResponse{" + "status=" + status + "} " + super.toString();
- }
-
- public boolean isSuccessful() {
- return status != null && status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode();
- }
-
- public String getErrorMessage() {
- if (status != null && status.message != null && status.message.length() > 0) {
- return status.message;
- }
- if (exception != null
- && exception.getMessage() != null
- && exception.getMessage().length() > 0) {
- return exception.getMessage();
- }
- return "unknown error message";
- }
-
- public static ConsensusWriteResponse.Builder newBuilder() {
- return new ConsensusWriteResponse.Builder();
- }
-
- public static class Builder {
- private TSStatus status;
- private ConsensusException exception;
-
- public ConsensusWriteResponse build() {
- return new ConsensusWriteResponse(exception, status);
- }
-
- public Builder setException(ConsensusException exception) {
- this.exception = exception;
- return this;
- }
-
- public Builder setStatus(TSStatus status) {
- this.status = status;
- return this;
- }
- }
-}
diff --git a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
index 88c8072630c..b77fed47204 100644
--- a/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
+++ b/iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/ratis/RatisConsensus.java
@@ -39,9 +39,6 @@ import org.apache.iotdb.consensus.IStateMachine;
import org.apache.iotdb.consensus.common.DataSet;
import org.apache.iotdb.consensus.common.Peer;
import org.apache.iotdb.consensus.common.request.IConsensusRequest;
-import org.apache.iotdb.consensus.common.response.ConsensusGenericResponse;
-import org.apache.iotdb.consensus.common.response.ConsensusReadResponse;
-import org.apache.iotdb.consensus.common.response.ConsensusWriteResponse;
import org.apache.iotdb.consensus.config.ConsensusConfig;
import org.apache.iotdb.consensus.config.RatisConfig;
import org.apache.iotdb.consensus.exception.ConsensusException;
@@ -722,21 +719,6 @@ class RatisConsensus implements IConsensus {
diskGuardian, this::triggerSnapshotByCustomize, 0, delay, TimeUnit.SECONDS);
}
- private ConsensusGenericResponse failed(ConsensusException e) {
- logger.debug("{} request failed with exception {}", this, e);
- return ConsensusGenericResponse.newBuilder().setSuccess(false).setException(e).build();
- }
-
- private ConsensusWriteResponse failedWrite(ConsensusException e) {
- logger.debug("{} write request failed with exception {}", this, e);
- return ConsensusWriteResponse.newBuilder().setException(e).build();
- }
-
- private ConsensusReadResponse failedRead(ConsensusException e) {
- logger.debug("{} read request failed with exception {}", this, e);
- return ConsensusReadResponse.newBuilder().setException(e).build();
- }
-
private RaftClientRequest buildRawRequest(
RaftGroupId groupId, Message message, RaftClientRequest.Type type) {
return RaftClientRequest.newBuilder()
diff --git a/iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/simple/SimpleConsensusTest.java b/iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/simple/SimpleConsensusTest.java
index 84d17212169..193eea7c5f9 100644
--- a/iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/simple/SimpleConsensusTest.java
+++ b/iotdb-core/consensus/src/test/java/org/apache/iotdb/consensus/simple/SimpleConsensusTest.java
@@ -35,7 +35,11 @@ import org.apache.iotdb.consensus.common.Peer;
import org.apache.iotdb.consensus.common.request.ByteBufferConsensusRequest;
import org.apache.iotdb.consensus.common.request.IConsensusRequest;
import org.apache.iotdb.consensus.config.ConsensusConfig;
-import org.apache.iotdb.consensus.exception.*;
+import org.apache.iotdb.consensus.exception.ConsensusException;
+import org.apache.iotdb.consensus.exception.ConsensusGroupAlreadyExistException;
+import org.apache.iotdb.consensus.exception.ConsensusGroupNotExistException;
+import org.apache.iotdb.consensus.exception.IllegalPeerEndpointException;
+import org.apache.iotdb.consensus.exception.IllegalPeerNumException;
import org.apache.ratis.util.FileUtils;
import org.junit.After;
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
index e0fd46ba4fe..b0d5c9a6c80 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/RegionMigrateService.java
@@ -34,7 +34,6 @@ import org.apache.iotdb.commons.service.IService;
import org.apache.iotdb.commons.service.ServiceType;
import org.apache.iotdb.confignode.rpc.thrift.TRegionMigrateResultReportReq;
import org.apache.iotdb.consensus.common.Peer;
-import org.apache.iotdb.consensus.common.response.ConsensusGenericResponse;
import org.apache.iotdb.consensus.exception.ConsensusException;
import org.apache.iotdb.db.consensus.DataRegionConsensusImpl;
import org.apache.iotdb.db.consensus.SchemaRegionConsensusImpl;
@@ -216,9 +215,9 @@ public class RegionMigrateService implements IService {
"{}, Start to addPeer {} for region {}", REGION_MIGRATE_PROCESS, destDataNode, tRegionId);
ConsensusGroupId regionId = ConsensusGroupId.Factory.createFromTConsensusGroupId(tRegionId);
TSStatus status = new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode());
- ConsensusGenericResponse resp = null;
TEndPoint destEndpoint = getConsensusEndPoint(destDataNode, regionId);
boolean addPeerSucceed = true;
+ Throwable throwable = null;
for (int i = 0; i < MAX_RETRY_NUM; i++) {
try {
if (!addPeerSucceed) {
@@ -230,6 +229,7 @@ public class RegionMigrateService implements IService {
}
} catch (Throwable e) {
addPeerSucceed = false;
+ throwable = e;
taskLogger.error(
"{}, executed addPeer {} for region {} error, retry times: {}",
REGION_MIGRATE_PROCESS,
@@ -243,9 +243,9 @@ public class RegionMigrateService implements IService {
if (!addPeerSucceed) {
String errorMsg =
String.format(
- "%s, AddPeer for region error after max retry times, peerId: %s, regionId: %s, resp: %s",
- REGION_MIGRATE_PROCESS, destEndpoint, regionId, resp);
- taskLogger.error(errorMsg);
+ "%s, AddPeer for region error after max retry times, peerId: %s, regionId: %s",
+ REGION_MIGRATE_PROCESS, destEndpoint, regionId);
+ taskLogger.error(errorMsg, throwable);
status.setCode(TSStatusCode.MIGRATE_REGION_ERROR.getStatusCode());
status.setMessage(errorMsg);
return status;
@@ -302,7 +302,7 @@ public class RegionMigrateService implements IService {
REGION_MIGRATE_PROCESS,
destEndPoint,
regionId);
- ConsensusGenericResponse resp = null;
+ Throwable throwable = null;
boolean removePeerSucceed = true;
for (int i = 0; i < MAX_RETRY_NUM; i++) {
try {
@@ -316,6 +316,7 @@ public class RegionMigrateService implements IService {
}
} catch (Throwable e) {
removePeerSucceed = false;
+ throwable = e;
taskLogger.error(
"{}, executed removePeer {} for region {} error, retry times: {}",
REGION_MIGRATE_PROCESS,
@@ -329,9 +330,9 @@ public class RegionMigrateService implements IService {
if (!removePeerSucceed) {
String errorMsg =
String.format(
- "%s, RemovePeer for region error after max retry times, peerId: %s, regionId: %s, resp: %s",
- REGION_MIGRATE_PROCESS, destEndPoint, regionId, resp);
- taskLogger.error(errorMsg);
+ "%s, RemovePeer for region error after max retry times, peerId: %s, regionId: %s",
+ REGION_MIGRATE_PROCESS, destEndPoint, regionId);
+ taskLogger.error(errorMsg, throwable);
status.setCode(TSStatusCode.MIGRATE_REGION_ERROR.getStatusCode());
status.setMessage(errorMsg);
return status;
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionReadExecutorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionReadExecutorTest.java
index 426a5a729fd..92e7d58461f 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionReadExecutorTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionReadExecutorTest.java
@@ -24,7 +24,6 @@ import org.apache.iotdb.commons.consensus.DataRegionId;
import org.apache.iotdb.commons.consensus.SchemaRegionId;
import org.apache.iotdb.consensus.IConsensus;
import org.apache.iotdb.consensus.common.DataSet;
-import org.apache.iotdb.consensus.common.response.ConsensusReadResponse;
import org.apache.iotdb.consensus.exception.ConsensusException;
import org.apache.iotdb.db.queryengine.common.FragmentInstanceId;
import org.apache.iotdb.db.queryengine.common.PlanFragmentId;
@@ -63,15 +62,13 @@ public class RegionReadExecutorTest {
RegionReadExecutor executor =
new RegionReadExecutor(dataRegionConsensus, schemaRegionConsensus, fragmentInstanceManager);
- ConsensusReadResponse readResponse = Mockito.mock(ConsensusReadResponse.class);
- Mockito.when(readResponse.isSuccess()).thenReturn(true);
+ DataSet dataSet = Mockito.mock(DataSet.class);
FragmentInstanceInfo fragmentInstanceInfo = Mockito.mock(FragmentInstanceInfo.class);
- Mockito.when(readResponse.getDataset()).thenReturn(fragmentInstanceInfo);
+ Mockito.when(dataSet).thenReturn(fragmentInstanceInfo);
Mockito.when(fragmentInstanceInfo.getState()).thenReturn(RUNNING);
Mockito.when(fragmentInstanceInfo.getMessage()).thenReturn("data-success");
- Mockito.when(dataRegionConsensus.read(dataRegionGroupId, fragmentInstance))
- .thenReturn((DataSet) readResponse);
+ Mockito.when(dataRegionConsensus.read(dataRegionGroupId, fragmentInstance)).thenReturn(dataSet);
RegionExecutionResult res = executor.execute(dataRegionGroupId, fragmentInstance);
@@ -81,13 +78,12 @@ public class RegionReadExecutorTest {
// schema query
ConsensusGroupId schemaRegionGroupId = new SchemaRegionId(1);
- Mockito.when(readResponse.isSuccess()).thenReturn(true);
- Mockito.when(readResponse.getDataset()).thenReturn(fragmentInstanceInfo);
+ Mockito.when(dataSet).thenReturn(fragmentInstanceInfo);
Mockito.when(fragmentInstanceInfo.getState()).thenReturn(RUNNING);
Mockito.when(fragmentInstanceInfo.getMessage()).thenReturn("schema-success");
Mockito.when(schemaRegionConsensus.read(schemaRegionGroupId, fragmentInstance))
- .thenReturn((DataSet) readResponse);
+ .thenReturn(dataSet);
res = executor.execute(schemaRegionGroupId, fragmentInstance);
@@ -148,12 +144,9 @@ public class RegionReadExecutorTest {
RegionReadExecutor executor =
new RegionReadExecutor(dataRegionConsensus, schemaRegionConsensus, fragmentInstanceManager);
- ConsensusReadResponse readResponse = Mockito.mock(ConsensusReadResponse.class);
- Mockito.when(readResponse.isSuccess()).thenReturn(false);
- Mockito.when(readResponse.getException()).thenReturn(new ConsensusException("data-exception"));
+ DataSet dataSet = Mockito.mock(DataSet.class);
- Mockito.when(dataRegionConsensus.read(dataRegionGroupId, fragmentInstance))
- .thenReturn((DataSet) readResponse);
+ Mockito.when(dataRegionConsensus.read(dataRegionGroupId, fragmentInstance)).thenReturn(dataSet);
RegionExecutionResult res = executor.execute(dataRegionGroupId, fragmentInstance);
@@ -163,11 +156,8 @@ public class RegionReadExecutorTest {
// schema query
ConsensusGroupId schemaRegionGroupId = new SchemaRegionId(1);
- Mockito.when(readResponse.isSuccess()).thenReturn(false);
- Mockito.when(readResponse.getException()).thenReturn(null);
-
Mockito.when(schemaRegionConsensus.read(schemaRegionGroupId, fragmentInstance))
- .thenReturn((DataSet) readResponse);
+ .thenReturn(dataSet);
res = executor.execute(schemaRegionGroupId, fragmentInstance);
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutorTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutorTest.java
index 59eefb601b3..5c6b5ec1552 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutorTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/executor/RegionWriteExecutorTest.java
@@ -25,7 +25,6 @@ import org.apache.iotdb.commons.consensus.DataRegionId;
import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.consensus.IConsensus;
-import org.apache.iotdb.consensus.common.response.ConsensusWriteResponse;
import org.apache.iotdb.consensus.exception.ConsensusException;
import org.apache.iotdb.db.protocol.thrift.impl.DataNodeRegionManager;
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeId;
@@ -80,10 +79,10 @@ public class RegionWriteExecutorTest {
Mockito.when(regionManager.getRegionLock(dataRegionGroupId))
.thenReturn(new ReentrantReadWriteLock());
- ConsensusWriteResponse writeResponse = Mockito.mock(ConsensusWriteResponse.class);
+ TSStatus writeResponse = Mockito.mock(TSStatus.class);
Mockito.when(dataRegionConsensus.write(dataRegionGroupId, planNode)).thenReturn(writeResponse);
- Mockito.when(writeResponse.getStatus()).thenReturn(null);
+ Mockito.when(writeResponse).thenReturn(null);
RegionExecutionResult res = executor.execute(dataRegionGroupId, planNode);
assertFalse(res.isAccepted());
@@ -95,7 +94,6 @@ public class RegionWriteExecutorTest {
Mockito.when(triggerFireVisitor.process(planNode, TriggerEvent.BEFORE_INSERT))
.thenReturn(TriggerFireResult.SUCCESS);
- Mockito.when(writeResponse.isSuccessful()).thenReturn(true);
Mockito.when(triggerFireVisitor.process(planNode, TriggerEvent.AFTER_INSERT))
.thenReturn(TriggerFireResult.TERMINATION);
res = executor.execute(dataRegionGroupId, planNode);
@@ -103,7 +101,7 @@ public class RegionWriteExecutorTest {
Mockito.when(triggerFireVisitor.process(planNode, TriggerEvent.AFTER_INSERT))
.thenReturn(TriggerFireResult.SUCCESS);
- Mockito.when(writeResponse.getStatus())
+ Mockito.when(writeResponse)
.thenReturn(new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
res = executor.execute(dataRegionGroupId, planNode);
assertTrue(res.isAccepted());
diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
index bc319d63525..c72267e256e 100644
--- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
+++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/service/DataNodeInternalRPCServiceImplTest.java
@@ -81,8 +81,8 @@ public class DataNodeInternalRPCServiceImplTest {
SchemaEngine.getInstance().init();
SchemaEngine.getInstance()
.createSchemaRegion(new PartialPath("root.ln"), new SchemaRegionId(0));
- DataRegionConsensusImpl.setupAndGetInstance().start();
- SchemaRegionConsensusImpl.setupAndGetInstance().start();
+ DataRegionConsensusImpl.getInstance().start();
+ SchemaRegionConsensusImpl.getInstance().start();
DataNodeRegionManager.getInstance().init();
}