[
https://issues.apache.org/jira/browse/ZOOKEEPER-4772?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
May updated ZOOKEEPER-4772:
---------------------------
Component/s: quorum
> Wrong sync logic in LearnerHandler when sync (0,0) to a new epoch follower
> --------------------------------------------------------------------------
>
> Key: ZOOKEEPER-4772
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4772
> Project: ZooKeeper
> Issue Type: Bug
> Components: quorum, server
> Affects Versions: 3.7.2, 3.8.3, 3.9.1
> Reporter: May
> Priority: Major
>
> Current LearnerHandler's syncFollower does not consider the situation that
> the proposal (0,0) is committed and snaped. It will not use snap to sync when
> minCommittedLog is 0.
> The bug can be reproduced by modifying testNewEpochZxid in LearnerHandlerTest:
> {code:java}
> public void testNewEpochZxid() throws Exception {
> long peerZxid;
> db.txnLog.add(createProposal(getZxid(0, 0))); // Added
> db.txnLog.add(createProposal(getZxid(0, 1)));
> db.txnLog.add(createProposal(getZxid(1, 1)));
> db.txnLog.add(createProposal(getZxid(1, 2)));
> // After leader election, lastProcessedZxid will point to new epoch
> db.lastProcessedZxid = getZxid(2, 0);
> db.committedLog.add(createProposal(getZxid(0, 0))); // Added
> db.committedLog.add(createProposal(getZxid(1, 1)));
> db.committedLog.add(createProposal(getZxid(1, 2)));
> // Peer has zxid of epoch 0
> peerZxid = getZxid(0, 0);
> // We should get snap, we can do better here, but the main logic is
> // that we should never send diff if we have never seen any txn older
> // than peer zxid
> assertTrue(learnerHandler.syncFollower(peerZxid, leader)); // Fail
> here
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)