Logo Search packages:      
Sourcecode: hbase version File versions  Download package

org::apache::hadoop::hbase::regionserver::transactional::TransactionalRegion Class Reference

Inheritance diagram for org::apache::hadoop::hbase::regionserver::transactional::TransactionalRegion:

org::apache::hadoop::hbase::regionserver::HRegion org::apache::hadoop::hbase::HConstants org::apache::hadoop::hbase::io::HeapSize

List of all members.


Detailed Description

Regionserver which provides transactional support for atomic transactions. This is achieved with optimistic concurrency control (see http://www.seas.upenn.edu/~zives/cis650/papers/opt-cc.pdf). We keep track read and write sets for each transaction, and hold off on processing the writes. To decide to commit a transaction we check its read sets with all transactions that have committed while it was running for overlaps.

Because transactions can span multiple regions, all regions must agree to commit a transactions. The client side of this commit protocol is encoded in org.apache.hadoop.hbase.client.transactional.TransactionManger

In the event of an failure of the client mid-commit, (after we voted yes), we will have to consult the transaction log to determine the final decision of the transaction. This is not yet implemented.

Definition at line 82 of file TransactionalRegion.java.


Public Types

enum  Modify {
  CLOSE_REGION, TABLE_COMPACT, TABLE_FLUSH, TABLE_MAJOR_COMPACT,
  TABLE_SET_HTD, TABLE_SPLIT
}

Public Member Functions

void abort (final long transactionId) throws IOException
void beginTransaction (final long transactionId) throws IOException
boolean checkAndPut (byte[] row, byte[] family, byte[] qualifier, byte[] expectedValue, Put put, Integer lockId, boolean writeToWAL) throws IOException
List< StoreFileclose (final boolean abort) throws IOException
List< StoreFileclose () throws IOException
List< StoreFileclose (boolean abort) throws IOException
void commit (final long transactionId) throws IOException
boolean commitIfPossible (final long transactionId) throws IOException
int commitRequest (final long transactionId) throws IOException
byte[] compactStores () throws IOException
void delete (Map< byte[], List< KeyValue >> familyMap, boolean writeToWAL) throws IOException
void delete (Delete delete, Integer lockid, boolean writeToWAL) throws IOException
void delete (final long transactionId, Delete delete) throws IOException
boolean equals (Object o)
boolean flushcache () throws IOException
Result get (final Get get, final Integer ignoredLockId) throws IOException
Result get (final long transactionId, Get get) throws IOException
Path getBaseDir ()
Result getClosestRowBefore (final byte[] row, final byte[] family) throws IOException
HBaseConfiguration getConf ()
byte[] getEndKey ()
FileSystem getFilesystem ()
long getLargestHStoreSize ()
long getLastFlushTime ()
HLog getLog ()
Path getRegionDir ()
long getRegionId ()
HRegionInfo getRegionInfo ()
byte[] getRegionName ()
String getRegionNameAsString ()
InternalScanner getScanner (Scan scan) throws IOException
InternalScanner getScanner (final long transactionId, Scan scan) throws IOException
byte[] getStartKey ()
Store getStore (final byte[] column)
HTableDescriptor getTableDesc ()
int hashCode ()
boolean hasTooManyStoreFiles ()
long heapSize ()
long incrementColumnValue (byte[] row, byte[] family, byte[] qualifier, long amount, boolean writeToWAL) throws IOException
void initialize (Path initialFiles, final Progressable reporter) throws IOException
boolean isClosed ()
boolean isClosing ()
Integer obtainRowLock (final byte[] row) throws IOException
void put (Put put, Integer lockid, boolean writeToWAL) throws IOException
void put (Put put, Integer lockid) throws IOException
void put (Put put, boolean writeToWAL) throws IOException
void put (Put put) throws IOException
void put (final long transactionId, final Put[] puts) throws IOException
void put (final long transactionId, final Put put) throws IOException
boolean shouldSplit (boolean b)
String toString ()
 TransactionalRegion (final Path basedir, final HLog log, final FileSystem fs, final HBaseConfiguration conf, final HRegionInfo regionInfo, final FlushRequester flushListener, final Leases transactionalLeases)

Static Public Member Functions

static void addRegionToMETA (HRegion meta, HRegion r) throws IOException
static void cleanRegionInMETA (final HRegionInterface srvr, final byte[] metaRegionName, final HRegionInfo info) throws IOException
static HRegion createHRegion (final HRegionInfo info, final Path rootDir, final HBaseConfiguration conf) throws IOException
static void deleteRegion (FileSystem fs, Path rootdir, HRegionInfo info) throws IOException
static Path getRegionDir (final Path rootdir, final HRegionInfo info)
static Path getRegionDir (final Path tabledir, final int name)
static void main (String[] args) throws IOException
static void makeColumnFamilyDirs (FileSystem fs, Path tabledir, final HRegionInfo hri, byte[] colFamily) throws IOException
static HRegion merge (HRegion a, HRegion b) throws IOException
static HRegion mergeAdjacent (final HRegion srcA, final HRegion srcB) throws IOException
static HRegion newHRegion (Path basedir, HLog log, FileSystem fs, HBaseConfiguration conf, HRegionInfo regionInfo, FlushRequester flushListener)
static void offlineRegionInMETA (final HRegionInterface srvr, final byte[] metaRegionName, final HRegionInfo info) throws IOException
static HRegion openHRegion (final HRegionInfo info, final Path rootDir, final HLog log, final HBaseConfiguration conf) throws IOException
static void removeRegionFromMETA (final HRegionInterface srvr, final byte[] metaRegionName, final byte[] regionName) throws IOException
static boolean rowIsInRange (HRegionInfo info, final byte[] row)

Static Public Attributes

static final int ALL_VERSIONS = Integer.MAX_VALUE
static final byte[] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR)
static final String CATALOG_FAMILY_STR = "info"
static final byte[] CATALOG_HISTORIAN_FAMILY = Bytes.toBytes("historian")
static final String CLUSTER_DISTRIBUTED = "hbase.cluster.distributed"
static final String CLUSTER_IS_DISTRIBUTED = "true"
static final String CLUSTER_IS_LOCAL = "false"
static final long DEEP_OVERHEAD
static long DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE = Long.MAX_VALUE
static final String DEFAULT_HOST = "0.0.0.0"
static final int DEFAULT_MASTER_INFOPORT = 60010
static final int DEFAULT_MASTER_PORT = 60000
static final long DEFAULT_MAX_FILE_SIZE = 256 * 1024 * 1024
static final String DEFAULT_REGION_SERVER_CLASS = HRegionInterface.class.getName()
static final int DEFAULT_REGIONSERVER_INFOPORT = 60030
static final int DEFAULT_REGIONSERVER_PORT = 60020
static final int DEFAULT_SIZE_RESERVATION_BLOCK = 1024 * 1024 * 5
static final int DEFAULT_ZOOKEEPER_PAUSE = 2 * 1000
static final int DEFAULT_ZOOKEEPER_RETRIES = 5
static final byte[] EMPTY_BYTE_ARRAY = new byte [0]
static final byte[] EMPTY_END_ROW = EMPTY_START_ROW
static final byte[] EMPTY_START_ROW = EMPTY_BYTE_ARRAY
static final String FILE_SYSTEM_VERSION = "7"
static final long FIXED_OVERHEAD
static final int FOREVER = Integer.MAX_VALUE
static final String HBASE_CLIENT_RETRIES_NUMBER_KEY
static String HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY = "hbase.client.scanner.max.result.size"
static final String HBASE_DIR = "hbase.rootdir"
static final String HREGION_COMPACTIONDIR_NAME = "compaction.dir"
static final String HREGION_LOGDIR_NAME = ".logs"
static final String HREGION_OLDLOGFILE_NAME = "oldlogfile.log"
static final String IN_MEMORY = "IN_MEMORY"
static final byte[] LAST_ROW = EMPTY_BYTE_ARRAY
static final long LATEST_TIMESTAMP = Long.MAX_VALUE
static final byte[] LATEST_TIMESTAMP_BYTES = Bytes.toBytes(LATEST_TIMESTAMP)
static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction"
static final String MASTER_PORT = "hbase.master.port"
static final int MAX_ROW_LENGTH = Short.MAX_VALUE
static final int MAXIMUM_VALUE_LENGTH = Integer.MAX_VALUE
static final int META_ROW_DELIMITER = ','
static final byte[] META_TABLE_NAME = Bytes.toBytes(".META.")
static final String NAME = "NAME"
static final String NINES = "99999999999999"
static final String REGION_IMPL = "hbase.hregion.impl"
static final String REGION_SERVER_CLASS = "hbase.regionserver.class"
static final String REGION_SERVER_IMPL = "hbase.regionserver.impl"
static final String REGIONINFO_FILE = ".regioninfo"
static final byte[] REGIONINFO_FILE_BYTES
static final byte[] REGIONINFO_QUALIFIER = Bytes.toBytes("regioninfo")
static final String REGIONSERVER_PORT = "hbase.regionserver.port"
static int RETRY_BACKOFF [] = { 1, 1, 1, 2, 2, 4, 4, 8, 16, 32 }
static final byte[] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-")
static final byte[] SERVER_QUALIFIER = Bytes.toBytes("server")
static final byte[] SPLITA_QUALIFIER = Bytes.toBytes("splitA")
static final byte[] SPLITB_QUALIFIER = Bytes.toBytes("splitB")
static final byte[] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode")
static final String THREAD_WAKE_FREQUENCY = "hbase.server.thread.wakefrequency"
static final String UTF8_ENCODING = "UTF-8"
static final String VERSION_FILE_NAME = "hbase.version"
static final String VERSIONS = "VERSIONS"
static final int WEEK_IN_SECONDS = 7 * 24 * 3600
static final String ZEROES = "00000000000000"
static final String ZOOKEEPER_CONFIG_NAME = "zoo.cfg"
static final String ZOOKEEPER_PAUSE = "zookeeper.pause"
static final String ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum"
static final String ZOOKEEPER_RETRIES = "zookeeper.retries"

