In QuoromCnxManager we are adding sent messgae to lastMessageSent, but we are
never removing that message from it after sending it, so this will lead to
sending the same message again in next round
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: ZOOKEEPER-986
URL: https://issues.apache.org/jira/browse/ZOOKEEPER-986
Project: ZooKeeper
Issue Type: Bug
Components: quorum
Affects Versions: 3.3.2
Environment: Windows
Reporter: Sandeep Maheshwari
Priority: Minor
Fix For: 3.3.3
Function for sending out the notification message to corresponding peer for
leader election
private void processMessages() throws Exception {
try {
ByteBuffer b = getLastMessageSent(sid);
if (b != null) {
send(b);
}
} catch (IOException e) {
LOG.error("Failed to send last message to " + sid, e);
throw e;
}
try {
ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.get(sid);
if (bq == null) {
dumpQueueSendMap();
throw new Exception("No queue for incoming messages for " +
"sid=" + sid);
}
while (running && !shutdown && sock != null) {
ByteBuffer b = null;
try {
b = bq.poll(1000, TimeUnit.MILLISECONDS);
if(b != null){
recordLastMessageSent(sid, b);
send(b);
}
} catch (InterruptedException e) {
LOG.warn("Interrupted while waiting for message on " +
"queue", e);
}
}
} catch (Exception e) {
LOG.warn("Exception when using channel: for id " + sid
+ " my id = " + self.getId() + " error = ", e);
throw e;
}
}
This is the code taken from zookeeper patch 932.
Here we are adding the message to be sent in current round to lastMessageSent.
But in next round that message will still be there. So when we try to send a
new message to server it will again do
ByteBuffer b = getLastMessageSent(sid);
if (b != null) {
send(b);
}
and it will again send back that old message to that server. So in this way it
will send back every message twice. Though it will not affect the correctness
of FLE but sending message twice it create an extra overhead and slow down the
election process.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira