private CompletableFuture<Void> compareTableWithPeerCluster(TableName tableName,
    TableDescriptor tableDesc, ReplicationPeerDescription peer, AsyncAdmin peerAdmin) {
    CompletableFuture<Void> future = new CompletableFuture<>();
    addListener(peerAdmin.getDescriptor(tableName), (peerTableDesc, err) -> {
      if (err != null) {
        future.completeExceptionally(err);
        return;
      }
      if (peerTableDesc == null) {
        future.completeExceptionally(
          new IllegalArgumentException("Failed to get table descriptor for table "
            + tableName.getNameAsString() + " from peer cluster " + peer.getPeerId()));
        return;
      }
      if (TableDescriptor.COMPARATOR_IGNORE_REPLICATION.compare(peerTableDesc, tableDesc) != 0) {
        future.completeExceptionally(new IllegalArgumentException(
          "Table " + tableName.getNameAsString() + " exists in peer cluster " + peer.getPeerId()
            + ", but the table descriptors are not same when compared with source cluster."
            + " Thus can not enable the table's replication switch."));
        return;
      }
      future.complete(null);
    });
    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