@InterfaceAudience.Private public class ThriftHBaseServiceHandler extends Object implements org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface
| Modifier and Type | Class and Description |
|---|---|
private static class |
ThriftHBaseServiceHandler.THBaseServiceMetricsProxy |
private static class |
ThriftHBaseServiceHandler.TIOErrorWithCause |
| Modifier and Type | Field and Description |
|---|---|
(package private) static String |
CLEANUP_INTERVAL |
private ConnectionCache |
connectionCache |
private static IOException |
ioe |
private boolean |
isReadOnly |
private static org.slf4j.Logger |
LOG |
(package private) static String |
MAX_IDLETIME |
private AtomicInteger |
nextScannerId |
private Map<Integer,ResultScanner> |
scannerMap |
| Constructor and Description |
|---|
ThriftHBaseServiceHandler(org.apache.hadoop.conf.Configuration conf,
UserProvider userProvider) |
| Modifier and Type | Method and Description |
|---|---|
private int |
addScanner(ResultScanner scanner)
Assigns a unique ID to the scanner and adds the mapping to an internal HashMap.
|
org.apache.hadoop.hbase.thrift2.generated.TResult |
append(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TAppend append) |
boolean |
checkAndDelete(ByteBuffer table,
ByteBuffer row,
ByteBuffer family,
ByteBuffer qualifier,
ByteBuffer value,
org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle)
Atomically checks if a row/family/qualifier value matches the expected
value.
|
boolean |
checkAndMutate(ByteBuffer table,
ByteBuffer row,
ByteBuffer family,
ByteBuffer qualifier,
org.apache.hadoop.hbase.thrift2.generated.TCompareOp compareOp,
ByteBuffer value,
org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations)
Atomically checks if a row/family/qualifier value matches the expected
value.
|
boolean |
checkAndPut(ByteBuffer table,
ByteBuffer row,
ByteBuffer family,
ByteBuffer qualifier,
ByteBuffer value,
org.apache.hadoop.hbase.thrift2.generated.TPut put)
Atomically checks if a row/family/qualifier value matches the expected
value.
|
private void |
checkReadOnlyMode() |
void |
closeScanner(int scannerId)
Closes the scanner.
|
private void |
closeTable(Table table) |
List<org.apache.hadoop.hbase.thrift2.generated.TDelete> |
deleteMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deletes)
Bulk commit a List of TDeletes to the table.
|
void |
deleteSingle(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle)
Deletes as specified by the TDelete.
|
boolean |
exists(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TGet get)
Test for the existence of columns in the table, as specified in the TGet.
|
List<Boolean> |
existsAll(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets)
Test for the existence of columns in the table, as specified by the TGets.
|
org.apache.hadoop.hbase.thrift2.generated.TResult |
get(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TGet get)
Method for getting data from a row.
|
List<org.apache.hadoop.hbase.thrift2.generated.THRegionLocation> |
getAllRegionLocations(ByteBuffer table)
Get all of the region locations for a given table.
|
private RegionLocator |
getLocator(ByteBuffer tableName) |
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets)
Method for getting multiple rows.
|
org.apache.hadoop.hbase.thrift2.generated.THRegionLocation |
getRegionLocation(ByteBuffer table,
ByteBuffer row,
boolean reload)
Given a table and a row get the location of the region that
would contain the given row key.
|
private ResultScanner |
getScanner(int id)
Returns the Scanner associated with the specified Id.
|
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getScannerResults(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TScan scan,
int numRows)
Get results for the provided TScan object.
|
List<org.apache.hadoop.hbase.thrift2.generated.TResult> |
getScannerRows(int scannerId,
int numRows)
Grabs multiple rows from a Scanner.
|
private Table |
getTable(ByteBuffer tableName) |
private org.apache.hadoop.hbase.thrift2.generated.TIOError |
getTIOError(IOException e) |
org.apache.hadoop.hbase.thrift2.generated.TResult |
increment(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TIncrement increment) |
private boolean |
isReadOnly() |
void |
mutateRow(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations)
mutateRow performs multiple mutations atomically on a single row.
|
static org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface |
newInstance(org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface handler,
ThriftMetrics metrics) |
private static long |
now() |
int |
openScanner(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TScan scan)
Get a Scanner for the provided TScan object.
|
void |
put(ByteBuffer table,
org.apache.hadoop.hbase.thrift2.generated.TPut put)
Commit a TPut to a table.
|
void |
putMultiple(ByteBuffer table,
List<org.apache.hadoop.hbase.thrift2.generated.TPut> puts)
Commit a List of Puts to the table.
|
protected ResultScanner |
removeScanner(int id)
Removes the scanner associated with the specified ID from the internal HashMap.
|
(package private) void |
setEffectiveUser(String effectiveUser) |
private static final org.slf4j.Logger LOG
private final AtomicInteger nextScannerId
private final Map<Integer,ResultScanner> scannerMap
private final ConnectionCache connectionCache
static final String CLEANUP_INTERVAL
static final String MAX_IDLETIME
private static final IOException ioe
private boolean isReadOnly
ThriftHBaseServiceHandler(org.apache.hadoop.conf.Configuration conf, UserProvider userProvider) throws IOException
IOExceptionpublic static org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface newInstance(org.apache.hadoop.hbase.thrift2.generated.THBaseService.Iface handler, ThriftMetrics metrics)
private static long now()
private Table getTable(ByteBuffer tableName)
private RegionLocator getLocator(ByteBuffer tableName)
private void closeTable(Table table) throws org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.hadoop.hbase.thrift2.generated.TIOErrorprivate org.apache.hadoop.hbase.thrift2.generated.TIOError getTIOError(IOException e)
private int addScanner(ResultScanner scanner)
scanner - to addprivate ResultScanner getScanner(int id)
id - of the Scanner to getvoid setEffectiveUser(String effectiveUser)
protected ResultScanner removeScanner(int id)
id - of the Scanner to removenull if the Id is invalidpublic boolean exists(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TGet get) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceexists in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to check onget - the TGet to check fororg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic List<Boolean> existsAll(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfaceexistsAll in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to check ongets - a list of TGets to check fororg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic org.apache.hadoop.hbase.thrift2.generated.TResult get(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TGet get) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceget in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to get fromget - the TGet to fetchorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic List<org.apache.hadoop.hbase.thrift2.generated.TResult> getMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TGet> gets) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacegetMultiple in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to get fromgets - a list of TGets to fetch, the Result list
will have the Results at corresponding positions
or null if there was an errororg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic void put(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TPut put) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceput in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to put data input - the TPut to putorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic boolean checkAndPut(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, org.apache.hadoop.hbase.thrift2.generated.TPut put) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacecheckAndPut in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - to check in and put torow - row to checkfamily - column family to checkqualifier - column qualifier to checkvalue - the expected value, if not provided the
check is for the non-existence of the
column in questionput - the TPut to put if the check succeedsorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic void putMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TPut> puts) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfaceputMultiple in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to put data inputs - a list of TPuts to commitorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic void deleteSingle(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacedeleteSingle in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to delete fromdeleteSingle - the TDelete to deleteorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deleteMultiple(ByteBuffer table, List<org.apache.hadoop.hbase.thrift2.generated.TDelete> deletes) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacedeleteMultiple in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to delete fromdeletes - list of TDeletes to deleteorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic boolean checkAndMutate(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, org.apache.hadoop.hbase.thrift2.generated.TCompareOp compareOp, ByteBuffer value, org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacecheckAndMutate in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - to check in and delete fromrow - row to checkfamily - column family to checkqualifier - column qualifier to checkcompareOp - comparison to make on the valuevalue - the expected value to be compared against, if not provided the
check is for the non-existence of the column in questionrowMutations - row mutations to execute if the value matchesorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic boolean checkAndDelete(ByteBuffer table, ByteBuffer row, ByteBuffer family, ByteBuffer qualifier, ByteBuffer value, org.apache.hadoop.hbase.thrift2.generated.TDelete deleteSingle) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacecheckAndDelete in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - to check in and delete fromrow - row to checkfamily - column family to checkqualifier - column qualifier to checkvalue - the expected value, if not provided the
check is for the non-existence of the
column in questiondeleteSingle - the TDelete to execute if the check succeedsorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic org.apache.hadoop.hbase.thrift2.generated.TResult increment(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TIncrement increment) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
increment in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic org.apache.hadoop.hbase.thrift2.generated.TResult append(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TAppend append) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
append in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic int openScanner(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TScan scan) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfaceopenScanner in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to get the Scanner forscan - the scan object to get a Scanner fororg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic List<org.apache.hadoop.hbase.thrift2.generated.TResult> getScannerRows(int scannerId, int numRows) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacegetScannerRows in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacescannerId - the Id of the Scanner to return rows from. This is an Id returned from the openScanner function.numRows - number of rows to returnorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.hadoop.hbase.thrift2.generated.TIllegalArgumentorg.apache.thrift.TExceptionpublic List<org.apache.hadoop.hbase.thrift2.generated.TResult> getScannerResults(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TScan scan, int numRows) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacegetScannerResults in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - the table to get the Scanner forscan - the scan object to get a Scanner fornumRows - number of rows to returnorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic void closeScanner(int scannerId) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.hadoop.hbase.thrift2.generated.TIllegalArgument, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacecloseScanner in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacescannerId - the Id of the Scanner to close *org.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.hadoop.hbase.thrift2.generated.TIllegalArgumentorg.apache.thrift.TExceptionpublic void mutateRow(ByteBuffer table, org.apache.hadoop.hbase.thrift2.generated.TRowMutations rowMutations) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacemutateRow in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifacetable - table to apply the mutationsrowMutations - mutations to applyorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic List<org.apache.hadoop.hbase.thrift2.generated.THRegionLocation> getAllRegionLocations(ByteBuffer table) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacegetAllRegionLocations in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionpublic org.apache.hadoop.hbase.thrift2.generated.THRegionLocation getRegionLocation(ByteBuffer table, ByteBuffer row, boolean reload) throws org.apache.hadoop.hbase.thrift2.generated.TIOError, org.apache.thrift.TException
org.apache.hadoop.hbase.thrift2.generated.THBaseService.IfacegetRegionLocation in interface org.apache.hadoop.hbase.thrift2.generated.THBaseService.Ifaceorg.apache.hadoop.hbase.thrift2.generated.TIOErrororg.apache.thrift.TExceptionprivate void checkReadOnlyMode() throws org.apache.hadoop.hbase.thrift2.generated.TIOError
org.apache.hadoop.hbase.thrift2.generated.TIOErrorprivate boolean isReadOnly()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.