You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "May (Jira)" <ji...@apache.org> on 2023/11/27 08:08:00 UTC
[jira] [Created] (ZOOKEEPER-4772) Wrong sync logic in LearnerHandler when sync (0,0) to a new epoch follower
May created ZOOKEEPER-4772:
------------------------------
Summary: 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: server
Affects Versions: 3.9.1, 3.8.3, 3.7.2
Reporter: May
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)