You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Andrew Purtell (JIRA)" <ji...@apache.org> on 2018/12/14 00:34:00 UTC

[jira] [Updated] (HBASE-19423) Replication entries are not filtered correctly when replication scope is set through WAL Co-processor

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

Andrew Purtell updated HBASE-19423:
-----------------------------------
       Resolution: Incomplete
         Assignee:     (was: Mohammad Arshad)
    Fix Version/s:     (was: 1.3.3)
                       (was: 1.4.0)
           Status: Resolved  (was: Patch Available)

> Replication entries are not filtered correctly when replication scope is set through WAL Co-processor
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-19423
>                 URL: https://issues.apache.org/jira/browse/HBASE-19423
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Mohammad Arshad
>            Priority: Major
>              Labels: Replication, WAL
>         Attachments: HBASE-19423-branch-1.3-001.patch, HBASE-19423-branch-1.4-001.patch, HBASE-19423-master-001-test.patch
>
>
> Replicaion scope set in WALObserver is getting reset in Replication.scopeWALEdits(). 
> Because of this problem custom implementation of WALObserver can not be used as a replication filter.
> Suppose WALObserver implementation has logic to filter all entries from family f2
> {code}
> // Filter all family f2 rows
>   public static class ReplicationFilterWALCoprocessor extends BaseWALObserver {
>     @Override
>     public boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
>         HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
>       ArrayList<Cell> cells = logEdit.getCells();
>       for (Cell cell : cells) {
>         byte[] fam = CellUtil.cloneFamily(cell);
>         if ("f2".equals(Bytes.toString(fam))) {
>           NavigableMap<byte[], Integer> scopes = logKey.getScopes();
>           if (scopes == null) {
>             logKey.setScopes(new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR));
>           }
>           logKey.getScopes().put(fam, HConstants.REPLICATION_SCOPE_LOCAL);
>         }
>       }
>       return false;
>     }
>   }
> {code}
> This logic can not work as {{org.apache.hadoop.hbase.replication.regionserver.Replication.scopeWALEdits()}} recreates and populates scopes.
> *SOLUTION:*
> In Replication.scopeWALEdits(), create scopes map only if WALKey does not have it.
> {code}
> NavigableMap<byte[], Integer> scopes = logKey.getScopes();
>     if (scopes == null) {
>       scopes = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
>     }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)