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

truncate in FileTxnLog.java is buggy and fails to correctly truncate a file containing a single transaction only the follower saw

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.7.0
    • None
    • server
    • None

    Description

      It is possible that there is a follower, which is the old leader, with a transaction only it saw as the single entry in the log file from the last epoch. The follower tries to sync with the new leader. It gets TRUNC request, but in the truncate method of FileTxnLog.java, the FileTxnIterator will fast-forward to the log file containing the sole transaction. Also, the pos is pointing to the sole transaction, which is actually the target to truncate. Therefore, doing a setLength(pos) does not discard this transaction. The itr.goToNextLog() is not true in this case if the log file was the last one. Consequently, the transaction remains in the followers log and gets applied to the in-memory data tree of the follower. Therefore, convergence fails.

      Attachments

        Activity

          People

            Unassigned Unassigned
            anaud anaud
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: