|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.regionserver.HRegion
org.apache.hadoop.hbase.regionserver.transactional.TransactionalRegion
public class TransactionalRegion
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.
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hbase.regionserver.HRegion |
---|
stores |
Constructor Summary | |
---|---|
TransactionalRegion(org.apache.hadoop.fs.Path basedir,
HLog log,
org.apache.hadoop.fs.FileSystem fs,
HBaseConfiguration conf,
HRegionInfo regionInfo,
FlushRequester flushListener)
|
Method Summary | |
---|---|
void |
abort(long transactionId)
Commit the transaction. |
void |
batchUpdate(long transactionId,
BatchUpdate b)
Add a write to the transaction. |
void |
beginTransaction(long transactionId)
|
void |
commit(long transactionId)
Commit the transaction. |
boolean |
commitRequest(long transactionId)
|
void |
deleteAll(long transactionId,
byte[] row,
long timestamp)
Add a delete to the transaction. |
protected void |
doReconstructionLog(org.apache.hadoop.fs.Path oldLogFile,
long minSeqId,
long maxSeqId,
org.apache.hadoop.util.Progressable reporter)
|
Cell |
get(long transactionId,
byte[] row,
byte[] column)
Fetch a single data item. |
Cell[] |
get(long transactionId,
byte[] row,
byte[] column,
int numVersions)
Fetch multiple versions of a single data item |
Cell[] |
get(long transactionId,
byte[] row,
byte[] column,
long timestamp,
int numVersions)
Fetch multiple versions of a single data item, with timestamp. |
protected long |
getCompleteCacheFlushSequenceId(long currentSequenceId)
We need to make sure that we don't complete a cache flush between running transactions. |
Map<byte[],Cell> |
getFull(long transactionId,
byte[] row,
Set<byte[]> columns,
long ts)
Fetch all the columns for the indicated row at a specified timestamp. |
InternalScanner |
getScanner(long transactionId,
byte[][] cols,
byte[] firstRow,
long timestamp,
RowFilterInterface filter)
Return an iterator that scans over the HRegion, returning the indicated columns for only the rows that match the data filter. |
Methods inherited from class org.apache.hadoop.hbase.regionserver.HRegion |
---|
addRegionToMETA, batchUpdate, batchUpdate, batchUpdate, batchUpdate, checkAndSave, checkReadOnly, cleanRegionInMETA, close, compactStores, createHRegion, deleteAll, deleteAll, deleteAllByRegex, deleteFamily, deleteFamilyByRegex, deleteRegion, equals, exists, flushcache, get, getBaseDir, getClosestRowBefore, getConf, getEndKey, getFilesystem, getFull, getLargestHStoreSize, getLastFlushTime, getLog, getRegionDir, getRegionDir, getRegionDir, getRegionId, getRegionInfo, getRegionName, getScanner, getStartKey, getStore, getTableDesc, hashCode, incrementColumnValue, initialize, instantiateHStore, isClosed, isClosing, makeColumnFamilyDirs, merge, mergeAdjacent, offlineRegionInMETA, openHRegion, removeRegionFromMETA, rowIsInRange, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TransactionalRegion(org.apache.hadoop.fs.Path basedir, HLog log, org.apache.hadoop.fs.FileSystem fs, HBaseConfiguration conf, HRegionInfo regionInfo, FlushRequester flushListener)
basedir
- log
- fs
- conf
- regionInfo
- flushListener
- Method Detail |
---|
protected void doReconstructionLog(org.apache.hadoop.fs.Path oldLogFile, long minSeqId, long maxSeqId, org.apache.hadoop.util.Progressable reporter) throws UnsupportedEncodingException, IOException
doReconstructionLog
in class HRegion
UnsupportedEncodingException
IOException
protected long getCompleteCacheFlushSequenceId(long currentSequenceId)
getCompleteCacheFlushSequenceId
in class HRegion
public void beginTransaction(long transactionId) throws IOException
transactionId
-
IOException
public Cell get(long transactionId, byte[] row, byte[] column) throws IOException
transactionId
- row
- column
-
IOException
public Cell[] get(long transactionId, byte[] row, byte[] column, int numVersions) throws IOException
transactionId
- row
- column
- numVersions
-
IOException
public Cell[] get(long transactionId, byte[] row, byte[] column, long timestamp, int numVersions) throws IOException
transactionId
- row
- column
- timestamp
- numVersions
-
IOException
public Map<byte[],Cell> getFull(long transactionId, byte[] row, Set<byte[]> columns, long ts) throws IOException
transactionId
- row
- columns
- Array of columns you'd like to retrieve. When null, get all.ts
-
IOException
public InternalScanner getScanner(long transactionId, byte[][] cols, byte[] firstRow, long timestamp, RowFilterInterface filter) throws IOException
transactionId
- 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 in the column qualifier. A column qualifier is judged to be a regex
if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.firstRow
- row which is the starting point of the scantimestamp
- only return rows whose timestamp is <= this valuefilter
- row filter
IOException
public void batchUpdate(long transactionId, BatchUpdate b) throws IOException
transactionId
- b
-
IOException
public void deleteAll(long transactionId, byte[] row, long timestamp) throws IOException
transactionId
- row
- timestamp
-
IOException
public boolean commitRequest(long transactionId) throws IOException
transactionId
-
IOException
public void commit(long transactionId) throws IOException
transactionId
-
IOException
public void abort(long transactionId) throws IOException
transactionId
-
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |