Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4772

Wrong sync logic in LearnerHandler when sync (0,0) to a new epoch follower

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.7.2, 3.8.3, 3.9.1
    • None
    • quorum, server
    • None

    Description

      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:

      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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            gy_way May
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: