org.apache.hadoop.hbase.coprocessor.example
Class ZooKeeperScanPolicyObserver
java.lang.Object
org.apache.hadoop.hbase.coprocessor.BaseRegionObserver
org.apache.hadoop.hbase.coprocessor.example.ZooKeeperScanPolicyObserver
- All Implemented Interfaces:
- Coprocessor, RegionObserver
public class ZooKeeperScanPolicyObserver
- extends BaseRegionObserver
This is an example showing how a RegionObserver could 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 to not delete data that was
inserted since (based on wall clock time).
This implements org.apache.zookeeper.Watcher directly instead of using
ZooKeeperWatcher, because RegionObservers come and go and currently
listeners registered with ZooKeeperWatcher cannot be removed.
|
Method Summary |
protected ScanInfo |
getScanInfo(Store store,
RegionCoprocessorEnvironment e)
|
InternalScanner |
preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
List<? extends KeyValueScanner> scanners,
ScanType scanType,
long earliestPutTs,
InternalScanner s)
|
InternalScanner |
preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
KeyValueScanner memstoreScanner,
InternalScanner s)
|
KeyValueScanner |
preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
Scan scan,
NavigableSet<byte[]> targetCols,
KeyValueScanner s)
|
void |
start(CoprocessorEnvironment e)
|
void |
stop(CoprocessorEnvironment e)
|
| Methods inherited from class org.apache.hadoop.hbase.coprocessor.BaseRegionObserver |
postAppend, postBatchMutate, postBulkLoadHFile, postCheckAndDelete, postCheckAndPut, postClose, postCompact, postCompact, postCompactSelection, postCompactSelection, postCompleteSplit, postDelete, postExists, postFlush, postFlush, postGet, postGetClosestRowBefore, postGetOp, postIncrement, postIncrementColumnValue, postOpen, postPut, postRollBackSplit, postScannerClose, postScannerFilterRow, postScannerNext, postScannerOpen, postSplit, postWALRestore, preAppend, preBatchMutate, preBulkLoadHFile, preCheckAndDelete, preCheckAndPut, preClose, preCompact, preCompact, preCompactScannerOpen, preCompactSelection, preCompactSelection, preDelete, preExists, preFlush, preFlush, preGet, preGetClosestRowBefore, preGetOp, preIncrement, preIncrementColumnValue, preOpen, prePut, preRollBackSplit, preScannerClose, preScannerNext, preScannerOpen, preSplit, preSplit, preWALRestore |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
node
public static final String node
- See Also:
- Constant Field Values
zkkey
public static final String zkkey
- See Also:
- Constant Field Values
ZooKeeperScanPolicyObserver
public ZooKeeperScanPolicyObserver()
start
public void start(CoprocessorEnvironment e)
throws IOException
- Specified by:
start in interface Coprocessor- Overrides:
start in class BaseRegionObserver
- Throws:
IOException
stop
public void stop(CoprocessorEnvironment e)
throws IOException
- Specified by:
stop in interface Coprocessor- Overrides:
stop in class BaseRegionObserver
- Throws:
IOException
getScanInfo
protected ScanInfo getScanInfo(Store store,
RegionCoprocessorEnvironment e)
preFlushScannerOpen
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
KeyValueScanner memstoreScanner,
InternalScanner s)
throws IOException
- Specified by:
preFlushScannerOpen in interface RegionObserver- Overrides:
preFlushScannerOpen in class BaseRegionObserver
- Throws:
IOException
preCompactScannerOpen
public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
List<? extends KeyValueScanner> scanners,
ScanType scanType,
long earliestPutTs,
InternalScanner s)
throws IOException
- Specified by:
preCompactScannerOpen in interface RegionObserver- Overrides:
preCompactScannerOpen in class BaseRegionObserver
- Throws:
IOException
preStoreScannerOpen
public KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
Scan scan,
NavigableSet<byte[]> targetCols,
KeyValueScanner s)
throws IOException
- Specified by:
preStoreScannerOpen in interface RegionObserver- Overrides:
preStoreScannerOpen in class BaseRegionObserver
- Throws:
IOException
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.