This is an automated email from the ASF dual-hosted git repository.

jiangtian pushed a commit to branch native_raft
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/native_raft by this push:
     new 083c8c0780 change catch-up condition
083c8c0780 is described below

commit 083c8c07807786a72e15901b9c633e73ef9b9df7
Author: Tian Jiang <[email protected]>
AuthorDate: Tue Feb 28 09:07:27 2023 +0800

    change catch-up condition
---
 .../consensus/natraft/protocol/heartbeat/HeartbeatRespHandler.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/heartbeat/HeartbeatRespHandler.java
 
b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/heartbeat/HeartbeatRespHandler.java
index 326c5367f1..c423082132 100644
--- 
a/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/heartbeat/HeartbeatRespHandler.java
+++ 
b/consensus/src/main/java/org/apache/iotdb/consensus/natraft/protocol/heartbeat/HeartbeatRespHandler.java
@@ -103,7 +103,8 @@ public class HeartbeatRespHandler implements 
AsyncMethodCallback<HeartBeatRespon
 
     PeerInfo peerInfo = localMember.getStatus().getPeerMap().get(peer);
     if (!localMember.getLogManager().isLogUpToDate(lastLogTerm, lastLogIdx)
-        || !localMember.getLogManager().matchTerm(lastLogTerm, lastLogIdx)) {
+        || (lastLogIdx == localLastLogIdx
+            && !localMember.getLogManager().matchTerm(lastLogTerm, 
lastLogIdx))) {
       // the follower is not up-to-date
       if (lastLogIdx == -1 || lastLogIdx < peerInfo.getMatchIndex()) {
         // maybe the follower has restarted, so we need to find its match 
index again, because

Reply via email to