org.apache.hadoop.hbase.coprocessor
Interface RegionObserver

All Superinterfaces:
Coprocessor
All Known Implementing Classes:
BaseRegionObserver

public interface RegionObserver
extends Coprocessor

Coprocessors implement this interface to observe and mediate client actions on the region.


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
 
Method Summary
 boolean postCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Delete delete, boolean result)
          Called after checkAndDelete
 boolean postCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Put put, boolean result)
          Called after checkAndPut
 void postClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested)
          Called after the region is reported as closed to the master.
 void postCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile)
          Called after compaction has completed and the new store file has been moved in to place.
 void postCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, com.google.common.collect.ImmutableList<StoreFile> selected)
          Called after the StoreFiles to compact have been selected from the available candidates.
 void postDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, boolean writeToWAL)
          Called after the client deletes a value.
 boolean postExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists)
          Called after the client tests for existence using a Get.
 void postFlush(ObserverContext<RegionCoprocessorEnvironment> c)
          Called after the memstore is flushed to disk.
 void postGet(ObserverContext<RegionCoprocessorEnvironment> c, Get get, List<KeyValue> result)
          Called after the client performs a Get
 void postGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, Result result)
          Called after a client makes a GetClosestRowBefore request.
 Result postIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment, Result result)
          Called after increment
 long postIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL, long result)
          Called after incrementColumnValue
 void postOpen(ObserverContext<RegionCoprocessorEnvironment> c)
          Called after the region is reported as open to the master.
 void postPut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, boolean writeToWAL)
          Called after the client stores a value.
 void postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s)
          Called after the client closes a scanner.
 boolean postScannerNext(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext)
          Called after the client asks for the next row on a scanner.
 RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s)
          Called after the client opens a new scanner.
 void postSplit(ObserverContext<RegionCoprocessorEnvironment> c, HRegion l, HRegion r)
          Called after the region is split.
 void postWALRestore(ObserverContext<RegionCoprocessorEnvironment> ctx, HRegionInfo info, HLogKey logKey, WALEdit logEdit)
          Called after a WALEdit replayed for this region.
 boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Delete delete, boolean result)
          Called before checkAndDelete
 boolean preCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Put put, boolean result)
          Called before checkAndPut
 void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested)
          Called before the region is reported as closed to the master.
 InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner)
          Called prior to writing the StoreFiles selected for compaction into a new StoreFile.
 void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<StoreFile> candidates)
          Called prior to selecting the StoreFiles to compact from the list of available candidates.
 void preDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, boolean writeToWAL)
          Called before the client deletes a value.
 boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists)
          Called before the client tests for existence using a Get.
 void preFlush(ObserverContext<RegionCoprocessorEnvironment> c)
          Called before the memstore is flushed to disk.
 void preGet(ObserverContext<RegionCoprocessorEnvironment> c, Get get, List<KeyValue> result)
          Called before the client performs a Get
 void preGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, Result result)
          Called before a client makes a GetClosestRowBefore request.
 Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment)
          Called before Increment
 long preIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL)
          Called before incrementColumnValue
 void preOpen(ObserverContext<RegionCoprocessorEnvironment> c)
          Called before the region is reported as open to the master.
 void prePut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, boolean writeToWAL)
          Called before the client stores a value.
 void preScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s)
          Called before the client closes a scanner.
 boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext)
          Called before the client asks for the next row on a scanner.
 RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s)
          Called before the client opens a new scanner.
 void preSplit(ObserverContext<RegionCoprocessorEnvironment> c)
          Called before the region is split.
 void preWALRestore(ObserverContext<RegionCoprocessorEnvironment> ctx, HRegionInfo info, HLogKey logKey, WALEdit logEdit)
          Called before a WALEdit replayed for this region.
 
Methods inherited from interface org.apache.hadoop.hbase.Coprocessor
start, stop
 

Method Detail

preOpen

void preOpen(ObserverContext<RegionCoprocessorEnvironment> c)
Called before the region is reported as open to the master.

Parameters:
c - the environment provided by the region server

