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 2022/11/16 02:32:21 UTC
[iotdb] branch multi_leader_memory_pendingBatch_control updated: fix gap from wal bug
This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch multi_leader_memory_pendingBatch_control
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/multi_leader_memory_pendingBatch_control by this push:
new 57da519af4 fix gap from wal bug
57da519af4 is described below
commit 57da519af42b7026133900f410649037cad2946c
Author: OneSizeFitQuorum <ta...@apache.org>
AuthorDate: Wed Nov 16 10:30:51 2022 +0800
fix gap from wal bug
Signed-off-by: OneSizeFitQuorum <ta...@apache.org>
---
.../multileader/logdispatcher/LogDispatcher.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/LogDispatcher.java b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/LogDispatcher.java
index f0b4791ea8..ac8edb87c2 100644
--- a/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/LogDispatcher.java
+++ b/consensus/src/main/java/org/apache/iotdb/consensus/multileader/logdispatcher/LogDispatcher.java
@@ -389,11 +389,14 @@ public class LogDispatcher {
// Prevents gap between logs. For example, some requests are not written into the queue when
// the queue is full. In this case, requests need to be loaded from the WAL
- constructBatchFromWAL(startIndex, prev.getSearchIndex(), batches);
- if (!batches.canAccumulate()) {
- batches.buildIndex();
- logger.debug("{} : accumulated a {} from wal", impl.getThisNode().getGroupId(), batches);
- return batches;
+ if (startIndex != prev.getSearchIndex()) {
+ constructBatchFromWAL(startIndex, prev.getSearchIndex(), batches);
+ if (!batches.canAccumulate()) {
+ batches.buildIndex();
+ logger.debug(
+ "{} : accumulated a {} from wal", impl.getThisNode().getGroupId(), batches);
+ return batches;
+ }
}
constructBatchIndexedFromConsensusRequest(prev, batches);
@@ -411,7 +414,7 @@ public class LogDispatcher {
// Prevents gap between logs. For example, some logs are not written into the queue when
// the queue is full. In this case, requests need to be loaded from the WAL
if (current.getSearchIndex() != prev.getSearchIndex() + 1) {
- constructBatchFromWAL(prev.getSearchIndex(), current.getSearchIndex(), batches);
+ constructBatchFromWAL(prev.getSearchIndex() + 1, current.getSearchIndex(), batches);
if (!batches.canAccumulate()) {
batches.buildIndex();
logger.debug(