org.apache.hadoop.hbase.coprocessor
Interface RegionObserver

All Superinterfaces:
Coprocessor
All Known Implementing Classes:
AccessController, BaseRegionObserver, ConstraintProcessor, ZooKeeperScanPolicyObserver

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
 Result postAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append, Result result)
          Called after Append
 void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
          This will be called after applying a batch of Mutations on a region.
 boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[],String>> familyPaths, boolean hasLoaded)
          Called after bulkLoadHFile.
 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 postCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile, CompactionRequest request)
          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 postCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, com.google.common.collect.ImmutableList<StoreFile> selected, CompactionRequest request)
          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)
          Deprecated. use preFlush(ObserverContext, Store, InternalScanner) instead.
 void postFlush(ObserverContext<RegionCoprocessorEnvironment> c, Store store, StoreFile resultFile)
          Called after a Store's 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 postLockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, byte[] row)
          Deprecated. Will be removed in 0.96
 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 postScannerFilterRow(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, byte[] currentRow, boolean hasMore)
          This will be called by the scan flow when the current scanned row is being filtered out by the filter.
 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 postUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, long lockId)
          Deprecated. Will be removed in 0.96
 void postWALRestore(ObserverContext<RegionCoprocessorEnvironment> ctx, HRegionInfo info, HLogKey logKey, WALEdit logEdit)
          Called after a WALEdit replayed for this region.
 Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append)
          Called before Append
 void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
          This will be called for every batch mutation operation happening at the server.
 void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[],String>> familyPaths)
          Called before bulkLoadHFile.
 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.
 InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner, CompactionRequest request)
          Called prior to writing the StoreFiles selected for compaction into a new StoreFile.
 InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs, InternalScanner s)
          Called prior to writing the StoreFiles selected for compaction into a new StoreFile and prior to creating the scanner used to read the input files.
 InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs, InternalScanner s, CompactionRequest request)
          Called prior to writing the StoreFiles selected for compaction into a new StoreFile and prior to creating the scanner used to read the input files.
 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 preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c, Store store, List<StoreFile> candidates, CompactionRequest request)
          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)
          Deprecated. use preFlush(ObserverContext, Store, InternalScanner) instead
 InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> c, Store store, InternalScanner scanner)
          Called before a Store's memstore is flushed to disk.
 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.
 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 preLockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, byte[] row)
          Deprecated. Will be removed in 0.96
 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.
 KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, Scan scan, NavigableSet<byte[]> targetCols, KeyValueScanner s)
          Called before a store opens a new scanner.
 void preUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, long lockId)
          Deprecated. Will be removed in 0.96
 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)
             throws IOException
Called before the region is reported as open to the master.

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

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

preFlushScannerOpen

InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                                    Store store,
                                    KeyValueScanner memstoreScanner,
                                    InternalScanner s)
                                    throws IOException
Called before a memstore is flushed to disk and prior to creating the scanner to read from the memstore. To override or modify how a memstore is flushed, 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.

Parameters:
c - the environment provided by the region server
store - the store being flushed
memstoreScanner - the scanner for the memstore that is flushed
s - the base scanner, if not null, from previous RegionObserver in the chain
Returns:
the scanner to use during the flush. null if the default implementation is to be used.
Throws:
IOException - if an error occurred on the coprocessor

preFlush

void preFlush(ObserverContext<RegionCoprocessorEnvironment> c)
              throws IOException
Deprecated. use preFlush(ObserverContext, Store, InternalScanner) instead

Called before the memstore is flushed to disk.

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

preFlush

InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> c,
                         Store store,
                         InternalScanner scanner)
                         throws IOException
Called before a Store's memstore is flushed to disk.

Parameters:
c - the environment provided by the region server
store - the store where compaction is being requested
scanner - the scanner over existing data used in the store file
Returns:
the scanner to use during compaction. Should not be null unless the implementation is writing new store files on its own.
Throws:
IOException - if an error occurred on the coprocessor

postFlush

void postFlush(ObserverContext<RegionCoprocessorEnvironment> c)
               throws IOException
Deprecated. use preFlush(ObserverContext, Store, InternalScanner) instead.

Called after the memstore is flushed to disk.

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

postFlush

void postFlush(ObserverContext<RegionCoprocessorEnvironment> c,
               Store store,
               StoreFile resultFile)
               throws IOException
Called after a Store's memstore is flushed to disk.