postOpen

void postOpen(ObserverContext<RegionCoprocessorEnvironment> c)
Called after the region is reported as open to the master.

Parameters:
c - the environment provided by the region server

preFlush

void preFlush(ObserverContext<RegionCoprocessorEnvironment> c)
Called before the memstore is flushed to disk.

Parameters:
c - the environment provided by the region server

postFlush

void postFlush(ObserverContext<RegionCoprocessorEnvironment> c)
Called after the memstore is flushed to disk.

Parameters:
c - the environment provided by the region server

preCompactSelection

void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c,
                         Store store,
                         List<StoreFile> candidates)
Called prior to selecting the StoreFiles to compact from the list of available candidates. To alter the files used for compaction, you may mutate the passed in list of candidates.

Parameters:
c - the environment provided by the region server
store - the store where compaction is being requested
candidates - the store files currently available for compaction

postCompactSelection

void postCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c,
                          Store store,
                          com.google.common.collect.ImmutableList<StoreFile> selected)
Called after the StoreFiles to compact have been selected from the available candidates.

Parameters:
c - the environment provided by the region server
store - the store being compacted
selected - the store files selected to compact

preCompact

InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                           Store store,
                           InternalScanner scanner)
Called prior to writing the StoreFiles selected for compaction into a new StoreFile. To override or modify the compaction process, implementing classes have two options:

Parameters:
c - the environment provided by the region server
store - the store being compacted
scanner - the scanner over existing data used in the store file rewriting
Returns:
the scanner to use during compaction. Should not be null unless the implementation is writing new store files on its own.

postCompact

void postCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                 Store store,
                 StoreFile resultFile)
Called after compaction has completed and the new store file has been moved in to place.

Parameters:
c - the environment provided by the region server
store - the store being compacted
resultFile - the new store file written out during compaction

preSplit

void preSplit(ObserverContext<RegionCoprocessorEnvironment> c)
Called before the region is split.

Parameters:
c - the environment provided by the region server (e.getRegion() returns the parent region)

postSplit

void postSplit(ObserverContext<RegionCoprocessorEnvironment> c,
               HRegion l,
               HRegion r)
Called after the region is split.

Parameters:
c - the environment provided by the region server (e.getRegion() returns the parent region)
l - the left daughter region
r - the right daughter region

preClose

void preClose(ObserverContext<RegionCoprocessorEnvironment> c,
              boolean abortRequested)
Called before the region is reported as closed to the master.

Parameters:
c - the environment provided by the region server
abortRequested - true if the region server is aborting

postClose

void postClose(ObserverContext<RegionCoprocessorEnvironment> c,
               boolean abortRequested)
Called after the region is reported as closed to the master.

Parameters:
c - the environment provided by the region server
abortRequested - true if the region server is aborting

preGetClosestRowBefore

void preGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c,
                            byte[] row,
                            byte[] family,
                            Result result)
                            throws IOException
Called before a client makes a GetClosestRowBefore request.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - the row
family - the family
result - The result to return to the client if default processing is bypassed. Can be modified. Will not be used if default processing is not bypassed.
Throws:
IOException - if an error occurred on the coprocessor

postGetClosestRowBefore

void postGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c,
                             byte[] row,
                             byte[] family,
                             Result result)
                             throws IOException
Called after a client makes a GetClosestRowBefore request.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - the row
family - the desired family
result - the result to return to the client, modify as necessary
Throws:
IOException - if an error occurred on the coprocessor

preGet

void preGet(ObserverContext<RegionCoprocessorEnvironment> c,
            Get get,
            List<KeyValue> result)
            throws IOException
Called before the client performs a Get

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
get - the Get request
result - The result to return to the client if default processing is bypassed. Can be modified. Will not be used if default processing is not bypassed.
Throws:
IOException - if an error occurred on the coprocessor

postGet

void postGet(ObserverContext<RegionCoprocessorEnvironment> c,
             Get get,
             List<KeyValue> result)
             throws IOException
Called after the client performs a Get

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
get - the Get request
result - the result to return to the client, modify as necessary
Throws:
IOException - if an error occurred on the coprocessor

