[ 
https://issues.apache.org/jira/browse/HBASE-23345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sun Xin updated HBASE-23345:
----------------------------
    Description: 
There is duplicate code in ReplicationUtils.contains and 
ReplicationPeerConfig.needToReplicate about deciding whether a table need 
replicate to the peer cluster.
And the implementation of ReplicationPeerConfig.needToReplicate has a bug, it 
return false when replicateAllUserTables flag is true and excludeTableCFsMap 
contains not all of cfs.
 
We should copy the code from ReplicationUtils.contains to 
ReplicationPeerConfig.needToReplicate, and delete 
ReplicationUtils.contains.Because ReplicationUtils is from module replication, 
ReplicationPeerConfig is from module client, and module replication depends on 
module client.
 
In the following code, ReplicationPeerConfig.needToReplicate return false, when 
replicateAllUserTables flag is true and excludeTableCFsMap contains not all of 
cfs.
{code:java}
public boolean needToReplicate(TableName table) {
  if (replicateAllUserTables) {
  ......
    if (excludeTableCFsMap != null && excludeTableCFsMap.containsKey(table)) {
      return false;
    }
  ......
}
{code}

  was:
ReplicationPeerConfig.needToReplicate return false, when replicateAllUserTables 
is true and excludeTableCFsMap contains part of cfs.

Should judge by whether all of cfs are excluded.
{code:java}
public boolean needToReplicate(TableName table) {
  if (replicateAllUserTables) {
    if (excludeNamespaces != null && 
excludeNamespaces.contains(table.getNamespaceAsString())) {
      return false;
    }
    if (excludeTableCFsMap != null && excludeTableCFsMap.containsKey(table)) {
      return false;
    }
    return true;
  } else {
    if (namespaces != null && 
namespaces.contains(table.getNamespaceAsString())) {
      return true;
    }
    if (tableCFsMap != null && tableCFsMap.containsKey(table)) {
      return true;
    }
    return false;
  }
}
{code}


> Table need to replication unless all of cfs are excluded
> --------------------------------------------------------
>
>                 Key: HBASE-23345
>                 URL: https://issues.apache.org/jira/browse/HBASE-23345
>             Project: HBase
>          Issue Type: Bug
>          Components: Replication
>            Reporter: Sun Xin
>            Assignee: Sun Xin
>            Priority: Major
>
> There is duplicate code in ReplicationUtils.contains and 
> ReplicationPeerConfig.needToReplicate about deciding whether a table need 
> replicate to the peer cluster.
> And the implementation of ReplicationPeerConfig.needToReplicate has a bug, it 
> return false when replicateAllUserTables flag is true and excludeTableCFsMap 
> contains not all of cfs.
>  
> We should copy the code from ReplicationUtils.contains to 
> ReplicationPeerConfig.needToReplicate, and delete 
> ReplicationUtils.contains.Because ReplicationUtils is from module 
> replication, ReplicationPeerConfig is from module client, and module 
> replication depends on module client.
>  
> In the following code, ReplicationPeerConfig.needToReplicate return false, 
> when replicateAllUserTables flag is true and excludeTableCFsMap contains not 
> all of cfs.
> {code:java}
> public boolean needToReplicate(TableName table) {
>   if (replicateAllUserTables) {
>   ......
>     if (excludeTableCFsMap != null && excludeTableCFsMap.containsKey(table)) {
>       return false;
>     }
>   ......
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to