org.apache.hadoop.hbase.regionserver.transactional
Class TransactionalRegionServer

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.HRegionServer
      extended by org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegionServer
All Implemented Interfaces:
Runnable, HConstants, HBaseRPCErrorHandler, HBaseRPCProtocolVersion, HRegionInterface, TransactionalRegionInterface, org.apache.hadoop.ipc.VersionedProtocol
Direct Known Subclasses:
IndexedRegionServer

public class TransactionalRegionServer
extends HRegionServer
implements TransactionalRegionInterface

RegionServer with support for transactions. Transactional logic is at the region level, so we mostly just delegate to the appropriate TransactionalRegion.


Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.regionserver.HRegionServer
abortRequested, conf, fsOk, isOnline, lock, log, numRegionsToReport, onlineRegions, quiesced, REGIONSERVER, safeMode, serverInfo, stopRequested, threadWakeFrequency
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion
versionID
 
Fields inherited from interface org.apache.hadoop.hbase.HConstants
ALL_META_COLUMNS, ALL_VERSIONS, COL_REGIONINFO, COL_REGIONINFO_ARRAY, COL_SERVER, COL_SPLITA, COL_SPLITB, COL_STARTCODE, COLUMN_FAMILY, COLUMN_FAMILY_ARRAY, COLUMN_FAMILY_HISTORIAN, COLUMN_FAMILY_HISTORIAN_STR, COLUMN_FAMILY_STR, DEFAULT_HOST, DEFAULT_MASTER_ADDRESS, DEFAULT_MASTER_INFOPORT, DEFAULT_MASTER_PORT, DEFAULT_MAX_FILE_SIZE, DEFAULT_REGION_SERVER_CLASS, DEFAULT_REGIONSERVER_ADDRESS, DEFAULT_REGIONSERVER_INFOPORT, DEFAULT_SIZE_RESERVATION_BLOCK, EMPTY_BYTE_ARRAY, EMPTY_END_ROW, EMPTY_START_ROW, FILE_SYSTEM_VERSION, FOREVER, HBASE_CLIENT_RETRIES_NUMBER_KEY, HBASE_DIR, HREGION_COMPACTIONDIR_NAME, HREGION_LOGDIR_NAME, HREGION_OLDLOGFILE_NAME, IN_MEMORY, LAST_ROW, LATEST_TIMESTAMP, MAJOR_COMPACTION_PERIOD, MASTER_ADDRESS, MAX_ROW_LENGTH, META_ROW_DELIMITER, META_TABLE_NAME, MODIFY_CLOSE_REGION, MODIFY_TABLE_COMPACT, MODIFY_TABLE_FLUSH, MODIFY_TABLE_MAJOR_COMPACT, MODIFY_TABLE_SET_HTD, MODIFY_TABLE_SPLIT, NAME, NINES, REGION_SERVER_CLASS, REGION_SERVER_IMPL, REGIONSERVER_ADDRESS, RETRY_BACKOFF, ROOT_TABLE_NAME, THREAD_WAKE_FREQUENCY, UTF8_ENCODING, VERSION_FILE_NAME, VERSIONS, WEEK_IN_SECONDS, ZERO_L, ZEROES
 
Constructor Summary
TransactionalRegionServer(HBaseConfiguration conf)
           
TransactionalRegionServer(HServerAddress address, HBaseConfiguration conf)
           
 
Method Summary
 void abort(byte[] regionName, long transactionId)
          Abort the transaction.
 void batchUpdate(long transactionId, byte[] regionName, BatchUpdate b)
          Applies a batch of updates via one RPC
 void beginTransaction(long transactionId, byte[] regionName)
          Sent to initiate a transaction.
 void commit(byte[] regionName, long transactionId)
          Commit the transaction.
 boolean commitRequest(byte[] regionName, long transactionId)
          Ask if we can commit the given transaction.
 void deleteAll(long transactionId, byte[] regionName, byte[] row, long timestamp)
          Delete all cells that match the passed row and whose timestamp is equal-to or older than the passed timestamp.
 Cell get(long transactionId, byte[] regionName, byte[] row, byte[] column)
          Retrieve a single value from the specified region for the specified row and column keys
 Cell[] get(long transactionId, byte[] regionName, byte[] row, byte[] column, int numVersions)
          Get the specified number of versions of the specified row and column
 Cell[] get(long transactionId, byte[] regionName, byte[] row, byte[] column, long timestamp, int numVersions)
          Get the specified number of versions of the specified row and column with the specified timestamp.
 long getProtocolVersion(String protocol, long clientVersion)
           
 RowResult getRow(long transactionId, byte[] regionName, byte[] row, byte[][] columns)
          Get selected columns for the specified row at the latest timestamp.
 RowResult getRow(long transactionId, byte[] regionName, byte[] row, byte[][] columns, long ts)
          Get selected columns for the specified row at a given timestamp.
 RowResult getRow(long transactionId, byte[] regionName, byte[] row, long ts)
          Get all the data for the specified row at a given timestamp
