This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch ml_0729_test
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/ml_0729_test by this push:
new aed6fa504f remove statemachine lock in processor
aed6fa504f is described below
commit aed6fa504fb6ba80b44fdffb506d3feae2d0a193
Author: Jinrui.Zhang <[email protected]>
AuthorDate: Fri Jul 29 12:06:34 2022 +0800
remove statemachine lock in processor
---
.../iotdb/consensus/config/MultiLeaderConfig.java | 2 +-
.../service/MultiLeaderRPCServiceProcessor.java | 36 ++++++++++------------
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
b/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
index e4f66f557b..9d4665e4d4 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/config/MultiLeaderConfig.java
@@ -249,7 +249,7 @@ public class MultiLeaderConfig {
public static class Builder {
private int maxPendingRequestNumPerNode = 200;
private int maxRequestPerBatch = 40;
- private int maxPendingBatch = 1;
+ private int maxPendingBatch = 5;
private int maxWaitingTimeForAccumulatingBatchInMs = 500;
private long basicRetryWaitTimeMs = TimeUnit.MILLISECONDS.toMillis(100);
private long maxRetryWaitTimeMs = TimeUnit.SECONDS.toMillis(20);
diff --git
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
index 3fc63c7d99..69375872c1 100644
---
a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
+++
b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/service/MultiLeaderRPCServiceProcessor.java
@@ -70,29 +70,27 @@ public class MultiLeaderRPCServiceProcessor implements
MultiLeaderConsensusIServ
List<TSStatus> statuses = new ArrayList<>();
// We use synchronized to ensure atomicity of executing multiple logs
if (!req.getBatches().isEmpty()) {
- synchronized (impl.getStateMachine()) {
- List<IConsensusRequest> consensusRequests = new ArrayList<>();
- long currentSearchIndex = req.getBatches().get(0).getSearchIndex();
- for (TLogBatch batch : req.getBatches()) {
- IConsensusRequest request =
- batch.isFromWAL()
- ? new MultiLeaderConsensusRequest(batch.data)
- : new ByteBufferConsensusRequest(batch.data);
- // merge TLogBatch with same search index into one request
- if (batch.getSearchIndex() != currentSearchIndex) {
- statuses.add(
- impl.getStateMachine()
-
.write(impl.buildIndexedConsensusRequestForRemoteRequest(consensusRequests)));
- consensusRequests = new ArrayList<>();
- }
- consensusRequests.add(request);
- }
- // write last request
- if (!consensusRequests.isEmpty()) {
+ List<IConsensusRequest> consensusRequests = new ArrayList<>();
+ long currentSearchIndex = req.getBatches().get(0).getSearchIndex();
+ for (TLogBatch batch : req.getBatches()) {
+ IConsensusRequest request =
+ batch.isFromWAL()
+ ? new MultiLeaderConsensusRequest(batch.data)
+ : new ByteBufferConsensusRequest(batch.data);
+ // merge TLogBatch with same search index into one request
+ if (batch.getSearchIndex() != currentSearchIndex) {
statuses.add(
impl.getStateMachine()
.write(impl.buildIndexedConsensusRequestForRemoteRequest(consensusRequests)));
+ consensusRequests = new ArrayList<>();
}
+ consensusRequests.add(request);
+ }
+ // write last request
+ if (!consensusRequests.isEmpty()) {
+ statuses.add(
+ impl.getStateMachine()
+
.write(impl.buildIndexedConsensusRequestForRemoteRequest(consensusRequests)));
}
}
logger.debug("Execute TSyncLogReq for {} with result {}",
req.consensusGroupId, statuses);