public class AccessController extends BaseRegionObserver implements MasterObserver, RegionServerObserver, AccessControllerProtocol
AccessController
performs authorization checks for HBase operations
based on:
Permission.Action
values)AccessDeniedException
will be thrown for the operation.
To perform authorization checks, AccessController
relies on the
SecureRpcEngine
being loaded to provide
the user identities for remote requests.
The access control lists used for authorization can be manipulated via the
exposed AccessControllerProtocol
implementation, and the associated
grant
, revoke
, and user_permission
HBase shell
commands.
Coprocessor.State
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.logging.Log |
LOG |
PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_SYSTEM, PRIORITY_USER, VERSION
VERSION
Constructor and Description |
---|
AccessController() |
Modifier and Type | Method and Description |
---|---|
void |
checkPermissions(Permission[] permissions)
Checks whether the given Permissions will pass the access checks for the
current user.
|
ProtocolSignature |
getProtocolSignature(String protocol,
long clientVersion,
int clientMethodsHash)
Return protocol version corresponding to protocol interface.
|
long |
getProtocolVersion(String protocol,
long clientVersion)
Return protocol version corresponding to protocol interface.
|
List<UserPermission> |
getUserPermissions(byte[] tableName)
Queries the permissions currently stored for the given table, returning
a list of currently granted permissions, along with the user or group
each is associated with.
|
void |
grant(byte[] user,
TablePermission permission)
Deprecated.
|
void |
grant(UserPermission perm)
Grants the given user or group the privilege to perform the given actions
|
void |
postAddColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HColumnDescriptor column)
Called after the new column family has been created.
|
void |
postAssign(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo regionInfo)
Called after the region assignment has been requested.
|
void |
postBalance(ObserverContext<MasterCoprocessorEnvironment> c)
Called after the balancing plan has been submitted.
|
void |
postBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c,
boolean oldValue,
boolean newValue)
Called after the flag to enable/disable balancing has changed.
|
void |
postCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called after a snapshot clone operation has been requested.
|
void |
postCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
HTableDescriptor desc,
HRegionInfo[] regions)
Called after the createTable operation has been requested.
|
void |
postDelete(ObserverContext<RegionCoprocessorEnvironment> c,
Delete delete,
WALEdit edit,
boolean writeToWAL)
Called after the client deletes a value.
|
void |
postDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
byte[] col)
Called after the column family has been deleted.
|
void |
postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot)
Called after the delete snapshot operation has been requested.
|
void |
postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called after the deleteTable operation has been requested.
|
void |
postDisableTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called after the disableTable operation has been requested.
|
void |
postEnableTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called after the enableTable operation has been requested.
|
void |
postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<HTableDescriptor> descriptors)
Called after a getTableDescriptors request has been processed.
|
void |
postModifyColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HColumnDescriptor descriptor)
Called after the column family has been updated.
|
void |
postModifyTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HTableDescriptor htd)
Called after the modifyTable operation has been requested.
|
void |
postMove(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo region,
ServerName srcServer,
ServerName destServer)
Called after the region move has been requested.
|
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 |
postRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called after a snapshot restore operation has been requested.
|
void |
postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c,
InternalScanner s)
Called after the client closes a scanner.
|
RegionScanner |
postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
Scan scan,
RegionScanner s)
Called after the client opens a new scanner.
|
void |
postSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called after the snapshot operation has been requested.
|
void |
postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx)
Called immediately after an active master instance has completed
initialization.
|
void |
postUnassign(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo regionInfo,
boolean force)
Called after the region unassignment has been requested.
|
void |
preAddColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HColumnDescriptor column)
Called prior to adding a new column family to the table.
|
Result |
preAppend(ObserverContext<RegionCoprocessorEnvironment> c,
Append append)
Called before Append
|
void |
preAssign(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo regionInfo)
Called prior to assigning a specific region.
|
void |
preBalance(ObserverContext<MasterCoprocessorEnvironment> c)
Called prior to requesting rebalancing of the cluster regions, though after
the initial checks for regions in transition and the balance switch flag.
|
boolean |
preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c,
boolean newValue)
Called prior to modifying the flag used to enable/disable region balancing.
|
void |
preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
List<Pair<byte[],String>> familyPaths)
Verifies user has WRITE privileges on
the Column Families involved in the bulkLoadHFile
request.
|
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 |
preCleanupBulkLoad(RegionCoprocessorEnvironment e)
Authorization security check for
SecureBulkLoadProtocol.cleanupBulkLoad()
|
void |
preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called before a snapshot is cloned.
|
void |
preClose(ObserverContext<RegionCoprocessorEnvironment> e,
boolean abortRequested)
Called before the region is reported as closed to the master.
|
InternalScanner |
preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
Store store,
InternalScanner scanner)
Called prior to writing the
StoreFile s selected for compaction into a new
StoreFile . |
void |
preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> e,
Store store,
List<StoreFile> candidates)
Called prior to selecting the
StoreFile s to compact from the list of available
candidates. |
void |
preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
HTableDescriptor desc,
HRegionInfo[] regions)
Called before a new table is created by
HMaster . |
void |
preDelete(ObserverContext<RegionCoprocessorEnvironment> c,
Delete delete,
WALEdit edit,
boolean writeToWAL)
Called before the client deletes a value.
|
void |
preDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
byte[] col)
Called prior to deleting the entire column family.
|
void |
preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot)
Called before a snapshot is deleted.
|
void |
preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called before
HMaster deletes a
table
It can't bypass the default action, e.g., ctx.bypass() won't have effect. |
void |
preDisableTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called prior to disabling a table.
|
void |
preEnableTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName)
Called prior to enabling a table.
|
boolean |
preExists(ObserverContext<RegionCoprocessorEnvironment> c,
Get get,
boolean exists)
Called before the client tests for existence using a Get.
|
void |
preFlush(ObserverContext<RegionCoprocessorEnvironment> e)
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.
|
void |
preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
List<String> tableNamesList,
List<HTableDescriptor> descriptors)
Called before a getTableDescriptors request has been processed.
|
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)
Called before locking a row.
|
void |
preModifyColumn(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HColumnDescriptor descriptor)
Called prior to modifying a column family's attributes.
|
void |
preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c,
byte[] tableName,
HTableDescriptor htd)
Called prior to modifying a table's properties.
|
void |
preMove(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo region,
ServerName srcServer,
ServerName destServer)
Called prior to moving a given region from one region server to another.
|
void |
preOpen(ObserverContext<RegionCoprocessorEnvironment> e)
Called before the region is reported as open to the master.
|
void |
prePrepareBulkLoad(RegionCoprocessorEnvironment e)
Authorization check for
SecureBulkLoadProtocol.prepareBulkLoad()
|
void |
prePut(ObserverContext<RegionCoprocessorEnvironment> c,
Put put,
WALEdit edit,
boolean writeToWAL)
Called before the client stores a value.
|
void |
preRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called before a snapshot is restored.
|
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 |
preShutdown(ObserverContext<MasterCoprocessorEnvironment> c)
Called prior to shutting down the full HBase cluster, including this
HMaster process. |
void |
preSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx,
HBaseProtos.SnapshotDescription snapshot,
HTableDescriptor hTableDescriptor)
Called before a new snapshot is taken.
|
void |
preSplit(ObserverContext<RegionCoprocessorEnvironment> e)
Called before the region is split.
|
void |
preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c)
Called immediately prior to stopping this
HMaster process. |
void |
preStopRegionServer(ObserverContext<RegionServerCoprocessorEnvironment> env)
Called before stopping region server.
|
void |
preUnassign(ObserverContext<MasterCoprocessorEnvironment> c,
HRegionInfo regionInfo,
boolean force)
Called prior to unassigning a given region.
|
void |
preUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx,
byte[] regionName,
long lockId)
Called before unlocking a row.
|
void |
requirePermission(String request,
Permission.Action perm,
RegionCoprocessorEnvironment env,
Map<byte[],? extends Collection<?>> families)
Authorizes that the current user has permission to perform the given
action on the set of table column families.
|
void |
revoke(byte[] user,
TablePermission permission)
Deprecated.
|
void |
revoke(UserPermission perm)
Revokes a previously granted privilege from a user or group.
|
void |
start(CoprocessorEnvironment env) |
void |
stop(CoprocessorEnvironment env) |
postAppend, postBatchMutate, postBulkLoadHFile, postCheckAndDelete, postCheckAndPut, postClose, postCompact, postCompact, postCompactSelection, postCompactSelection, postExists, postFlush, postFlush, postGet, postGetClosestRowBefore, postIncrement, postIncrementColumnValue, postLockRow, postScannerFilterRow, postScannerNext, postSplit, postUnlockRow, postWALRestore, preBatchMutate, preCompact, preCompactScannerOpen, preCompactScannerOpen, preCompactSelection, preFlush, preFlushScannerOpen, preStoreScannerOpen, preWALRestore
public void requirePermission(String request, Permission.Action perm, RegionCoprocessorEnvironment env, Map<byte[],? extends Collection<?>> families) throws IOException
perm
- Action that is requiredenv
- The current coprocessor environmentfamilies
- The map of column families-qualifiers.AccessDeniedException
- if the authorization check failedIOException
public void start(CoprocessorEnvironment env) throws IOException
start
in interface Coprocessor
start
in class BaseRegionObserver
IOException
public void stop(CoprocessorEnvironment env)
stop
in interface Coprocessor
stop
in class BaseRegionObserver
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c, HTableDescriptor desc, HRegionInfo[] regions) throws IOException
MasterObserver
HMaster
.
It can't bypass the default action, e.g., ctx.bypass() won't have effect.preCreateTable
in interface MasterObserver
c
- the environment to interact with the framework and masterdesc
- the HTableDescriptor for the tableregions
- the initial regions created for the tableIOException
public void postCreateTable(ObserverContext<MasterCoprocessorEnvironment> c, HTableDescriptor desc, HRegionInfo[] regions) throws IOException
MasterObserver
postCreateTable
in interface MasterObserver
c
- the environment to interact with the framework and masterdesc
- the HTableDescriptor for the tableregions
- the initial regions created for the tableIOException
public void preDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
HMaster
deletes a
table
It can't bypass the default action, e.g., ctx.bypass() won't have effect.preDeleteTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void postDeleteTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
postDeleteTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void preModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HTableDescriptor htd) throws IOException
MasterObserver
preModifyTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablehtd
- the HTableDescriptorIOException
public void postModifyTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HTableDescriptor htd) throws IOException
MasterObserver
postModifyTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablehtd
- the HTableDescriptorIOException
public void preAddColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HColumnDescriptor column) throws IOException
MasterObserver
preAddColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablecolumn
- the HColumnDescriptorIOException
public void postAddColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HColumnDescriptor column) throws IOException
MasterObserver
postAddColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablecolumn
- the HColumnDescriptorIOException
public void preModifyColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HColumnDescriptor descriptor) throws IOException
MasterObserver
preModifyColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tabledescriptor
- the HColumnDescriptorIOException
public void postModifyColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, HColumnDescriptor descriptor) throws IOException
MasterObserver
postModifyColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tabledescriptor
- the HColumnDescriptorIOException
public void preDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, byte[] col) throws IOException
MasterObserver
preDeleteColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablecol
- the columnIOException
public void postDeleteColumn(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName, byte[] col) throws IOException
MasterObserver
postDeleteColumn
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tablecol
- the columnIOException
public void preEnableTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
preEnableTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void postEnableTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
postEnableTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void preDisableTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
preDisableTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void postDisableTable(ObserverContext<MasterCoprocessorEnvironment> c, byte[] tableName) throws IOException
MasterObserver
postDisableTable
in interface MasterObserver
c
- the environment to interact with the framework and mastertableName
- the name of the tableIOException
public void preMove(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo region, ServerName srcServer, ServerName destServer) throws IOException
MasterObserver
preMove
in interface MasterObserver
c
- the environment to interact with the framework and masterregion
- the HRegionInfosrcServer
- the source ServerNamedestServer
- the destination ServerNameIOException
public void postMove(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo region, ServerName srcServer, ServerName destServer) throws IOException
MasterObserver
postMove
in interface MasterObserver
c
- the environment to interact with the framework and masterregion
- the HRegionInfosrcServer
- the source ServerNamedestServer
- the destination ServerNameIOException
public void preAssign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo) throws IOException
MasterObserver
preAssign
in interface MasterObserver
c
- the environment to interact with the framework and masterregionInfo
- the regionInfo of the regionIOException
public void postAssign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo) throws IOException
MasterObserver
postAssign
in interface MasterObserver
c
- the environment to interact with the framework and masterregionInfo
- the regionInfo of the regionIOException
public void preUnassign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo, boolean force) throws IOException
MasterObserver
preUnassign
in interface MasterObserver
c
- the environment to interact with the framework and masterforce
- whether to force unassignment or notIOException
public void postUnassign(ObserverContext<MasterCoprocessorEnvironment> c, HRegionInfo regionInfo, boolean force) throws IOException
MasterObserver
postUnassign
in interface MasterObserver
c
- the environment to interact with the framework and masterforce
- whether to force unassignment or notIOException
public void preBalance(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
preBalance
in interface MasterObserver
c
- the environment to interact with the framework and masterIOException
public void postBalance(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
postBalance
in interface MasterObserver
c
- the environment to interact with the framework and masterIOException
public boolean preBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c, boolean newValue) throws IOException
MasterObserver
preBalanceSwitch
in interface MasterObserver
c
- the coprocessor instance's environmentnewValue
- the new flag value submitted in the callIOException
public void postBalanceSwitch(ObserverContext<MasterCoprocessorEnvironment> c, boolean oldValue, boolean newValue) throws IOException
MasterObserver
postBalanceSwitch
in interface MasterObserver
c
- the coprocessor instance's environmentoldValue
- the previously set balanceSwitch valuenewValue
- the newly set balanceSwitch valueIOException
public void preShutdown(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
HMaster
process.preShutdown
in interface MasterObserver
IOException
public void preStopMaster(ObserverContext<MasterCoprocessorEnvironment> c) throws IOException
MasterObserver
HMaster
process.preStopMaster
in interface MasterObserver
IOException
public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException
MasterObserver
postStartMaster
in interface MasterObserver
IOException
public void preSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
preSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to snapshotIOException
public void postSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
postSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to snapshotIOException
public void preCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
preCloneSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to createIOException
public void postCloneSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
postCloneSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to createIOException
public void preRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
preRestoreSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to restoreIOException
public void postRestoreSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot, HTableDescriptor hTableDescriptor) throws IOException
MasterObserver
postRestoreSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor for the snapshothTableDescriptor
- the hTableDescriptor of the table to restoreIOException
public void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot) throws IOException
MasterObserver
preDeleteSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor of the snapshot to deleteIOException
public void postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, HBaseProtos.SnapshotDescription snapshot) throws IOException
MasterObserver
postDeleteSnapshot
in interface MasterObserver
ctx
- the environment to interact with the framework and mastersnapshot
- the SnapshotDescriptor of the snapshot to deleteIOException
public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException
RegionObserver
preOpen
in interface RegionObserver
preOpen
in class BaseRegionObserver
e
- the environment provided by the region serverIOException
- if an error occurred on the coprocessorpublic void postOpen(ObserverContext<RegionCoprocessorEnvironment> c)
RegionObserver
postOpen
in interface RegionObserver
postOpen
in class BaseRegionObserver
c
- the environment provided by the region serverpublic void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException
RegionObserver
preFlush
in interface RegionObserver
preFlush
in class BaseRegionObserver
e
- the environment provided by the region serverIOException
- if an error occurred on the coprocessorpublic void preSplit(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException
RegionObserver
preSplit
in interface RegionObserver
preSplit
in class BaseRegionObserver
e
- the environment provided by the region server (e.getRegion() returns the parent
region)IOException
- if an error occurred on the coprocessorpublic InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store, InternalScanner scanner) throws IOException
RegionObserver
StoreFile
s selected for compaction into a new
StoreFile
. To override or modify the compaction process, implementing classes have two
options:
InternalScanner
with a custom
implementation that is returned from this method. The custom scanner
can then inspect KeyValue
s from the wrapped scanner, applying
its own policy to what gets written.ObserverContext.bypass()
and provide a custom implementation for writing of new
StoreFile
s. Note: any implementations bypassing
core compaction using this approach must write out new store files
themselves or the existing data will no longer be available after
compaction.preCompact
in interface RegionObserver
preCompact
in class BaseRegionObserver
e
- the environment provided by the region serverstore
- the store being compactedscanner
- the scanner over existing data used in the store file rewritingnull
unless the
implementation is writing new store files on its own.IOException
- if an error occurred on the coprocessorpublic void preCompactSelection(ObserverContext<RegionCoprocessorEnvironment> e, Store store, List<StoreFile> candidates) throws IOException
RegionObserver
StoreFile
s to compact from the list of available
candidates. To alter the files used for compaction, you may mutate the passed in list of
candidates.preCompactSelection
in interface RegionObserver
preCompactSelection
in class BaseRegionObserver
e
- the environment provided by the region serverstore
- the store where compaction is being requestedcandidates
- the store files currently available for compactionIOException
- if an error occurred on the coprocessorpublic void preGetClosestRowBefore(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, Result result) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preGetClosestRowBefore
in interface RegionObserver
preGetClosestRowBefore
in class BaseRegionObserver
c
- the environment provided by the region serverrow
- the rowfamily
- the familyresult
- 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.IOException
- if an error occurred on the coprocessorpublic void preGet(ObserverContext<RegionCoprocessorEnvironment> c, Get get, List<KeyValue> result) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preGet
in interface RegionObserver
preGet
in class BaseRegionObserver
c
- the environment provided by the region serverget
- the Get requestresult
- 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.IOException
- if an error occurred on the coprocessorpublic boolean preExists(ObserverContext<RegionCoprocessorEnvironment> c, Get get, boolean exists) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preExists
in interface RegionObserver
preExists
in class BaseRegionObserver
c
- the environment provided by the region serverget
- the Get requestIOException
- if an error occurred on the coprocessorpublic void prePut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, boolean writeToWAL) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
prePut
in interface RegionObserver
prePut
in class BaseRegionObserver
c
- the environment provided by the region serverput
- The Put objectedit
- The WALEdit object that will be written to the walwriteToWAL
- true if the change should be written to the WALIOException
- if an error occurred on the coprocessorpublic void postPut(ObserverContext<RegionCoprocessorEnvironment> c, Put put, WALEdit edit, boolean writeToWAL)
RegionObserver
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
postPut
in interface RegionObserver
postPut
in class BaseRegionObserver
c
- the environment provided by the region serverput
- The Put objectedit
- The WALEdit object for the walwriteToWAL
- true if the change should be written to the WALpublic void preDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, boolean writeToWAL) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preDelete
in interface RegionObserver
preDelete
in class BaseRegionObserver
c
- the environment provided by the region serverdelete
- The Delete objectedit
- The WALEdit object for the walwriteToWAL
- true if the change should be written to the WALIOException
- if an error occurred on the coprocessorpublic void postDelete(ObserverContext<RegionCoprocessorEnvironment> c, Delete delete, WALEdit edit, boolean writeToWAL) throws IOException
RegionObserver
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
postDelete
in interface RegionObserver
postDelete
in class BaseRegionObserver
c
- the environment provided by the region serverdelete
- The Delete objectedit
- The WALEdit object for the walwriteToWAL
- true if the change should be written to the WALIOException
- if an error occurred on the coprocessorpublic boolean preCheckAndPut(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Put put, boolean result) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preCheckAndPut
in interface RegionObserver
preCheckAndPut
in class BaseRegionObserver
c
- the environment provided by the region serverrow
- row to checkfamily
- column familyqualifier
- column qualifiercompareOp
- the comparison operationcomparator
- the comparatorput
- data to put if check succeedsIOException
- if an error occurred on the coprocessorpublic boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, CompareFilter.CompareOp compareOp, WritableByteArrayComparable comparator, Delete delete, boolean result) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preCheckAndDelete
in interface RegionObserver
preCheckAndDelete
in class BaseRegionObserver
c
- the environment provided by the region serverrow
- row to checkfamily
- column familyqualifier
- column qualifiercompareOp
- the comparison operationcomparator
- the comparatordelete
- delete to commit if check succeedsIOException
- if an error occurred on the coprocessorpublic long preIncrementColumnValue(ObserverContext<RegionCoprocessorEnvironment> c, byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preIncrementColumnValue
in interface RegionObserver
preIncrementColumnValue
in class BaseRegionObserver
c
- the environment provided by the region serverrow
- row to checkfamily
- column familyqualifier
- column qualifieramount
- long amount to incrementwriteToWAL
- true if the change should be written to the WALIOException
- if an error occurred on the coprocessorpublic Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append append) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preAppend
in interface RegionObserver
preAppend
in class BaseRegionObserver
c
- the environment provided by the region serverappend
- Append objectIOException
- if an error occurred on the coprocessorpublic Result preIncrement(ObserverContext<RegionCoprocessorEnvironment> c, Increment increment) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preIncrement
in interface RegionObserver
preIncrement
in class BaseRegionObserver
c
- the environment provided by the region serverincrement
- increment objectIOException
- if an error occurred on the coprocessorpublic RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preScannerOpen
in interface RegionObserver
preScannerOpen
in class BaseRegionObserver
c
- the environment provided by the region serverscan
- the Scan specifications
- if not null, the base scannerIOException
- if an error occurred on the coprocessorpublic RegionScanner postScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Scan scan, RegionScanner s) throws IOException
RegionObserver
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
postScannerOpen
in interface RegionObserver
postScannerOpen
in class BaseRegionObserver
c
- the environment provided by the region serverscan
- the Scan specifications
- if not null, the base scannerIOException
- if an error occurred on the coprocessorpublic boolean preScannerNext(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s, List<Result> result, int limit, boolean hasNext) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preScannerNext
in interface RegionObserver
preScannerNext
in class BaseRegionObserver
c
- the environment provided by the region servers
- the scannerresult
- 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 returnhasNext
- the 'has more' indicationIOException
- if an error occurred on the coprocessorpublic void preScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s) throws IOException
RegionObserver
Call CoprocessorEnvironment#bypass to skip default actions
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
preScannerClose
in interface RegionObserver
preScannerClose
in class BaseRegionObserver
c
- the environment provided by the region servers
- the scannerIOException
- if an error occurred on the coprocessorpublic void postScannerClose(ObserverContext<RegionCoprocessorEnvironment> c, InternalScanner s) throws IOException
RegionObserver
Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
postScannerClose
in interface RegionObserver
postScannerClose
in class BaseRegionObserver
c
- the environment provided by the region servers
- the scannerIOException
- if an error occurred on the coprocessorpublic void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx, List<Pair<byte[],String>> familyPaths) throws IOException
preBulkLoadHFile
in interface RegionObserver
preBulkLoadHFile
in class BaseRegionObserver
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.IOException
public void prePrepareBulkLoad(RegionCoprocessorEnvironment e) throws IOException
e
- IOException
public void preCleanupBulkLoad(RegionCoprocessorEnvironment e) throws IOException
e
- IOException
public void grant(UserPermission perm) throws IOException
AccessControllerProtocol
grant
in interface AccessControllerProtocol
perm
- the details of the provided user permissionsIOException
- if the grant could not be applied@Deprecated public void grant(byte[] user, TablePermission permission) throws IOException
AccessControllerProtocol
TablePermission
grant
in interface AccessControllerProtocol
user
- the user name, or, if prefixed with "@", group name receiving
the grantpermission
- the details of the provided permissionsIOException
- if the grant could not be appliedpublic void revoke(UserPermission perm) throws IOException
AccessControllerProtocol
TablePermission
details must exactly match
a stored grant. For example, if user "bob" has been granted "READ" access
to table "data", over column family and qualifer "info:colA", then the
table, column family and column qualifier must all be specified.
Attempting to revoke permissions over just the "data" table will have
no effect.revoke
in interface AccessControllerProtocol
IOException
- if the revocation could not be performed@Deprecated public void revoke(byte[] user, TablePermission permission) throws IOException
AccessControllerProtocol
TablePermission
details must exactly match
a stored grant. For example, if user "bob" has been granted "READ" access
to table "data", over column family and qualifer "info:colA", then the
table, column family and column qualifier must all be specified.
Attempting to revoke permissions over just the "data" table will have
no effect.revoke
in interface AccessControllerProtocol
user
- the user name, or, if prefixed with "@", group name whose
privileges are being revokedpermission
- the details of the previously granted permission to revokeIOException
- if the revocation could not be performedpublic List<UserPermission> getUserPermissions(byte[] tableName) throws IOException
AccessControllerProtocol
getUserPermissions
in interface AccessControllerProtocol
tableName
- the table of the permission grants to returnIOException
- if there is an error querying the permissionspublic void checkPermissions(Permission[] permissions) throws IOException
AccessControllerProtocol
checkPermissions
in interface AccessControllerProtocol
permissions
- to check for. Permission subclasses can be used
to do more specific checks at the table/family/column level.IOException
- if there is an error checking the permissionspublic long getProtocolVersion(String protocol, long clientVersion) throws IOException
VersionedProtocol
getProtocolVersion
in interface VersionedProtocol
protocol
- The classname of the protocol interfaceclientVersion
- The version of the protocol that the client speaksIOException
- if any IO error occurspublic ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException
VersionedProtocol
getProtocolSignature
in interface VersionedProtocol
protocol
- The classname of the protocol interfaceclientVersion
- The version of the protocol that the client speaksclientMethodsHash
- the hashcode of client protocol methodsIOException
for a default implementation
public void preClose(ObserverContext<RegionCoprocessorEnvironment> e, boolean abortRequested) throws IOException
RegionObserver
preClose
in interface RegionObserver
preClose
in class BaseRegionObserver
e
- the environment provided by the region serverabortRequested
- true if the region server is abortingIOException
public void preLockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, byte[] row) throws IOException
RegionObserver
preLockRow
in interface RegionObserver
preLockRow
in class BaseRegionObserver
IOException
- Signals that an I/O exception has occurred.public void preUnlockRow(ObserverContext<RegionCoprocessorEnvironment> ctx, byte[] regionName, long lockId) throws IOException
RegionObserver
preUnlockRow
in interface RegionObserver
preUnlockRow
in class BaseRegionObserver
lockId
- the lock idIOException
- Signals that an I/O exception has occurred.public void preStopRegionServer(ObserverContext<RegionServerCoprocessorEnvironment> env) throws IOException
RegionServerObserver
preStopRegionServer
in interface RegionServerObserver
env
- An instance of RegionServerCoprocessorEnvironmentIOException
- Signals that an I/O exception has occurred.public void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx, List<String> tableNamesList, List<HTableDescriptor> descriptors) throws IOException
MasterObserver
preGetTableDescriptors
in interface MasterObserver
ctx
- the environment to interact with the framework and mastertableNamesList
- the list of table names, or null if querying for alldescriptors
- an empty list, can be filled with what to return if bypassingIOException
public void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx, List<HTableDescriptor> descriptors) throws IOException
MasterObserver
postGetTableDescriptors
in interface MasterObserver
ctx
- the environment to interact with the framework and masterdescriptors
- the list of descriptors about to be returnedIOException
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.