protected  TransactionalRegion getTransactionalRegion(byte[] regionName)
           
protected  void init(org.apache.hadoop.io.MapWritable c)
           
protected  HRegion instantiateRegion(HRegionInfo regionInfo)
           
 long openScanner(long transactionId, byte[] regionName, byte[][] cols, byte[] firstRow, long timestamp, RowFilterInterface filter)
          Opens a remote scanner with a RowFilter.
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.HRegionServer
abort, addProcessingMessage, addRowLock, addScanner, batchUpdate, batchUpdates, checkAndSave, checkFileSystem, checkOOME, checkOpen, close, createRegionLoad, deleteAll, deleteAll, deleteAllByRegex, deleteFamily, deleteFamilyByRegex, doMain, doMetrics, exists, get, getClosestRowBefore, getConfiguration, getCopyOfOnlineRegionsSortedBySize, getFileSystem, getFlushRequester, getGlobalMemcacheSize, getInfoServer, getLeases, getMetrics, getMostLoadedRegions, getOnlineRegion, getOnlineRegions, getOutboundMsgs, getRegion, getRegionInfo, getRegionsToCheck, getRequestCount, getRootDir, getRow, getServerInfo, getSortedOnlineRegionInfos, incrementColumnValue, isInSafeMode, isOnline, isStopRequested, lockRow, main, next, next, openScanner, run, runThread, setHDFSShutdownThreadOnExit, stop, unlockRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.ipc.HRegionInterface
batchUpdate, batchUpdates, checkAndSave, close, deleteAll, deleteAll, deleteAllByRegex, deleteFamily, deleteFamilyByRegex, exists, get, getClosestRowBefore, getRegionInfo, getRow, incrementColumnValue, lockRow, next, next, openScanner, unlockRow
 

Constructor Detail

TransactionalRegionServer

public TransactionalRegionServer(HBaseConfiguration conf)
                          throws IOException
Parameters:
conf -
Throws:
IOException

TransactionalRegionServer

public TransactionalRegionServer(HServerAddress address,
                                 HBaseConfiguration conf)
                          throws IOException
Parameters:
address -
conf -
Throws:
IOException
Method Detail

getProtocolVersion

public long getProtocolVersion(String protocol,
                               long clientVersion)
                        throws IOException
Specified by:
getProtocolVersion in interface org.apache.hadoop.ipc.VersionedProtocol
Overrides:
getProtocolVersion in class HRegionServer
Throws:
IOException

init

protected void init(org.apache.hadoop.io.MapWritable c)
             throws IOException
Overrides:
init in class HRegionServer
Throws:
IOException

instantiateRegion

protected HRegion instantiateRegion(HRegionInfo regionInfo)
                             throws IOException
Overrides:
instantiateRegion in class HRegionServer
Throws:
IOException

getTransactionalRegion

protected TransactionalRegion getTransactionalRegion(byte[] regionName)
                                              throws NotServingRegionException
Throws:
NotServingRegionException

abort

public void abort(byte[] regionName,
                  long transactionId)
           throws IOException
Description copied from interface: TransactionalRegionInterface
Abort the transaction.

Specified by:
abort in interface TransactionalRegionInterface
Throws:
IOException

batchUpdate

public void batchUpdate(long transactionId,
                        byte[] regionName,
                        BatchUpdate b)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Applies a batch of updates via one RPC

Specified by:
batchUpdate in interface TransactionalRegionInterface
regionName - name of the region to update
b - BatchUpdate
Throws:
IOException

commit

public void commit(byte[] regionName,
                   long transactionId)
            throws IOException
Description copied from interface: TransactionalRegionInterface
Commit the transaction.

