@Override
  public List<ReplicationQueueId> listAllQueueIds(ServerName serverName)
    throws ReplicationException {
    List<ReplicationQueueId> queueIds = new ArrayList<>();
    try (Table table = conn.getTable(tableName)) {
      KeyOnlyFilter keyOnlyFilter = new KeyOnlyFilter();
      String previousPeerId = null;
      for (;;) {
        // first, get the next peerId
        Scan peerScan =
          new Scan().addFamily(QUEUE_FAMILY).setOneRowLimit().setFilter(keyOnlyFilter);
        if (previousPeerId != null) {
          peerScan.withStartRow(ReplicationQueueId.getScanStartRowForNextPeerId(previousPeerId));
        }
        String peerId;
        try (ResultScanner scanner = table.getScanner(peerScan)) {
          Result result = scanner.next();
          if (result == null) {
            // no more peers, break
            break;
          }
          peerId = ReplicationQueueId.getPeerId(Bytes.toString(result.getRow()));
        }
        listAllQueueIds(table, peerId, serverName, queueIds);
        previousPeerId = peerId;
      }
    } catch (IOException e) {
      throw new ReplicationException("failed to listAllQueueIds, serverName=" + serverName, e);
    }
    return queueIds;
  }
HBase table based replication queue storage.
hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/TableReplicationQueueStorage.java