hanm commented on a change in pull request #1047: [ZOOKEEPER-3500] Improving 
the ZAB UPTODATE semantic to only issue it to learner when there is limited 
lagging
URL: https://github.com/apache/zookeeper/pull/1047#discussion_r319274979
 
 

 ##########
 File path: 
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/LearnerHandler.java
 ##########
 @@ -615,21 +632,30 @@ public void run() {
             syncThrottler.endSync();
             syncThrottler = null;
 
-            // now that the ack has been processed expect the syncLimit
-            sock.setSoTimeout(learnerMaster.syncTimeout());
-
             /*
              * Wait until learnerMaster starts up
              */
             learnerMaster.waitForStartup();
 
+            int queueSize = queuedPackets.size();
+            while (upToDatePacketsLimit > 0 && queueSize > 
upToDatePacketsLimit) {
+                LOG.info("Waiting for learner queue to be drained before " +
+                        "sending UPTODATE to {}, current queue size: {}",
+                        sid, queueSize);
+                Thread.sleep(100);
 
 Review comment:
   make sense. 
   
   is it possible this loop never finishes? It seems that the `queuedPackets` 
will be drained but no packets will be further queued in the same time, when we 
are inside this loop, so it should terminate, but just to double check.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to