Protected Member Functions

void checkReadOnly () throws IOException
void doReconstructionLog (Path oldLogFile, long minSeqId, long maxSeqId, Progressable reporter) throws UnsupportedEncodingException, IOException
void doReconstructionLog (final Path oldLogFile, final long minSeqId, final long maxSeqId, final Progressable reporter) throws UnsupportedEncodingException, IOException
long getCompleteCacheFlushSequenceId (long currentSequenceId)
long getCompleteCacheFlushSequenceId (final long currentSequenceId)
InternalScanner getScanner (Scan scan, List< KeyValueScanner > additionalScanners) throws IOException
TransactionState getTransactionState (final long transactionId) throws UnknownTransactionException
Store instantiateHStore (Path baseDir, HColumnDescriptor c, Path oldLogFile, Progressable reporter) throws IOException
InternalScanner instantiateInternalScanner (Scan scan, List< KeyValueScanner > additionalScanners) throws IOException
boolean internalFlushcache () throws IOException
Callable< Void > internalPreFlushcacheCommit () throws IOException
void prepareToSplit ()

Protected Attributes

final ReadWriteConsistencyControl rwcc
final Map< byte[], Storestores
Map< String, TransactionStatetransactionsById = new HashMap<String, TransactionState>()

Package Functions

byte[] compactStores (final boolean majorCompaction) throws IOException
void delete (byte[] family, List< KeyValue > edits, boolean writeToWAL) throws IOException
Result getClosestRowBefore (final byte[] row) throws IOException
boolean getForceMajorCompaction ()
long getMinSequenceId ()
byte[] getRowFromLock (final Integer lockid)
ReadWriteConsistencyControl getRWCC ()
boolean hasReferences ()
boolean isMajorCompaction () throws IOException
void prepareToClose ()
void releaseRowLock (final Integer lockid)
synchronized void removeUnNeededCommitedTransactions ()
void setForceMajorCompaction (final boolean b)
HRegion[] splitRegion (final byte[] splitRow) throws IOException

