Github user anmolnar commented on the issue:
https://github.com/apache/zookeeper/pull/300
@afine If I'm not mistaken there's a thread running which receives messages
from the Leader in QuorumPeer.java:997:
Call stack is:
QuorumPeer.run() -> Follower.followLeader() -> Follower.processPacket() ->
FollowerZookeeperServer.commit()
This code path could potentially add more commit messages to the queue
which are not related to the sync.
Even if I'm wrong with the above, @shralex 's concern is still valid: "Even
if you drain the committedRequests, I'm not sure that guarantees that there are
no more that will arrive."
It's possible to drain the commit queue faster than leader sends messages.
In other words: draining the commit queue doesn't seem to guarantee that
the sync is complete.
---