Class ZooKeeperScanPolicyObserver
java.lang.Object
org.apache.hadoop.hbase.coprocessor.example.ZooKeeperScanPolicyObserver
- All Implemented Interfaces:
Coprocessor,RegionCoprocessor,RegionObserver
@Private
public class ZooKeeperScanPolicyObserver
extends Object
implements RegionCoprocessor, RegionObserver
This is an example showing how a RegionObserver could be configured via ZooKeeper in order to
control a Region compaction, flush, and scan policy. This also demonstrated the use of shared
RegionObserver state. See
RegionCoprocessorEnvironment.getSharedData().
This would be useful for an incremental backup tool, which would indicate the last time of a successful backup via ZK and instruct HBase that to safely delete the data which has already been backup.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classInternal watcher that keep "data" up to date asynchronously.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.Coprocessor
Coprocessor.StateNested classes/interfaces inherited from interface org.apache.hadoop.hbase.coprocessor.RegionObserver
RegionObserver.MutationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.curator.framework.recipes.cache.NodeCachestatic final Stringstatic final Stringstatic final intstatic final Stringprivate static final StringFields inherited from interface org.apache.hadoop.hbase.Coprocessor
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate OptionalLongvoidpreCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, ScanType scanType, ScanOptions options, CompactionLifeCycleTracker tracker, CompactionRequest request) Called before we open store scanner for compaction.voidpreFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, ScanOptions options, FlushLifeCycleTracker tracker) Called before we open store scanner for flush.private voidresetTTL(ScanOptions options) voidCalled by theCoprocessorEnvironmentduring it's own startup to initialize the coprocessor.voidCalled by theCoprocessorEnvironmentduring it's own shutdown to stop the coprocessor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.Coprocessor
getServicesMethods inherited from interface org.apache.hadoop.hbase.coprocessor.RegionCoprocessor
getBulkLoadObserver, getEndpointObserverMethods 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, postWALRestore, preAppend, preAppend, preAppendAfterRowLock, preBatchMutate, preBulkLoadHFile, preCheckAndDelete, preCheckAndDelete, preCheckAndDeleteAfterRowLock, preCheckAndDeleteAfterRowLock, preCheckAndMutate, preCheckAndMutateAfterRowLock, preCheckAndPut, preCheckAndPut, preCheckAndPutAfterRowLock, preCheckAndPutAfterRowLock, preClose, preCommitStoreFile, preCompact, preCompactSelection, preDelete, preDelete, preExists, preFlush, preFlush, preGetOp, preIncrement, preIncrement, preIncrementAfterRowLock, preMemStoreCompaction, preMemStoreCompactionCompact, preMemStoreCompactionCompactScannerOpen, preOpen, prePrepareTimeStampForDeleteVersion, prePut, prePut, preReplayWALs, preScannerClose, preScannerNext, preScannerOpen, preStoreFileReaderOpen, preStoreScannerOpen, preWALAppend, preWALRestore
-
Field Details
-
ZK_ENSEMBLE_KEY
- See Also:
-
ZK_SESSION_TIMEOUT_KEY
- See Also:
-
ZK_SESSION_TIMEOUT_DEFAULT
- See Also:
-
NODE
- See Also:
-
ZKKEY
- See Also:
-
cache
-
-
Constructor Details
-
ZooKeeperScanPolicyObserver
public ZooKeeperScanPolicyObserver()
-
-
Method Details
-
getRegionObserver
- Specified by:
getRegionObserverin interfaceRegionCoprocessor
-
start
Description copied from interface:CoprocessorCalled by theCoprocessorEnvironmentduring it's own startup to initialize the coprocessor.- Specified by:
startin interfaceCoprocessor- Throws:
IOException
-
stop
Description copied from interface:CoprocessorCalled by theCoprocessorEnvironmentduring it's own shutdown to stop the coprocessor.- Specified by:
stopin interfaceCoprocessor- Throws:
IOException
-
getExpireBefore
-
resetTTL
-
preFlushScannerOpen
public void preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, ScanOptions options, FlushLifeCycleTracker tracker) throws IOException Description copied from interface:RegionObserverCalled before we open store scanner for flush. You can use theoptionsto change max versions and TTL for the scanner being opened.- Specified by:
preFlushScannerOpenin interfaceRegionObserver- Parameters:
c- the environment provided by the region serverstore- the store where flush is being requestedoptions- used to change max versions and TTL for the scanner being opened- Throws:
IOException
-
preCompactScannerOpen
public void preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, ScanType scanType, ScanOptions options, CompactionLifeCycleTracker tracker, CompactionRequest request) throws IOException Description copied from interface:RegionObserverCalled before we open store scanner for compaction. You can use theoptionsto change max versions and TTL for the scanner being opened.- Specified by:
preCompactScannerOpenin interfaceRegionObserver- Parameters:
c- the environment provided by the region serverstore- the store being compactedscanType- type of Scanoptions- used to change max versions and TTL for the scanner being openedtracker- tracker used to track the life cycle of a compactionrequest- the requested compaction- Throws:
IOException
-