public class ZooKeeperScanPolicyObserver extends BaseRegionObserver
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.RegionObserver.MutationType
Coprocessor.State
Modifier and Type | Field and Description |
---|---|
static String |
node |
static String |
zkkey |
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
Constructor and Description |
---|
ZooKeeperScanPolicyObserver() |
Modifier and Type | Method and Description |
---|---|
protected ScanInfo |
getScanInfo(Store store,
RegionCoprocessorEnvironment e) |
InternalScanner |
preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
List<? extends KeyValueScanner> scanners,
ScanType scanType,
long earliestPutTs,
InternalScanner s)
Called prior to writing the
StoreFile s selected for compaction into a new
StoreFile and prior to creating the scanner used to read the input files. |
InternalScanner |
preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
KeyValueScanner memstoreScanner,
InternalScanner s)
Called before a memstore is flushed to disk and prior to creating the scanner to read from
the memstore.
|
KeyValueScanner |
preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Store store,
Scan scan,
NavigableSet<byte[]> targetCols,
KeyValueScanner s)
Called before a store opens a new scanner.
|
void |
start(CoprocessorEnvironment e) |
void |
stop(CoprocessorEnvironment e) |
postAppend, postBatchMutate, postBatchMutateIndispensably, postBulkLoadHFile, postCheckAndDelete, postCheckAndPut, postClose, postCloseRegionOperation, postCompact, postCompact, postCompactSelection, postCompactSelection, postCompleteSplit, postDelete, postExists, postFlush, postFlush, postGetClosestRowBefore, postGetOp, postIncrement, postIncrementColumnValue, postInstantiateDeleteTracker, postLogReplay, postMutationBeforeWAL, postOpen, postPut, postRollBackSplit, postScannerClose, postScannerFilterRow, postScannerNext, postScannerOpen, postSplit, postStartRegionOperation, postStoreFileReaderOpen, postWALRestore, postWALRestore, preAppend, preAppendAfterRowLock, preBatchMutate, preBulkLoadHFile, preCheckAndDelete, preCheckAndDeleteAfterRowLock, preCheckAndPut, preCheckAndPutAfterRowLock, preClose, preCompact, preCompact, preCompactScannerOpen, preCompactSelection, preCompactSelection, preDelete, preExists, preFlush, preFlush, preGetClosestRowBefore, preGetOp, preIncrement, preIncrementAfterRowLock, preIncrementColumnValue, preOpen, prePrepareTimeStampForDeleteVersion, prePut, preRollBackSplit, preScannerClose, preScannerNext, preScannerOpen, preSplit, preSplit, preSplitAfterPONR, preSplitBeforePONR, preStoreFileReaderOpen, preWALRestore, preWALRestore
public static final String node
public static final String zkkey
public void start(CoprocessorEnvironment e) throws IOException
start
in interface Coprocessor
start
in class BaseRegionObserver
IOException
public void stop(CoprocessorEnvironment e) throws IOException
stop
in interface Coprocessor
stop
in class BaseRegionObserver
IOException
protected ScanInfo getScanInfo(Store store, RegionCoprocessorEnvironment e)
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException
RegionObserver
StoreFile
or null to perform the default processing.
Calling ObserverContext.bypass()
has no
effect in this hook.preFlushScannerOpen
in interface RegionObserver
preFlushScannerOpen
in class BaseRegionObserver
c
- the environment provided by the region serverstore
- the store being flushedmemstoreScanner
- the scanner for the memstore that is flusheds
- the base scanner, if not null
, from previous RegionObserver in the chainnull
if the default implementation
is to be used.IOException
- if an error occurred on the coprocessorpublic InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs, InternalScanner s) throws IOException
RegionObserver
StoreFile
s selected for compaction into a new
StoreFile
and prior to creating the scanner used to read the input files. To override
or modify the compaction process, implementing classes can return a new scanner to provide the
KeyValues to be stored into the new StoreFile
or null to perform the default
processing. Calling ObserverContext.bypass()
has no
effect in this hook.preCompactScannerOpen
in interface RegionObserver
preCompactScannerOpen
in class BaseRegionObserver
c
- the environment provided by the region serverstore
- the store being compactedscanners
- the list StoreFileScanner
s
to be read fromscanType
- the ScanType
indicating whether this is a major or minor compactionearliestPutTs
- timestamp of the earliest put that was found in any of the involved store
filess
- the base scanner, if not null
, from previous RegionObserver in the chainnull
if the default implementation is to
be used.IOException
- if an error occurred on the coprocessorpublic KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, Scan scan, NavigableSet<byte[]> targetCols, KeyValueScanner s) throws IOException
RegionObserver
See RegionObserver.preFlushScannerOpen(ObserverContext, Store, KeyValueScanner, InternalScanner)
and RegionObserver.preCompactScannerOpen(ObserverContext,
Store, List, ScanType, long, InternalScanner)
to override scanners created for flushes or compactions, resp.
Call CoprocessorEnvironment#complete to skip any subsequent chained
coprocessors.
Calling ObserverContext.bypass()
has no
effect in this hook.
preStoreScannerOpen
in interface RegionObserver
preStoreScannerOpen
in class BaseRegionObserver
c
- the environment provided by the region serverstore
- the store being scannedscan
- the Scan specificationtargetCols
- columns to be used in the scanners
- the base scanner, if not null
, from previous RegionObserver in the chainnull
to use the default implementationIOException
- if an error occurred on the coprocessorCopyright © 2007-2016 The Apache Software Foundation. All Rights Reserved.