Class WALEntryFilterBase

java.lang.Object
org.apache.hadoop.hbase.replication.WALEntryFilterBase
All Implemented Interfaces:
WALEntryFilter
Direct Known Subclasses:
ClusterMarkingEntryFilter, ScopeWALEntryFilter

@LimitedPrivate("Replication") public abstract class WALEntryFilterBase extends Object implements WALEntryFilter
Base class for WALEntryFilter, store the necessary common properties like serial.

Why need to treat serial replication specially:

Under some special cases, we may filter out some entries but we still need to record the last pushed sequence id for these entries. For example, when we setup a bidirection replication A <-> B, if we write to both cluster A and cluster B, cluster A will not replicate the entries which are replicated from cluster B, which means we may have holes in the replication sequence ids. So if the region is closed abnormally, i.e, we do not have a close event for the region, and before the closing, we have some entries from cluster B, then the replication from cluster A to cluster B will be stuck if we do not record the last pushed sequence id of these entries because we will find out that the previous sequence id range will never finish. So we need to record the sequence id for these entries so the last pushed sequence id can reach the region barrier.

See Also:
  • Field Details

    • serial

      protected boolean serial
  • Constructor Details

  • Method Details

    • setSerial

      public void setSerial(boolean serial)
      Description copied from interface: WALEntryFilter
      Tell the filter whether the peer is a serial replication peer.

      For serial replication, usually you should not filter out an entire entry, unless the peer config does not contain the table, because we need the region name and sequence id of the entry to advance the pushed sequence id, otherwise the replication may be blocked. You can just filter out all the cells of the entry to stop it being replicated to peer cluster,or just rely on the WALCellFilter.filterCell(Entry, org.apache.hadoop.hbase.Cell) method to filter all the cells out.

      Specified by:
      setSerial in interface WALEntryFilter
      Parameters:
      serial - true if the peer is a serial replication peer, otherwise false
    • clearOrNull

      protected final WAL.Entry clearOrNull(WAL.Entry entry)
      Call this method when you do not need to replicate the entry.

      For serial replication, since still need to WALKey for recording progress, we clear all the cells of the WALEdit. For normal replication, we just return null.