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, org.apache.zookeeper.Watcher
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.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.HConstants
HConstants.Modify
 
Nested classes/interfaces inherited from interface org.apache.zookeeper.Watcher
org.apache.zookeeper.Watcher.Event
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.regionserver.HRegionServer
abortRequested, conf, fsOk, haveRootRegion, hlog, isOnline, lock, numRegionsToReport, onlineRegions, quiesced, REGIONSERVER, safeMode, serverInfo, stopRequested, threadWakeFrequency
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.TransactionalRegionInterface
COMMIT_OK, COMMIT_OK_READ_ONLY, COMMIT_UNSUCESSFUL
 
Fields inherited from interface org.apache.hadoop.hbase.ipc.HBaseRPCProtocolVersion
versionID
 
Fields inherited from interface org.apache.hadoop.hbase.HConstants
ALL_VERSIONS, CATALOG_FAMILY, CATALOG_FAMILY_STR, CATALOG_HISTORIAN_FAMILY, CLUSTER_DISTRIBUTED, CLUSTER_IS_DISTRIBUTED, CLUSTER_IS_LOCAL, DEFAULT_HOST, DEFAULT_MASTER_INFOPORT, DEFAULT_MASTER_PORT, DEFAULT_MAX_FILE_SIZE, DEFAULT_REGION_SERVER_CLASS, DEFAULT_REGIONSERVER_INFOPORT, DEFAULT_REGIONSERVER_PORT, DEFAULT_SIZE_RESERVATION_BLOCK, DEFAULT_ZOOKEEPER_PAUSE, DEFAULT_ZOOKEEPER_RETRIES, 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, LATEST_TIMESTAMP_BYTES, MAJOR_COMPACTION_PERIOD, MASTER_PORT, MAX_ROW_LENGTH, MAXIMUM_VALUE_LENGTH, META_ROW_DELIMITER, META_TABLE_NAME, NAME, NINES, REGION_SERVER_CLASS, REGION_SERVER_IMPL, REGIONINFO_QUALIFIER, REGIONSERVER_PORT, RETRY_BACKOFF, ROOT_TABLE_NAME, SERVER_QUALIFIER, SPLITA_QUALIFIER, SPLITB_QUALIFIER, STARTCODE_QUALIFIER, THREAD_WAKE_FREQUENCY, UTF8_ENCODING, VERSION_FILE_NAME, VERSIONS, WEEK_IN_SECONDS, ZERO_L, ZEROES, ZOOKEEPER_CONFIG_NAME, ZOOKEEPER_PAUSE, ZOOKEEPER_QUORUM, ZOOKEEPER_RETRIES
 
Constructor Summary
TransactionalRegionServer(HBaseConfiguration conf)
           
 
Method Summary
 void abort(byte[] regionName, long transactionId)
          Abort the transaction.
 void beginTransaction(long transactionId, byte[] regionName)
          Sent to initiate a transaction.
protected  void closeRegion(HRegionInfo hri, boolean reportWhenCompleted)
          We want to delay the close region for a bit if we have commit pending transactions.
 void commit(byte[] regionName, long transactionId)
          Commit the transaction.
 boolean commitIfPossible(byte[] regionName, long transactionId)
          Try to commit the given transaction.
 int commitRequest(byte[] regionName, long transactionId)
          Ask if we can commit the given transaction.
 void delete(long transactionId, byte[] regionName, Delete delete)
          Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete.
 Result get(long transactionId, byte[] regionName, Get get)
          Perform a transactional Get operation.
 long getProtocolVersion(String protocol, long clientVersion)
           
protected  Leases getTransactionalLeases()
           
protected  TransactionalRegion getTransactionalRegion(byte[] regionName)
           
protected  void init(org.apache.hadoop.io.MapWritable c)
           
protected  HLog instantiateHLog(org.apache.hadoop.fs.Path logdir)
           
