HBASE-17460 enable_table_replication can not perform cyclic replication of a table - addendum removes replication check (Janos Gub)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c42a0665 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c42a0665 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c42a0665 Branch: refs/heads/hbase-12439 Commit: c42a0665b9f576d0df9aa038b4287e0627704d11 Parents: ee1549c Author: tedyu <[email protected]> Authored: Tue Mar 7 19:42:26 2017 -0800 Committer: tedyu <[email protected]> Committed: Tue Mar 7 19:42:26 2017 -0800 ---------------------------------------------------------------------- .../apache/hadoop/hbase/HTableDescriptor.java | 25 -------------------- .../apache/hadoop/hbase/client/HBaseAdmin.java | 23 +++++------------- 2 files changed, 6 insertions(+), 42 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/c42a0665/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java index 0a4d4ca..a49cf1c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java @@ -1039,31 +1039,6 @@ public class HTableDescriptor implements Comparable<HTableDescriptor> { } /** - * Detects whether replication has been already enabled on any of the column families of this - * table descriptor. - * @return true if any of the column families has replication enabled. - */ - public boolean isReplicationEnabled() { - // Go through each Column-Family descriptor and check if the - // Replication has been enabled already. - // Return 'true' if replication has been enabled on any CF, - // otherwise return 'false'. - // - boolean result = false; - Iterator<HColumnDescriptor> it = this.families.values().iterator(); - - while (it.hasNext()) { - HColumnDescriptor tempHcd = it.next(); - if (tempHcd.getScope() != HConstants.REPLICATION_SCOPE_LOCAL) { - result = true; - break; - } - } - - return result; - } - - /** * @see java.lang.Object#hashCode() */ @Override http://git-wip-us.apache.org/repos/asf/hbase/blob/c42a0665/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java ---------------------------------------------------------------------- diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index 5265616..1f143b5 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -4185,23 +4185,12 @@ public class HBaseAdmin implements Admin { if (peerHtd == null) { throw new IllegalArgumentException("Failed to get table descriptor for table " + tableName.getNameAsString() + " from peer cluster " + peerDesc.getPeerId()); - } else { - // To support cyclic replication (HBASE-17460), we need to match the - // REPLICATION_SCOPE of table on both the clusters. We should do this - // only when the replication is not already enabled on local HTD (local - // table on this cluster). - // - if (localHtd.isReplicationEnabled()) { - throw new IllegalArgumentException("Table " + tableName.getNameAsString() - + " has replication already enabled for at least one Column Family."); - } else { - if (!compareForReplication(peerHtd, localHtd)) { - throw new IllegalArgumentException("Table " + tableName.getNameAsString() - + " exists in peer cluster " + peerDesc.getPeerId() - + ", but the table descriptors are not same when compared with source cluster." - + " Thus can not enable the table's replication switch."); - } - } + } + if (!compareForReplication(peerHtd, localHtd)) { + throw new IllegalArgumentException("Table " + tableName.getNameAsString() + + " exists in peer cluster " + peerDesc.getPeerId() + + ", but the table descriptors are not same when compared with source cluster." + + " Thus can not enable the table's replication switch."); } } }
