code: private void waitForLastTxIdNode(AvatarZooKeeperClient zk, Configuration conf)
        throws Exception {
      // Gather session id and transaction id data.
      String address = conf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
      long maxWaitTime = this.getMaxWaitTimeForWaitTxid();
      long start = System.currentTimeMillis();
      while (true) {
        if (System.currentTimeMillis() - start > maxWaitTime) {
          throw new IOException("No valid last txid znode found");
        }
        try {
          long sessionId = zk.getPrimarySsId(address, false);
          ZookeeperTxId zkTxId = zk.getPrimaryLastTxId(address, false);
          if (sessionId != zkTxId.getSessionId()) {
            LOG.warn("Session Id in the ssid node : " + sessionId
                + " does not match the session Id in the txid node : "
                + zkTxId.getSessionId() + " retrying...");
            Thread.sleep(retrySleep);
            continue;
          }
        } catch (Throwable e) {
          LOG.warn("Caught exception : " + e + " retrying ...");
          Thread.sleep(retrySleep);
          continue;
        }
        break;
      }
    }
docs: Waits till the last txid node appears in Zookeeper, such that it matches
  the ssid node.