protected  HRegion instantiateRegion(HRegionInfo regionInfo)
           
 long openScanner(long transactionId, byte[] regionName, Scan scan)
          Opens a remote transactional scanner with a RowFilter.
 void put(long transactionId, byte[] regionName, Put put)
          Transactional put data into the specified region
 int put(long transactionId, byte[] regionName, Put[] puts)
          Put an array of puts into the specified region
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.HRegionServer
abort, addProcessingMessage, addRowLock, addScanner, checkAndPut, checkFileSystem, checkOOME, checkOpen, close, createRegionLoad, delete, delete, doMain, doMetrics, exists, get, getClosestRowBefore, getConfiguration, getCopyOfOnlineRegionsSortedBySize, getFileSystem, getFlushRequester, getGlobalMemStoreSize, getHServerInfo, getInfoServer, getLeases, getLogRoller, getMetrics, getMostLoadedRegions, getOnlineRegion, getOnlineRegions, getOnlineRegionsAsArray, getOutboundMsgs, getRegion, getRegionInfo, getRegionsAssignment, getRegionsToCheck, getRequestCount, getRootDir, getSortedOnlineRegionInfos, getZooKeeperWrapper, incrementColumnValue, isInSafeMode, isOnline, isStopRequested, lockRow, main, metrics, next, next, openScanner, process, put, put, 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
checkAndPut, close, delete, delete, exists, get, getClosestRowBefore, getHServerInfo, getOnlineRegionsAsArray, getRegionInfo, getRegionsAssignment, incrementColumnValue, lockRow, next, next, openScanner, put, put, unlockRow
 

Constructor Detail

TransactionalRegionServer

public TransactionalRegionServer(HBaseConfiguration conf)
                          throws IOException
Parameters:
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

instantiateHLog

protected HLog instantiateHLog(org.apache.hadoop.fs.Path logdir)
                        throws IOException
Overrides:
instantiateHLog 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

getTransactionalLeases

protected Leases getTransactionalLeases()

closeRegion

protected void closeRegion(HRegionInfo hri,
                           boolean reportWhenCompleted)
                    throws IOException
We want to delay the close region for a bit if we have commit pending transactions.

Overrides:
closeRegion in class HRegionServer
Throws:
IOException

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

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 int 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:
status of COMMIT_OK, COMMIT_READ_ONLY, or COMMIT_UNSUSESSFULL
Throws:
IOException

commitIfPossible

public boolean commitIfPossible(byte[] regionName,
                                long transactionId)
                         throws IOException
Description copied from interface: TransactionalRegionInterface
Try to commit the given transaction. This is used when there is only one participating region.

Specified by:
commitIfPossible in interface TransactionalRegionInterface
Returns:
true if committed
Throws:
IOException

openScanner

public long openScanner(long transactionId,
                        byte[] regionName,
                        Scan scan)
                 throws IOException
Description copied from interface: TransactionalRegionInterface
Opens a remote transactional scanner with a RowFilter.

Specified by:
openScanner in interface TransactionalRegionInterface
regionName - name of region to scan
scan - configured scan object
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

delete

public void delete(long transactionId,
                   byte[] regionName,
                   Delete delete)
            throws IOException
Description copied from interface: TransactionalRegionInterface
Deletes all the KeyValues that match those found in the Delete object, if their ts <= to the Delete. In case of a delete with a specific ts it only deletes that specific KeyValue.

Specified by:
delete in interface TransactionalRegionInterface
Throws:
IOException

get

public Result get(long transactionId,
                  byte[] regionName,
                  Get get)
           throws IOException
Description copied from interface: TransactionalRegionInterface
Perform a transactional Get operation.

Specified by:
get in interface TransactionalRegionInterface
regionName - name of region to get from
get - Get operation
Returns:
Result
Throws:
IOException

put

public void put(long transactionId,
                byte[] regionName,
                Put put)
         throws IOException
Description copied from interface: TransactionalRegionInterface
Transactional put data into the specified region

Specified by:
put in interface TransactionalRegionInterface
put - the data to be put
Throws:
IOException

put

public int put(long transactionId,
               byte[] regionName,
               Put[] puts)
        throws IOException
Description copied from interface: TransactionalRegionInterface
Put an array of puts into the specified region

Specified by:
put in interface TransactionalRegionInterface
Returns:
result
Throws:
IOException


Copyright © 2009 The Apache Software Foundation