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

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.7.0
    • Fix Version/s: None
    • Component/s: server
    • Labels:
      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

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

              Dates

              • Created:
                Updated: