-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HBASE-25955 Setting NAMESPACES when adding a replication peer doesn't… #3347
Conversation
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Looking this UT failure on this TestRemoveFromSerialReplicationPeer. |
@@ -103,6 +103,12 @@ protected WALEntryFilter getScopeWALEntryFilter() { | |||
/** Returns a WALEntryFilter for checking replication per table and CF. Subclasses can | |||
* return null if they don't want this filter */ | |||
protected WALEntryFilter getNamespaceTableCfWALEntryFilter() { | |||
//If none of the below sets are defined, there's no reason to create this filter | |||
if(ctx.getPeerConfig().getNamespaces()==null && ctx.getPeerConfig().getTableCFsMap()==null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we handle the empty values as well?
Strings.isNullOrEmpty(strVar)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack! Switched to CollectionUtils.isEmpty
and MapUtils.isEmpty
.
.setReplicateAllUserTables(false) | ||
// sets namespaces | ||
.setNamespaces(namespaces).build(); | ||
hbaseAdmin.addReplicationPeer("testNamespacesMutualExclusiveScopesWALEntryFilter", rpc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind making testNamespacesMutualExclusiveScopesWALEntryFilter
a constant string in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to TestName
usage.
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
Outdated
Show resolved
Hide resolved
hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.java
Outdated
Show resolved
Hide resolved
WALEntryFilter tableCfFilter = getNamespaceTableCfWALEntryFilter(); | ||
if (tableCfFilter != null) { | ||
filters.add(tableCfFilter); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means when any of the wildcard kind of setting (like one NS for include) is present, a per table:cf setting wont get honoured?
To be specific say we have 2 NS, ns1 and ns2. Now ns1 is in the include NS list. So all tables in ns1 to be replicated. Thats it. ns2 is neither in include list nor in exclude list. But ns2 having one table with CFs of replication scope = 1. But as per this change we will not consider those tables for replication as scopeFilter wont come in then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be the case. The given table/CF should be in the namespace passed, or in the TableCFsMap defined in the addPeer command. It does break compatibility, but it's still possible to achieve the same level of granularity by using a combination of ExcludeTableCFsMap/ExcludeNamespaces/namespaces/TableCFsMap, which is much more convenient than having to alter table schema (which also requires table to be offline).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we can avoid the compatibility break? May be a bigger change but can we think ways? The WALEntryFilter s to act in an OR fashion? The chain is more or less an AND model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe come up with an extra, namespace only filter, then?
ReplicationPeerConfig.newBuilder(peerConfig) | ||
.setTableCFsMap(Collections.emptyMap()) | ||
.setReplicateAllUserTables(true) | ||
.setExcludeTableCFsMap(ImmutableMap.of(tableName, Collections.emptyList())).build()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous test behaviour isn't valid anymore, as it was relying on an empty namespaces
collection to filter out entries, but now, passing null or empty namespaces
just activates the scoped filter, which will cause these table entries to be picked for replication, as its scope is set to 1
.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
Closing this one in favour of a different approach that doesn't change current behaviour. |
… have any effect