@SuppressWarnings("unchecked")
  public MigrationIterator<List<ZkLastPushedSeqId>> listAllLastPushedSeqIds()
    throws KeeperException {
    List<String> level1Prefixs = ZKUtil.listChildrenNoWatch(zookeeper, regionsZNode);
    if (level1Prefixs == null || level1Prefixs.isEmpty()) {
      ZKUtil.deleteNodeRecursively(zookeeper, regionsZNode);
      return EMPTY_ITER;
    }
    Iterator<String> level1Iter = level1Prefixs.iterator();
    return new MigrationIterator<List<ZkLastPushedSeqId>>() {

      private String level1Prefix;

      private Iterator<String> level2Iter;

      private String level2Prefix;

      @Override
      public List<ZkLastPushedSeqId> next() throws Exception {
        for (;;) {
          if (level2Iter == null || !level2Iter.hasNext()) {
            if (!level1Iter.hasNext()) {
              ZKUtil.deleteNodeRecursively(zookeeper, regionsZNode);
              return null;
            }
            if (level1Prefix != null) {
              // this will also delete the previous level2Prefix which is under this level1Prefix
              ZKUtil.deleteNodeRecursively(zookeeper,
                ZNodePaths.joinZNode(regionsZNode, level1Prefix));
            }
            level1Prefix = level1Iter.next();
            List<String> level2Prefixes = ZKUtil.listChildrenNoWatch(zookeeper,
              ZNodePaths.joinZNode(regionsZNode, level1Prefix));
            if (level2Prefixes != null) {
              level2Iter = level2Prefixes.iterator();
              // reset level2Prefix as we have switched level1Prefix, otherwise the below delete
              // level2Prefix section will delete the znode with this level2Prefix under the new
              // level1Prefix
              level2Prefix = null;
            }
          } else {
            if (level2Prefix != null) {
              ZKUtil.deleteNodeRecursively(zookeeper,
                ZNodePaths.joinZNode(regionsZNode, level1Prefix, level2Prefix));
            }
            level2Prefix = level2Iter.next();
            List<String> encodedRegionNameAndPeerIds = ZKUtil.listChildrenNoWatch(zookeeper,
              ZNodePaths.joinZNode(regionsZNode, level1Prefix, level2Prefix));
            if (encodedRegionNameAndPeerIds == null || encodedRegionNameAndPeerIds.isEmpty()) {
              return Collections.emptyList();
            }
            List<ZkLastPushedSeqId> lastPushedSeqIds = new ArrayList<>();
            for (String encodedRegionNameAndPeerId : encodedRegionNameAndPeerIds) {
              byte[] data = ZKUtil.getData(zookeeper, ZNodePaths.joinZNode(regionsZNode,
                level1Prefix, level2Prefix, encodedRegionNameAndPeerId));
              long lastPushedSeqId = ZKUtil.parseWALPositionFrom(data);
              Iterator<String> iter = Splitter.on('-').split(encodedRegionNameAndPeerId).iterator();
              String encodedRegionName = level1Prefix + level2Prefix + iter.next();
              String peerId = iter.next();
              lastPushedSeqIds
                .add(new ZkLastPushedSeqId(encodedRegionName, peerId, lastPushedSeqId));
            }
            return Collections.unmodifiableList(lastPushedSeqIds);
          }
        }
      }
    };
  }
The name of the znode that contains queues of hfile references to be replicated
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorageForMigration.java