Parameters:
c - the environment provided by the region server
store - the store being flushed
resultFile - the new store file written out during compaction
Throws:
IOException - if an error occurred on the coprocessor

preCompactSelection

void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c,
                         Store store,
                         List<StoreFile> candidates,
                         CompactionRequest request)
                         throws IOException
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
request - custom compaction request
Throws:
IOException - if an error occurred on the coprocessor

preCompactSelection

void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c,
                         Store store,
                         List<StoreFile> candidates)
                         throws IOException
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
Throws:
IOException - if an error occurred on the coprocessor

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

postCompactSelection

void postCompactSelection(ObserverContext<RegionCoprocessorEnvironment> c,
                          Store store,
                          com.google.common.collect.ImmutableList<StoreFile> selected,
                          CompactionRequest request)
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
request - custom compaction request

preCompact

InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                           Store store,
                           InternalScanner scanner)
                           throws IOException
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.
Throws:
IOException - if an error occurred on the coprocessor

preCompact

InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                           Store store,
                           InternalScanner scanner,
                           CompactionRequest request)
                           throws IOException
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
request - the requested compaction
Returns:
the scanner to use during compaction. Should not be null unless the implementation is writing new store files on its own.
Throws:
IOException - if an error occurred on the coprocessor

preCompactScannerOpen

InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                                      Store store,
                                      List<? extends KeyValueScanner> scanners,
                                      ScanType scanType,
                                      long earliestPutTs,
                                      InternalScanner s)
                                      throws IOException
Called prior to writing the StoreFiles 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.

Parameters:
c - the environment provided by the region server
store - the store being compacted
scanners - the list StoreFileScanners to be read from
scantype - the ScanType indicating whether this is a major or minor compaction
earliestPutTs - timestamp of the earliest put that was found in any of the involved store files
s - the base scanner, if not null, from previous RegionObserver in the chain
Returns:
the scanner to use during compaction. null if the default implementation is to be used.
Throws:
IOException - if an error occurred on the coprocessor

preCompactScannerOpen

InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                                      Store store,
                                      List<? extends KeyValueScanner> scanners,
                                      ScanType scanType,
                                      long earliestPutTs,
                                      InternalScanner s,
                                      CompactionRequest request)
                                      throws IOException
Called prior to writing the StoreFiles 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.

Parameters:
c - the environment provided by the region server
store - the store being compacted
scanners - the list StoreFileScanners to be read from
scanType - the ScanType indicating whether this is a major or minor compaction
earliestPutTs - timestamp of the earliest put that was found in any of the involved store files
s - the base scanner, if not null, from previous RegionObserver in the chain
request - the requested compaction
Returns:
the scanner to use during compaction. null if the default implementation is to be used.
Throws:
IOException - if an error occurred on the coprocessor

postCompact

void postCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                 Store store,
                 StoreFile resultFile)
                 throws IOException
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
Throws:
IOException - if an error occurred on the coprocessor

postCompact

void postCompact(ObserverContext<RegionCoprocessorEnvironment> c,
                 Store store,
                 StoreFile resultFile,
                 CompactionRequest request)
                 throws IOException
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
request - the requested compaction
Throws:
IOException - if an error occurred on the coprocessor

preSplit

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

Parameters:
c - the environment provided by the region server (e.getRegion() returns the parent region)
Throws:
IOException - if an error occurred on the coprocessor

postSplit

void postSplit(ObserverContext<RegionCoprocessorEnvironment> c,
               HRegion l,
               HRegion r)
               throws IOException
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
Throws:
IOException - if an error occurred on the coprocessor

preClose

void preClose(ObserverContext<RegionCoprocessorEnvironment> c,
              boolean abortRequested)
              throws IOException
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
Throws:
IOException

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

preBatchMutate

void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
                    MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
                    throws IOException
This will be called for every batch mutation operation happening at the server. This will be called after acquiring the locks on the mutating rows and after applying the proper timestamp for each Mutation at the server. The batch may contain Put/Delete. By setting OperationStatus of Mutations (MiniBatchOperationInProgress.setOperationStatus(int, OperationStatus)), RegionObserver can make HRegion to skip these Mutations.

Parameters:
c - the environment provided by the region server
miniBatchOp - batch of Mutations getting applied to region.
Throws:
IOException - if an error occurred on the coprocessor

postBatchMutate

void postBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c,
                     MiniBatchOperationInProgress<Pair<Mutation,Integer>> miniBatchOp)
                     throws IOException
This will be called after applying a batch of Mutations on a region. The Mutations are added to memstore and WAL.

Parameters:
c - the environment provided by the region server
miniBatchOp - batch of Mutations applied to region.
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

preAppend

Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c,
                 Append append)
                 throws IOException
Called before Append

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
append - Append object
Returns:
result to return to the client if bypassing default processing
Throws:
IOException - if an error occurred on the coprocessor

postAppend

Result postAppend(ObserverContext<RegionCoprocessorEnvironment> c,
                  Append append,
                  Result result)
                  throws IOException
Called after Append

Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors

Parameters:
c - the environment provided by the region server
append - Append object
result - the result returned by increment
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

preStoreScannerOpen

KeyValueScanner preStoreScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
                                    Store store,
                                    Scan scan,
                                    NavigableSet<byte[]> targetCols,
                                    KeyValueScanner s)
                                    throws IOException
Called before a store opens a new scanner. This hook is called when a "user" scanner is opened.

See preFlushScannerOpen(ObserverContext, Store, KeyValueScanner, InternalScanner) and 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.

Parameters:
c - the environment provided by the region server
store - the store being scanned
scan - the Scan specification
targetCols - columns to be used in the scanner
s - the base scanner, if not null, from previous RegionObserver in the chain
Returns:
a KeyValueScanner instance to use or null to use the default implementation
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

postScannerFilterRow

boolean postScannerFilterRow(ObserverContext<RegionCoprocessorEnvironment> c,
                             InternalScanner s,
                             byte[] currentRow,
                             boolean hasMore)
                             throws IOException
This will be called by the scan flow when the current scanned row is being filtered out by the filter. The filter may be filtering out the row via any of the below scenarios
  1. boolean filterRowKey(byte [] buffer, int offset, int length) returning true
  2. boolean filterRow() returning true
  3. void filterRow(List kvs) removing all the kvs from the passed List

Parameters:
c - the environment provided by the region server
s - the scanner
currentRow - The current rowkey which got filtered out
hasMore - the 'has more' indication
Returns:
whether more rows are available for the scanner or not
Throws:
IOException

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

preBulkLoadHFile

void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
                      List<Pair<byte[],String>> familyPaths)
                      throws IOException
Called before bulkLoadHFile. Users can create a StoreFile instance to access the contents of a HFile.

Parameters:
ctx -
familyPaths - pairs of { CF, HFile path } submitted for bulk load. Adding or removing from this list will add or remove HFiles to be bulk loaded.
Throws:
IOException

postBulkLoadHFile

boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
                          List<Pair<byte[],String>> familyPaths,
                          boolean hasLoaded)
                          throws IOException
Called after bulkLoadHFile.

Parameters:
ctx -
familyPaths - pairs of { CF, HFile path } submitted for bulk load
hasLoaded - whether the bulkLoad was successful
Returns:
the new value of hasLoaded
Throws:
IOException

preLockRow

@Deprecated
void preLockRow(ObserverContext<RegionCoprocessorEnvironment> ctx,
                           byte[] regionName,
                           byte[] row)
                throws IOException
Deprecated. Will be removed in 0.96

Called before locking a row.

Parameters:
ctx -
regionName -
row -
Throws:
IOException - Signals that an I/O exception has occurred.

postLockRow

@Deprecated
void postLockRow(ObserverContext<RegionCoprocessorEnvironment> ctx,
                            byte[] regionName,
                            byte[] row)
                 throws IOException
Deprecated. Will be removed in 0.96

Called after locking a row.

Parameters:
ctx -
regionName - the region name
row -
Throws:
IOException - Signals that an I/O exception has occurred.

preUnlockRow

@Deprecated
void preUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx,
                             byte[] regionName,
                             long lockId)
                  throws IOException
Deprecated. Will be removed in 0.96

Called before unlocking a row.

Parameters:
ctx -
regionName -
lockId - the lock id
Throws:
IOException - Signals that an I/O exception has occurred.

postUnlockRow

@Deprecated
void postUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx,
                              byte[] regionName,
                              long lockId)
                   throws IOException
Deprecated. Will be removed in 0.96

Called after unlocking a row.

Parameters:
ctx -
regionName - the region name
lockId - the lock id
Throws:
IOException - Signals that an I/O exception has occurred.


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