Skip to content

Commit 8b23eef

Browse files
petersomogyiGuanghao Zhang
authored andcommitted
HBASE-23642 Reintroduce ReplicationUtils.contains as deprecated (apache#983)
Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org> Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: stack <stack@apache.org> Signed-off-by: Jan Hentschel <janh@apache.org>
1 parent 910f8e0 commit 8b23eef

1 file changed

Lines changed: 12 additions & 38 deletions

File tree

hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationUtils.java

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -154,44 +154,6 @@ public static boolean isReplicationForBulkLoadDataEnabled(final Configuration c)
154154
HConstants.REPLICATION_BULKLOAD_ENABLE_DEFAULT);
155155
}
156156

157-
/**
158-
* Returns whether we should replicate the given table.
159-
*/
160-
public static boolean contains(ReplicationPeerConfig peerConfig, TableName tableName) {
161-
String namespace = tableName.getNamespaceAsString();
162-
if (peerConfig.replicateAllUserTables()) {
163-
// replicate all user tables, but filter by exclude namespaces and table-cfs config
164-
Set<String> excludeNamespaces = peerConfig.getExcludeNamespaces();
165-
if (excludeNamespaces != null && excludeNamespaces.contains(namespace)) {
166-
return false;
167-
}
168-
Map<TableName, List<String>> excludedTableCFs = peerConfig.getExcludeTableCFsMap();
169-
// trap here, must check existence first since HashMap allows null value.
170-
if (excludedTableCFs == null || !excludedTableCFs.containsKey(tableName)) {
171-
return true;
172-
}
173-
List<String> cfs = excludedTableCFs.get(tableName);
174-
// if cfs is null or empty then we can make sure that we do not need to replicate this table,
175-
// otherwise, we may still need to replicate the table but filter out some families.
176-
return cfs != null && !cfs.isEmpty();
177-
} else {
178-
// Not replicate all user tables, so filter by namespaces and table-cfs config
179-
Set<String> namespaces = peerConfig.getNamespaces();
180-
Map<TableName, List<String>> tableCFs = peerConfig.getTableCFsMap();
181-
182-
if (namespaces == null && tableCFs == null) {
183-
return false;
184-
}
185-
186-
// First filter by namespaces config
187-
// If table's namespace in peer config, all the tables data are applicable for replication
188-
if (namespaces != null && namespaces.contains(namespace)) {
189-
return true;
190-
}
191-
return tableCFs != null && tableCFs.containsKey(tableName);
192-
}
193-
}
194-
195157
public static FileSystem getRemoteWALFileSystem(Configuration conf, String remoteWALDir)
196158
throws IOException {
197159
return new Path(remoteWALDir).getFileSystem(conf);
@@ -242,6 +204,18 @@ public static boolean shouldSyncTableSchema(Configuration conf) {
242204
HConstants.REPLICATION_SYNC_TABLE_SCHEMA_DEFAULT);
243205
}
244206

207+
/**
208+
* @deprecated Will be removed in HBase 3.
209+
* Use {@link ReplicationPeerConfig#needToReplicate(TableName)} instead.
210+
* @param peerConfig configuration for the replication peer cluster
211+
* @param tableName name of the table
212+
* @return true if the table need replicate to the peer cluster
213+
*/
214+
@Deprecated
215+
public static boolean contains(ReplicationPeerConfig peerConfig, TableName tableName) {
216+
return peerConfig.needToReplicate(tableName);
217+
}
218+
245219
/**
246220
* Get the adaptive timeout value when performing a retry
247221
*/

0 commit comments

Comments
 (0)