jeffrey-xiao commented on code in PR #1925:
URL: https://github.com/apache/zookeeper/pull/1925#discussion_r985973680


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java:
##########
@@ -760,13 +760,21 @@ protected void syncWithLeader(long newLeaderZxid) throws 
Exception {
                     zk.startupWithoutServing();
                     if (zk instanceof FollowerZooKeeperServer) {
                         FollowerZooKeeperServer fzk = 
(FollowerZooKeeperServer) zk;
+                        fzk.syncProcessor.setDelayForwarding(true);
                         for (PacketInFlight p : packetsNotLogged) {
                             fzk.logRequest(p.hdr, p.rec, p.digest);
                         }
                         packetsNotLogged.clear();
+                        fzk.syncProcessor.syncFlush();
                     }
 
                     writePacket(new QuorumPacket(Leader.ACK, newLeaderZxid, 
null, null), true);
+
+                    if (zk instanceof FollowerZooKeeperServer) {
+                        FollowerZooKeeperServer fzk = 
(FollowerZooKeeperServer) zk;
+                        fzk.syncProcessor.setDelayForwarding(false);
+                        fzk.syncProcessor.syncFlush();

Review Comment:
   What's the reason why we need the second `syncFlush`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to