Specified by:
commit in interface TransactionalRegionInterface
Throws:
IOException

commitRequest

public boolean commitRequest(byte[] regionName,
                             long transactionId)
                      throws IOException
Description copied from interface: TransactionalRegionInterface
Ask if we can commit the given transaction.

Specified by:
commitRequest in interface TransactionalRegionInterface
Returns:
true if we can commit
Throws:
IOException

get

public Cell get(long transactionId,
                byte[] regionName,
                byte[] row,
                byte[] column)
         throws IOException
Description copied from interface: TransactionalRegionInterface
Retrieve a single value from the specified region for the specified row and column keys

Specified by:
get in interface TransactionalRegionInterface
regionName - name of region
row - row key
column - column key
Returns:
alue for that region/row/column
Throws:
IOException

get

public Cell[] get(long transactionId,
                  byte[] regionName,
                  byte[] row,
                  byte[] column,
                  int numVersions)
           throws IOException
Description copied from interface: TransactionalRegionInterface
Get the specified number of versions of the specified row and column

Specified by:
get in interface TransactionalRegionInterface
regionName - region name
row - row key
column - column key
numVersions - number of versions to return
Returns:
array of values
Throws:
IOException

get

public Cell[] get(long transactionId,
                  byte[] regionName,
                  byte[] row,
                  byte[] column,
                  long timestamp,
                  int numVersions)
           throws IOException
Description copied from interface: TransactionalRegionInterface
Get the specified number of versions of the specified row and column with the specified timestamp.

Specified by:
get in interface TransactionalRegionInterface
regionName - region name
row - row key
column - column key
timestamp - timestamp
numVersions - number of versions to return
Returns:
array of values
Throws:
IOException

getRow

public RowResult getRow(long transactionId,
                        byte[] regionName,
                        byte[] row,
                        long ts)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Get all the data for the specified row at a given timestamp

Specified by:
getRow in interface TransactionalRegionInterface
regionName - region name
row - row key
ts - timestamp
Returns:
map of values
Throws:
IOException

getRow

public RowResult getRow(long transactionId,
                        byte[] regionName,
                        byte[] row,
                        byte[][] columns)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Get selected columns for the specified row at the latest timestamp.

Specified by:
getRow in interface TransactionalRegionInterface
regionName - region name
row - row key
columns - columns to get
Returns:
map of values
Throws:
IOException

getRow

public RowResult getRow(long transactionId,
                        byte[] regionName,
                        byte[] row,
                        byte[][] columns,
                        long ts)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Get selected columns for the specified row at a given timestamp.

Specified by:
getRow in interface TransactionalRegionInterface
regionName - region name
row - row key
columns - colums to get
ts - timestamp
Returns:
map of values
Throws:
IOException

deleteAll

public void deleteAll(long transactionId,
                      byte[] regionName,
                      byte[] row,
                      long timestamp)
               throws IOException
Description copied from interface: TransactionalRegionInterface
Delete all cells that match the passed row and whose timestamp is equal-to or older than the passed timestamp.

Specified by:
deleteAll in interface TransactionalRegionInterface
regionName - region name
row - row key
timestamp - Delete all entries that have this timestamp or older
Throws:
IOException

openScanner

public long openScanner(long transactionId,
                        byte[] regionName,
                        byte[][] cols,
                        byte[] firstRow,
                        long timestamp,
                        RowFilterInterface filter)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Opens a remote scanner with a RowFilter.

Specified by:
openScanner in interface TransactionalRegionInterface
regionName - name of region to scan
cols - columns to scan. If column name is a column family, all columns of the specified column family are returned. Its also possible to pass a regex for column family name. A column name is judged to be regex if it contains at least one of the following characters: \+|^&*$[]]}{)(.
firstRow - starting row to scan
timestamp - only return values whose timestamp is <= this value
filter - RowFilter for filtering results at the row-level.
Returns:
scannerId scanner identifier used in other calls
Throws:
IOException

beginTransaction

public void beginTransaction(long transactionId,
                             byte[] regionName)
                      throws IOException
Description copied from interface: TransactionalRegionInterface
Sent to initiate a transaction.

Specified by:
beginTransaction in interface TransactionalRegionInterface
regionName - name of region
Throws:
IOException


Copyright © 2008 The Apache Software Foundation