HBASE-17460 enable_table_replication can not perform cyclic replication of a table - addendum removes replication check (Janos Gub)

This commit is contained in:
tedyu 2017-03-07 19:42:26 -08:00
parent ee1549cc97
commit c42a0665b9
2 changed files with 6 additions and 42 deletions

View File

@ -1038,31 +1038,6 @@ public class HTableDescriptor implements Comparable<HTableDescriptor> {
return compareTo((HTableDescriptor)obj) == 0; return compareTo((HTableDescriptor)obj) == 0;
} }
/**
* 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() * @see java.lang.Object#hashCode()
*/ */

View File

@ -4185,16 +4185,7 @@ public class HBaseAdmin implements Admin {
if (peerHtd == null) { if (peerHtd == null) {
throw new IllegalArgumentException("Failed to get table descriptor for table " throw new IllegalArgumentException("Failed to get table descriptor for table "
+ tableName.getNameAsString() + " from peer cluster " + peerDesc.getPeerId()); + 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)) { if (!compareForReplication(peerHtd, localHtd)) {
throw new IllegalArgumentException("Table " + tableName.getNameAsString() throw new IllegalArgumentException("Table " + tableName.getNameAsString()
+ " exists in peer cluster " + peerDesc.getPeerId() + " exists in peer cluster " + peerDesc.getPeerId()
@ -4206,8 +4197,6 @@ public class HBaseAdmin implements Admin {
} }
} }
} }
}
}
/** /**
* Decide whether the table need replicate to the peer cluster according to the peer config * Decide whether the table need replicate to the peer cluster according to the peer config