This is an automated email from the ASF dual-hosted git repository.
chaow pushed a commit to branch rel/0.12
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/0.12 by this push:
new 98d5f1c [rel/0.12][IOTDB-1317] Log CatchUp always failed du to not
check the follower's match index (#3030)
98d5f1c is described below
commit 98d5f1c5909588bc45b4989f744401283952f740
Author: HouliangQi <[email protected]>
AuthorDate: Tue Apr 20 18:04:07 2021 +0800
[rel/0.12][IOTDB-1317] Log CatchUp always failed du to not check the
follower's match index (#3030)
---
.../iotdb/cluster/log/catchup/CatchUpTask.java | 48 ++++++++++++++--------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/log/catchup/CatchUpTask.java
b/cluster/src/main/java/org/apache/iotdb/cluster/log/catchup/CatchUpTask.java
index d04227b..1472b12 100644
---
a/cluster/src/main/java/org/apache/iotdb/cluster/log/catchup/CatchUpTask.java
+++
b/cluster/src/main/java/org/apache/iotdb/cluster/log/catchup/CatchUpTask.java
@@ -114,26 +114,38 @@ public class CatchUpTask implements Runnable {
int index = findLastMatchIndex(logs);
if (index == -1) {
- logger.info("Cannot find matched of {} within [{}, {}] in memory", node,
lo, hi);
- if (judgeUseLogsInDiskToCatchUp()) {
- long startIndex = peer.getMatchIndex() + 1;
- long endIndex = raftMember.getLogManager().getCommitLogIndex();
- List<Log> logsInDisk = getLogsInStableEntryManager(startIndex,
endIndex);
- if (!logsInDisk.isEmpty()) {
- logger.info(
- "{}, found {} logs in disk to catch up {} , startIndex={},
endIndex={}, memoryFirstIndex={}, getFirstLogIndex={}",
- name,
- logsInDisk.size(),
- node,
- startIndex,
- endIndex,
- localFirstIndex,
- logsInDisk.get(0).getCurrLogIndex());
- logs = logsInDisk;
- return true;
+ logger.info("{}, Cannot find matched of {} within [{}, {}] in memory",
name, node, lo, hi);
+ if (!judgeUseLogsInDiskToCatchUp()) {
+ return false;
+ }
+ long startIndex = peer.getMatchIndex() + 1;
+ long endIndex = raftMember.getLogManager().getCommitLogIndex();
+ List<Log> logsInDisk = getLogsInStableEntryManager(startIndex, endIndex);
+ if (!logsInDisk.isEmpty()) {
+ logger.info(
+ "{}, found {} logs in disk to catch up {} , startIndex={},
endIndex={}, memoryFirstIndex={}, getFirstLogIndex={}",
+ name,
+ logsInDisk.size(),
+ node,
+ startIndex,
+ endIndex,
+ localFirstIndex,
+ logsInDisk.get(0).getCurrLogIndex());
+ logs = logsInDisk;
+ index = findLastMatchIndex(logs);
+ // the follower's matchIndex may have been updated
+ if (index == -1) {
+ return false;
}
+ } else {
+ logger.info(
+ "{}, Cannot find matched of {} within [{}, {}] in disk",
+ name,
+ node,
+ startIndex,
+ endIndex);
+ return false;
}
- return false;
}
long newMatchedIndex = logs.get(index).getCurrLogIndex() - 1;
if (newMatchedIndex > lastLogIndex) {