Static Package Functions

static Path getCompactionDir (final Path dir)

Package Attributes

final Path basedir
final AtomicBoolean closed = new AtomicBoolean(false)
boolean closing = false
KeyValue.KVComparator comparator
final HBaseConfiguration conf
final FlushRequester flushListener
final FileSystem fs
final HLog log
final long memstoreFlushSize
final AtomicLong memstoreSize = new AtomicLong(0)
final Path regiondir
final HRegionInfo regionInfo
final long threadWakeFrequency

Static Package Attributes

static final Log LOG = LogFactory.getLog(TransactionalRegion.class)
static final String MERGEDIR = "merges"
static final String SPLITDIR = "splits"
static final Long ZERO_L = Long.valueOf(0L)

Private Member Functions

void checkClosing () throws IOException
void commit (final TransactionState state) throws IOException
String getLeaseId (long transactionId)
Integer getMinStartSequenceNumber ()
boolean hasConflict (final TransactionState state)
void maybeTriggerOldTransactionFlush ()
void resolveTransactionFromLog (final TransactionState transactionState) throws IOException
void retireTransaction (final TransactionState state)

Private Attributes

Object commitCheckLock = new Object()
SortedMap< Integer,
TransactionState
commitedTransactionsBySequenceNumber
Set< TransactionStatecommitPendingTransactions
THLog hlog
AtomicInteger nextSequenceId = new AtomicInteger(0)
final int oldTransactionFlushTrigger
final Leases transactionLeases

Static Private Attributes

static final int CLOSE_WAIT_ON_COMMIT_PENDING = 1000
static final int DEFAULT_OLD_TRANSACTION_FLUSH = 100
static final int MAX_COMMIT_PENDING_WAITS = 10
static final String OLD_TRANSACTION_FLUSH = "hbase.transaction.flush"

Classes

class  TransactionLeaseListener

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index