@InterfaceAudience.Private public class WriteSinkCoprocessor extends Object implements RegionCoprocessor, RegionObserver
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', '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
TODO: It needs testsCoprocessor.State
RegionObserver.MutationType
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private AtomicLong |
ops |
private String |
regionName |
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
Constructor and Description |
---|
WriteSinkCoprocessor() |
Modifier and Type | Method and Description |
---|---|
Optional<RegionObserver> |
getRegionObserver() |
void |
preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
MiniBatchOperationInProgress<Mutation> 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBulkLoadObserver, getEndpointObserver
getServices, start, stop
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, postWALRestore, preAppend, preAppend, preAppendAfterRowLock, 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, prePrepareTimeStampForDeleteVersion, prePut, prePut, preReplayWALs, preScannerClose, preScannerNext, preScannerOpen, preStoreFileReaderOpen, preStoreScannerOpen, preWALAppend, preWALRestore
private static final org.slf4j.Logger LOG
private final AtomicLong ops
private String regionName
public WriteSinkCoprocessor()
public Optional<RegionObserver> getRegionObserver()
getRegionObserver
in interface RegionCoprocessor
public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException
RegionObserver
preOpen
in interface RegionObserver
e
- the environment provided by the region serverIOException
public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException
RegionObserver
MiniBatchOperationInProgress.setOperationStatus(int, OperationStatus)
),
RegionObserver
can make Region to skip these Mutations.
Note: Do not retain references to any Cells in Mutations beyond the life of this invocation. If need a Cell reference for later use, copy the cell and use that.
preBatchMutate
in interface RegionObserver
c
- the environment provided by the region serverminiBatchOp
- batch of Mutations getting applied to region.IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.