preExists

boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c,
                  Get get,
                  boolean exists)
                  throws IOException
Called before the client tests for existence using a Get.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
get - the Get request
exists -
Returns:
the value to return to the client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postExists

boolean postExists(ObserverContext<RegionCoprocessorEnvironment> c,
                   Get get,
                   boolean exists)
                   throws IOException
Called after the client tests for existence using a Get.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
get - the Get request
exists - the result returned by the region server
Returns:
the result to return to the client
Throws:
IOException - if an error occurred on the coprocessor

prePut

void prePut(ObserverContext<RegionCoprocessorEnvironment> c,
            Put put,
            WALEdit edit,
            boolean writeToWAL)
            throws IOException
Called before the client stores a value.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
put - The Put object
edit - The WALEdit object that will be written to the wal
writeToWAL - true if the change should be written to the WAL
Throws:
IOException - if an error occurred on the coprocessor

postPut

void postPut(ObserverContext<RegionCoprocessorEnvironment> c,
             Put put,
             WALEdit edit,
             boolean writeToWAL)
             throws IOException
Called after the client stores a value.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
put - The Put object
edit - The WALEdit object for the wal
writeToWAL - true if the change should be written to the WAL
Throws:
IOException - if an error occurred on the coprocessor

preDelete

void preDelete(ObserverContext<RegionCoprocessorEnvironment> c,
               Delete delete,
               WALEdit edit,
               boolean writeToWAL)
               throws IOException
Called before the client deletes a value.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
delete - The Delete object
edit - The WALEdit object for the wal
writeToWAL - true if the change should be written to the WAL
Throws:
IOException - if an error occurred on the coprocessor

postDelete

void postDelete(ObserverContext<RegionCoprocessorEnvironment> c,
                Delete delete,
                WALEdit edit,
                boolean writeToWAL)
                throws IOException
Called after the client deletes a value.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
delete - The Delete object
edit - The WALEdit object for the wal
writeToWAL - true if the change should be written to the WAL
Throws:
IOException - if an error occurred on the coprocessor

preCheckAndPut

boolean preCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c,
                       byte[] row,
                       byte[] family,
                       byte[] qualifier,
                       CompareFilter.CompareOp compareOp,
                       WritableByteArrayComparable comparator,
                       Put put,
                       boolean result)
                       throws IOException
Called before checkAndPut

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
compareOp - the comparison operation
comparator - the comparator
put - data to put if check succeeds
result -
Returns:
the return value to return to client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postCheckAndPut

boolean postCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c,
                        byte[] row,
                        byte[] family,
                        byte[] qualifier,
                        CompareFilter.CompareOp compareOp,
                        WritableByteArrayComparable comparator,
                        Put put,
                        boolean result)
                        throws IOException
Called after checkAndPut

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
compareOp - the comparison operation
comparator - the comparator
put - data to put if check succeeds
result - from the checkAndPut
Returns:
the possibly transformed return value to return to client
Throws:
IOException - if an error occurred on the coprocessor

preCheckAndDelete

boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c,
                          byte[] row,
                          byte[] family,
                          byte[] qualifier,
                          CompareFilter.CompareOp compareOp,
                          WritableByteArrayComparable comparator,
                          Delete delete,
                          boolean result)
                          throws IOException
Called before checkAndDelete

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
compareOp - the comparison operation
comparator - the comparator
delete - delete to commit if check succeeds
result -
Returns:
the value to return to client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postCheckAndDelete

boolean postCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c,
                           byte[] row,
                           byte[] family,
                           byte[] qualifier,
                           CompareFilter.CompareOp compareOp,
                           WritableByteArrayComparable comparator,
                           Delete delete,
                           boolean result)
                           throws IOException
Called after checkAndDelete

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
compareOp - the comparison operation
comparator - the comparator
delete - delete to commit if check succeeds
result - from the CheckAndDelete
Returns:
the possibly transformed returned value to return to client
Throws:
IOException - if an error occurred on the coprocessor

preIncrementColumnValue

long preIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c,
                             byte[] row,
                             byte[] family,
                             byte[] qualifier,
                             long amount,
                             boolean writeToWAL)
                             throws IOException
Called before incrementColumnValue

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
amount - long amount to increment
writeToWAL - true if the change should be written to the WAL
Returns:
value to return to the client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postIncrementColumnValue

long postIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c,
                              byte[] row,
                              byte[] family,
                              byte[] qualifier,
                              long amount,
                              boolean writeToWAL,
                              long result)
                              throws IOException
Called after incrementColumnValue

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
row - row to check
family - column family
qualifier - column qualifier
amount - long amount to increment
writeToWAL - true if the change should be written to the WAL
result - the result returned by incrementColumnValue
Returns:
the result to return to the client
Throws:
IOException - if an error occurred on the coprocessor

preIncrement

Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c,
                    Increment increment)
                    throws IOException
Called before Increment

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
increment - increment object
Returns:
result to return to the client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postIncrement

Result postIncrement(ObserverContext<RegionCoprocessorEnvironment> c,
                     Increment increment,
                     Result result)
                     throws IOException
Called after increment

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
increment - increment object
result - the result returned by increment
Returns:
the result to return to the client
Throws:
IOException - if an error occurred on the coprocessor

preScannerOpen

RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                             Scan scan,
                             RegionScanner s)
                             throws IOException
Called before the client opens a new scanner.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
scan - the Scan specification
s - if not null, the base scanner
Returns:
an RegionScanner instance to use instead of the base scanner if overriding default behavior, null otherwise
Throws:
IOException - if an error occurred on the coprocessor

postScannerOpen

RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                              Scan scan,
                              RegionScanner s)
                              throws IOException
Called after the client opens a new scanner.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
scan - the Scan specification
s - if not null, the base scanner
Returns:
the scanner instance to use
Throws:
IOException - if an error occurred on the coprocessor

preScannerNext

boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> c,
                       InternalScanner s,
                       List<Result> result,
                       int limit,
                       boolean hasNext)
                       throws IOException
Called before the client asks for the next row on a scanner.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
s - the scanner
result - The result to return to the client if default processing is bypassed. Can be modified. Will not be returned if default processing is not bypassed.
limit - the maximum number of results to return
hasNext - the 'has more' indication
Returns:
'has more' indication that should be sent to client
Throws:
IOException - if an error occurred on the coprocessor

postScannerNext

boolean postScannerNext(ObserverContext<RegionCoprocessorEnvironment> c,
                        InternalScanner s,
                        List<Result> result,
                        int limit,
                        boolean hasNext)
                        throws IOException
Called after the client asks for the next row on a scanner.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
s - the scanner
result - the result to return to the client, can be modified
limit - the maximum number of results to return
hasNext - the 'has more' indication
Returns:
'has more' indication that should be sent to client
Throws:
IOException - if an error occurred on the coprocessor

preScannerClose

void preScannerClose(ObserverContext<RegionCoprocessorEnvironment> c,
                     InternalScanner s)
                     throws IOException
Called before the client closes a scanner.

Call CoprocessorEnvironment#bypass to skip default actions

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
s - the scanner
Throws:
IOException - if an error occurred on the coprocessor

postScannerClose

void postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c,
                      InternalScanner s)
                      throws IOException
Called after the client closes a scanner.

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
s - the scanner
Throws:
IOException - if an error occurred on the coprocessor

preWALRestore

void preWALRestore(ObserverContext<RegionCoprocessorEnvironment> ctx,
                   HRegionInfo info,
                   HLogKey logKey,
                   WALEdit logEdit)
                   throws IOException
Called before a WALEdit replayed for this region.

Parameters:
ctx -
info -
logKey -
logEdit -
Throws:
IOException

postWALRestore

void postWALRestore(ObserverContext<RegionCoprocessorEnvironment> ctx,
                    HRegionInfo info,
                    HLogKey logKey,
                    WALEdit logEdit)
                    throws IOException
Called after a WALEdit replayed for this region.

Parameters:
ctx -
info -
logKey -
logEdit -
Throws:
IOException


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