private CompletableFuture<Void> trySyncTableToPeerCluster(TableName tableName, byte[][] splits,
    ReplicationPeerDescription peer) {
    Configuration peerConf;
    try {
      peerConf = ReplicationPeerConfigUtil
        .getPeerClusterConfiguration(connection.getConfiguration(), peer.getPeerConfig());
    } catch (IOException e) {
      return failedFuture(e);
    }
    URI connectionUri =
      ConnectionRegistryFactory.tryParseAsConnectionURI(peer.getPeerConfig().getClusterKey());
    CompletableFuture<Void> future = new CompletableFuture<>();
    addListener(ConnectionFactory.createAsyncConnection(connectionUri, peerConf), (conn, err) -> {
      if (err != null) {
        future.completeExceptionally(err);
        return;
      }
      addListener(getDescriptor(tableName), (tableDesc, err1) -> {
        if (err1 != null) {
          future.completeExceptionally(err1);
          return;
        }
        AsyncAdmin peerAdmin = conn.getAdmin();
        addListener(peerAdmin.tableExists(tableName), (exist, err2) -> {
          if (err2 != null) {
            future.completeExceptionally(err2);
            return;
          }
          if (!exist) {
            CompletableFuture<Void> createTableFuture = null;
            if (splits == null) {
              createTableFuture = peerAdmin.createTable(tableDesc);
            } else {
              createTableFuture = peerAdmin.createTable(tableDesc, splits);
            }
            addListener(createTableFuture, (result, err3) -> {
              if (err3 != null) {
                future.completeExceptionally(err3);
              } else {
                future.complete(result);
              }
            });
          } else {
            addListener(compareTableWithPeerCluster(tableName, tableDesc, peer, peerAdmin),
              (result, err4) -> {
                if (err4 != null) {
                  future.completeExceptionally(err4);
                } else {
                  future.complete(result);
                }
              });
          }
        });
      });
    });
    return future;
  }
Connect to peer and check the table descriptor on peer:
<ol>
<li>Create the same table on peer when not exist.</li>
<li>Throw an exception if the table already has replication enabled on any of the column
families.</li>
<li>Throw an exception if the table exists on peer cluster but descriptors are not same.</li>
</ol>
@param tableName name of the table to sync to the peer
@param splits    table split keys
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java