code: @Override
    public void truncate(Zxid zxid) throws IOException {
      try (SimpleLogIterator iter = new SimpleLogIterator(this.logFile)) {
        this.lastSeenZxid = Zxid.ZXID_NOT_EXIST;
        while (iter.hasNext()) {
          Transaction txn = iter.next();
          if (txn.getZxid().compareTo(zxid) == 0) {
            this.lastSeenZxid = txn.getZxid();
            break;
          }
          if (txn.getZxid().compareTo(zxid) > 0) {
            iter.backward();
            break;
          }
          this.lastSeenZxid = txn.getZxid();
        }
        if (iter.hasNext()) {
          // It means there's something to truncate.
          try (RandomAccessFile ra = new RandomAccessFile(this.logFile, "rw")) {
            // Truncate the file from given position.
            ra.setLength(iter.getPosition());
          }
        }
      }
    }
docs: Truncates this transaction log at the given zxid.
  This method deletes all the transactions with zxids
  higher than the given zxid.
  
  @param zxid the transaction id.
  @throws IOException in case of IO failure