Class SampleRegionWALCoprocessor

java.lang.Object
org.apache.hadoop.hbase.coprocessor.SampleRegionWALCoprocessor
All Implemented Interfaces:
org.apache.hadoop.hbase.Coprocessor, org.apache.hadoop.hbase.coprocessor.RegionCoprocessor, org.apache.hadoop.hbase.coprocessor.RegionObserver, org.apache.hadoop.hbase.coprocessor.WALCoprocessor, org.apache.hadoop.hbase.coprocessor.WALObserver

public class SampleRegionWALCoprocessor extends Object implements org.apache.hadoop.hbase.coprocessor.WALCoprocessor, org.apache.hadoop.hbase.coprocessor.RegionCoprocessor, org.apache.hadoop.hbase.coprocessor.WALObserver, org.apache.hadoop.hbase.coprocessor.RegionObserver
Class for testing WALObserver coprocessor. It will monitor WAL writing and restoring, and modify passed-in WALEdit, i.e, ignore specified columns when writing, or add a KeyValue. On the other side, it checks whether the ignored column is still in WAL when Restoreed at region reconstruct.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.Coprocessor

    org.apache.hadoop.hbase.Coprocessor.State

    Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.coprocessor.RegionObserver

    org.apache.hadoop.hbase.coprocessor.RegionObserver.MutationType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private byte[]
     
    private byte[]
     
    private byte[]
     
    private byte[]
     
    private byte[]
     
    private byte[]
     
    private static final org.slf4j.Logger
     
    private boolean
     
    private boolean
     
    private boolean
     
    private boolean
     
    private boolean
     
    private boolean
     
    private byte[]
     
    private byte[]
     

    Fields inherited from interface org.apache.hadoop.hbase.Coprocessor

    PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<org.apache.hadoop.hbase.coprocessor.RegionObserver>
     
    Optional<org.apache.hadoop.hbase.coprocessor.WALObserver>
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    void
    postWALRestore(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit)
    Triggered after HRegion when WAL is Restoreed.
    void
    postWALRoll(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath)
     
    void
    postWALWrite(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit)
     
    void
    preWALRestore(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit)
    Triggered before HRegion when WAL is Restoreed.
    void
    preWALRoll(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath)
     
    void
    preWALWrite(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit)
     
    void
    setTestValues(byte[] tableName, byte[] row, byte[] igf, byte[] igq, byte[] chf, byte[] chq, byte[] addf, byte[] addq)
    Set values: with a table name, a column name which will be ignored, and a column name which will be added to WAL.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.hbase.Coprocessor

    getServices, start, stop

    Methods inherited from interface org.apache.hadoop.hbase.coprocessor.RegionCoprocessor

    getBulkLoadObserver, getEndpointObserver

    Methods inherited from interface org.apache.hadoop.hbase.coprocessor.RegionObserver

    postAppend, postAppend, postAppendBeforeWAL, postBatchMutate, postBatchMutateIndispensably, postBulkLoadHFile, postCheckAndDelete, postCheckAndDelete, postCheckAndMutate, postCheckAndPut, postCheckAndPut, postClose, postCloseRegionOperation, postCommitStoreFile, postCompact, postCompactSelection, postDelete, postDelete, postExists, postFlush, postFlush, postGetOp, postIncrement, postIncrement, postIncrementBeforeWAL, postInstantiateDeleteTracker, postMemStoreCompaction, postMutationBeforeWAL, postOpen, postPut, postPut, postReplayWALs, postScannerClose, postScannerFilterRow, postScannerNext, postScannerOpen, postStartRegionOperation, postStoreFileReaderOpen, preAppend, preAppend, preAppendAfterRowLock, preBatchMutate, preBulkLoadHFile, preCheckAndDelete, preCheckAndDelete, preCheckAndDeleteAfterRowLock, preCheckAndDeleteAfterRowLock, preCheckAndMutate, preCheckAndMutateAfterRowLock, preCheckAndPut, preCheckAndPut, preCheckAndPutAfterRowLock, preCheckAndPutAfterRowLock, preClose, preCommitStoreFile, preCompact, preCompactScannerOpen, preCompactSelection, preDelete, preDelete, preExists, preFlush, preFlush, preFlushScannerOpen, preGetOp, preIncrement, preIncrement, preIncrementAfterRowLock, preMemStoreCompaction, preMemStoreCompactionCompact, preMemStoreCompactionCompactScannerOpen, preOpen, prePrepareTimeStampForDeleteVersion, prePut, prePut, preReplayWALs, preScannerClose, preScannerNext, preScannerOpen, preStoreFileReaderOpen, preStoreScannerOpen, preWALAppend
  • Field Details

  • Constructor Details

  • Method Details

    • setTestValues

      public void setTestValues(byte[] tableName, byte[] row, byte[] igf, byte[] igq, byte[] chf, byte[] chq, byte[] addf, byte[] addq)
      Set values: with a table name, a column name which will be ignored, and a column name which will be added to WAL.
    • getWALObserver

      public Optional<org.apache.hadoop.hbase.coprocessor.WALObserver> getWALObserver()
      Specified by:
      getWALObserver in interface org.apache.hadoop.hbase.coprocessor.WALCoprocessor
    • getRegionObserver

      public Optional<org.apache.hadoop.hbase.coprocessor.RegionObserver> getRegionObserver()
      Specified by:
      getRegionObserver in interface org.apache.hadoop.hbase.coprocessor.RegionCoprocessor
    • postWALWrite

      public void postWALWrite(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit) throws IOException
      Specified by:
      postWALWrite in interface org.apache.hadoop.hbase.coprocessor.WALObserver
      Throws:
      IOException
    • preWALWrite

      public void preWALWrite(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit) throws IOException
      Specified by:
      preWALWrite in interface org.apache.hadoop.hbase.coprocessor.WALObserver
      Throws:
      IOException
    • preWALRestore

      public void preWALRestore(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit) throws IOException
      Triggered before HRegion when WAL is Restoreed.
      Specified by:
      preWALRestore in interface org.apache.hadoop.hbase.coprocessor.RegionObserver
      Throws:
      IOException
    • preWALRoll

      public void preWALRoll(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException
      Specified by:
      preWALRoll in interface org.apache.hadoop.hbase.coprocessor.WALObserver
      Throws:
      IOException
    • postWALRoll

      public void postWALRoll(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException
      Specified by:
      postWALRoll in interface org.apache.hadoop.hbase.coprocessor.WALObserver
      Throws:
      IOException
    • postWALRestore

      public void postWALRestore(org.apache.hadoop.hbase.coprocessor.ObserverContext<? extends org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment> env, org.apache.hadoop.hbase.client.RegionInfo info, org.apache.hadoop.hbase.wal.WALKey logKey, org.apache.hadoop.hbase.wal.WALEdit logEdit) throws IOException
      Triggered after HRegion when WAL is Restoreed.
      Specified by:
      postWALRestore in interface org.apache.hadoop.hbase.coprocessor.RegionObserver
      Throws:
      IOException
    • isPreWALWriteCalled

      public boolean isPreWALWriteCalled()
    • isPostWALWriteCalled

      public boolean isPostWALWriteCalled()
    • isPreWALRestoreCalled

      public boolean isPreWALRestoreCalled()
    • isPostWALRestoreCalled

      public boolean isPostWALRestoreCalled()
    • isPreWALRollCalled

      public boolean isPreWALRollCalled()
    • isPostWALRollCalled

      public boolean isPostWALRollCalled()