org.apache.hadoop.hbase.tool
Class WriteSinkCoprocessor

java.lang.Object
  extended by org.apache.hadoop.hbase.coprocessor.BaseRegionObserver
      extended by org.apache.hadoop.hbase.tool.WriteSinkCoprocessor
All Implemented Interfaces:
Coprocessor, RegionObserver

public class WriteSinkCoprocessor
extends BaseRegionObserver

This coprocessor 'shallows' all the writes. It allows to test a pure write workload, going through all the communication layers. The reads will work as well, but they as we never write, they will always always return an empty structure. The WAL is also skipped. Obviously, the region will never be split automatically. It's up to the user to split and move it.

For a table created like this: create 'usertable', {NAME => 'f1', VERSIONS => 1}

You can then add the coprocessor with this command: alter 'usertable', METHOD => 'table_att', 'coprocessor'=>'|org.apache.hadoop.hbase.tool.WriteSinkCoprocessor|'

And then put 'usertable', 'f1', 'f1', 'f1'

scan 'usertable' Will return: 0 row(s) in 0.0050 seconds


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.Coprocessor
Coprocessor.State
 
Field Summary
 
Fields inherited from interface org.apache.hadoop.hbase.Coprocessor
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
 
Constructor Summary
WriteSinkCoprocessor()
           
 
Method Summary
 void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
          This will be called for every batch mutation operation happening at the server.
 void preOpen(ObserverContext<RegionCoprocessorEnvironment> e)
          Called before the region is reported as open to the master.
 
Methods inherited from class org.apache.hadoop.hbase.coprocessor.BaseRegionObserver
postAppend, postBatchMutate, postBulkLoadHFile, postCheckAndDelete, postCheckAndPut, postClose, postCompact, postCompact, postCompactSelection, postCompactSelection, postDelete, postExists, postFlush, postFlush, postGet, postGetClosestRowBefore, postIncrement, postIncrementColumnValue, postLockRow, postOpen, postPut, postScannerClose, postScannerFilterRow, postScannerNext, postScannerOpen, postSplit, postUnlockRow, postWALRestore, preAppend, preBulkLoadHFile, preCheckAndDelete, preCheckAndPut, preClose, preCompact, preCompact, preCompactScannerOpen, preCompactScannerOpen, preCompactSelection, preCompactSelection, preDelete, preExists, preFlush, preFlush, preFlushScannerOpen, preGet, preGetClosestRowBefore, preIncrement, preIncrementColumnValue, preLockRow, prePut, preScannerClose, preScannerNext, preScannerOpen, preSplit, preStoreScannerOpen, preUnlockRow, preWALRestore, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteSinkCoprocessor

public WriteSinkCoprocessor()
Method Detail

preOpen

public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e)
             throws IOException
Description copied from interface: RegionObserver
Called before the region is reported as open to the master.

Specified by:
preOpen in interface RegionObserver
Overrides:
preOpen in class BaseRegionObserver
Parameters:
e - the environment provided by the region server
Throws:
IOException - if an error occurred on the coprocessor

preBatchMutate

public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
                           MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
                    throws IOException
Description copied from interface: RegionObserver
This will be called for every batch mutation operation happening at the server. This will be called after acquiring the locks on the mutating rows and after applying the proper timestamp for each Mutation at the server. The batch may contain Put/Delete. By setting OperationStatus of Mutations (MiniBatchOperationInProgress.setOperationStatus(int, OperationStatus)), RegionObserver can make HRegion to skip these Mutations.

Specified by:
preBatchMutate in interface RegionObserver
Overrides:
preBatchMutate in class BaseRegionObserver
Parameters:
c - the environment provided by the region server
miniBatchOp - batch of Mutations getting applied to region.
Throws:
IOException - if an error occurred on the coprocessor


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.