Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Zookeeper >> mail # dev >> Potential bug with Leader.TRUNC?


Copy link to this message
-
Potential bug with Leader.TRUNC?
Hi,

In LearnerHandler, the code that sends TRUNC to the follower is shown below:

*                if (proposals.size() != 0) {
*                    if ((maxCommittedLog >= peerLastZxid)
                            && (minCommittedLog <= peerLastZxid)) {
                        packetToSend = Leader.DIFF;
                        zxidToSend = maxCommittedLog;
                        for (Proposal propose: proposals) {
                            if (propose.packet.getZxid() > peerLastZxid) {
                                queuePacket(propose.packet);
                                QuorumPacket qcommit = new
QuorumPacket(Leader.COMMIT, propose.packet.getZxid(),
                                        null, null);
                                queuePacket(qcommit);
                            }
                        }
                    } else if (peerLastZxid > maxCommittedLog) {
*                        packetToSend = Leader.TRUNC;*
                        zxidToSend = maxCommittedLog;
                        updates = zxidToSend;
                    }
                } else {
                    // just let the state transfer happen
                }
Why does it send a TRUNC only when the size of proposal's in memory is != 0?
What if after a new leader election,
the transaction log of the leader is empty (i.e., no proposals). If an old
leader tries to join and has higher transaction
ID recorded in its transaction log, then it won't truncate its transaction
log. I think with the right combination of zxid
of the transaction log and snapshot we might see this problem.

Am I misreading the code?

Thanks,
-Vishal
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB