Skip to content

Commit a2b593d

Browse files
committed
ZOOKEEPER-4352
1 parent 7246445 commit a2b593d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,15 +865,17 @@ boolean syncFollower(long peerLastZxid, LearnerMaster learnerMaster) {
865865
currentZxid = maxCommittedLog;
866866
needOpPacket = false;
867867
needSnap = false;
868-
} else if ((maxCommittedLog >= peerLastZxid) && (minCommittedLog <= peerLastZxid)) {
868+
} else if ((maxCommittedLog >= peerLastZxid) && (minCommittedLog <= peerLastZxid) && (minCommittedLog > 0)) {
869869
// Follower is within commitLog range
870870
LOG.info("Using committedLog for peer sid: {}", getSid());
871871
Iterator<Proposal> itr = db.getCommittedLog().iterator();
872872
currentZxid = queueCommittedProposals(itr, peerLastZxid, null, maxCommittedLog);
873873
needSnap = false;
874-
} else if (peerLastZxid < minCommittedLog && txnLogSyncEnabled) {
874+
} else if (peerLastZxid <= minCommittedLog && txnLogSyncEnabled) {
875875
// Use txnlog and committedLog to sync
876-
876+
LOG.info(
877+
"Use txnlog and committedLog to sync:{}. peerLastZxid={}, minCommittedLog={}",
878+
getSid(), peerLastZxid, minCommittedLog);
877879
// Calculate sizeLimit that we allow to retrieve txnlog from disk
878880
long sizeLimit = db.calculateTxnLogSizeLimit();
879881
// This method can return empty iterator if the requested zxid

0 commit comments

Comments
 (0)