HBASE-1879 ReadOnly transactions generate WAL activity.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@820888 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9719bcba95
commit
26cc7e9a23
|
@ -90,6 +90,7 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-1874 Client Scanner mechanism that is used for HbaseAdmin methods
|
||||
(listTables, tableExists), is very slow if the client is far
|
||||
away from the HBase cluster (Andrei Dragomir via Stack)
|
||||
HBASE-1879 ReadOnly transactions generate WAL activity (Clint Morgan via Stack)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
|
|
|
@ -58,11 +58,6 @@ class THLog extends HLog {
|
|||
return new THLogKey(regionName, tableName, seqNum, now);
|
||||
}
|
||||
|
||||
public void writeStartToLog(HRegionInfo regionInfo, final long transactionId) throws IOException {
|
||||
this.append(regionInfo, System.currentTimeMillis(),
|
||||
THLogKey.TrxOp.START, transactionId);
|
||||
}
|
||||
|
||||
public void writeUpdateToLog(HRegionInfo regionInfo, final long transactionId, final Put update)
|
||||
throws IOException {
|
||||
this.append(regionInfo, update, transactionId);
|
||||
|
|
|
@ -31,8 +31,6 @@ public class THLogKey extends HLogKey {
|
|||
*
|
||||
*/
|
||||
public enum TrxOp {
|
||||
/** Start a transaction. */
|
||||
START((byte)1),
|
||||
/** A standard operation that is transactional. KV holds the op. */
|
||||
OP((byte)2),
|
||||
/** A transaction was committed. */
|
||||
|
|
|
@ -140,23 +140,11 @@ class THLogRecoveryManager {
|
|||
List<KeyValue> updates = pendingTransactionsById.get(transactionId);
|
||||
switch (key.getTrxOp()) {
|
||||
|
||||
case START:
|
||||
if (updates != null || abortedTransactions.contains(transactionId)
|
||||
|| commitedTransactions.contains(transactionId)) {
|
||||
LOG.error("Processing start for transaction: " + transactionId
|
||||
+ ", but have already seen start message");
|
||||
throw new IOException("Corrupted transaction log");
|
||||
}
|
||||
updates = new ArrayList<KeyValue>();
|
||||
pendingTransactionsById.put(transactionId, updates);
|
||||
startCount++;
|
||||
break;
|
||||
|
||||
case OP:
|
||||
if (updates == null) {
|
||||
LOG.error("Processing edit for transaction: " + transactionId
|
||||
+ ", but have not seen start message");
|
||||
throw new IOException("Corrupted transaction log");
|
||||
updates = new ArrayList<KeyValue>();
|
||||
pendingTransactionsById.put(transactionId, updates);
|
||||
startCount++;
|
||||
}
|
||||
|
||||
updates.add(val);
|
||||
|
|
|
@ -227,7 +227,6 @@ public class TransactionalRegion extends HRegion {
|
|||
}
|
||||
LOG.debug("Begining transaction " + key + " in region "
|
||||
+ super.getRegionInfo().getRegionNameAsString());
|
||||
this.hlog.writeStartToLog(super.getRegionInfo(), transactionId);
|
||||
|
||||
maybeTriggerOldTransactionFlush();
|
||||
}
|
||||
|
@ -449,7 +448,9 @@ public class TransactionalRegion extends HRegion {
|
|||
|
||||
state.setStatus(Status.ABORTED);
|
||||
|
||||
this.hlog.writeAbortToLog(super.getRegionInfo(), state.getTransactionId());
|
||||
if (state.hasWrite()) {
|
||||
this.hlog.writeAbortToLog(super.getRegionInfo(), state.getTransactionId());
|
||||
}
|
||||
|
||||
// Following removes needed if we have voted
|
||||
if (state.getSequenceNumber() != null) {
|
||||
|
@ -475,9 +476,11 @@ public class TransactionalRegion extends HRegion {
|
|||
this.delete(delete, null, true);
|
||||
}
|
||||
|
||||
// Now the transaction lives in the WAL, we can writa a commit to the log
|
||||
// Now the transaction lives in the WAL, we can write a commit to the log
|
||||
// so we don't have to recover it.
|
||||
this.hlog.writeCommitToLog(super.getRegionInfo(), state.getTransactionId());
|
||||
if (state.hasWrite()) {
|
||||
this.hlog.writeCommitToLog(super.getRegionInfo(), state.getTransactionId());
|
||||
}
|
||||
|
||||
state.setStatus(Status.COMMITED);
|
||||
if (state.hasWrite()
|
||||
|
|
|
@ -86,8 +86,6 @@ public class TestTHLog extends HBaseTestCase implements
|
|||
// Write columns named 1, 2, 3, etc. and then values of single byte
|
||||
// 1, 2, 3...
|
||||
long transactionId = 1;
|
||||
log.writeStartToLog(regionInfo, transactionId);
|
||||
|
||||
log.writeUpdateToLog(regionInfo, transactionId, new Put(row1).add(family,
|
||||
column, val1));
|
||||
log.writeUpdateToLog(regionInfo, transactionId, new Put(row2).add(family,
|
||||
|
@ -119,8 +117,6 @@ public class TestTHLog extends HBaseTestCase implements
|
|||
regionInfo, conf);
|
||||
|
||||
long transactionId = 1;
|
||||
log.writeStartToLog(regionInfo, transactionId);
|
||||
|
||||
log.writeUpdateToLog(regionInfo, transactionId, new Put(row1).add(family,
|
||||
column, val1));
|
||||
log.writeUpdateToLog(regionInfo, transactionId, new Put(row2).add(family,
|
||||
|
@ -152,11 +148,9 @@ public class TestTHLog extends HBaseTestCase implements
|
|||
long transaction1Id = 1;
|
||||
long transaction2Id = 2;
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction1Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction1Id, new Put(row1).add(family,
|
||||
column, val1));
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction2Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction2Id, new Put(row2).add(family,
|
||||
column, val2));
|
||||
|
||||
|
@ -189,11 +183,9 @@ public class TestTHLog extends HBaseTestCase implements
|
|||
long transaction1Id = 1;
|
||||
long transaction2Id = 2;
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction1Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction1Id, new Put(row1).add(family,
|
||||
column, val1));
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction2Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction2Id, new Put(row2).add(family,
|
||||
column, val2));
|
||||
log.writeAbortToLog(regionInfo, transaction2Id);
|
||||
|
@ -226,11 +218,9 @@ public class TestTHLog extends HBaseTestCase implements
|
|||
long transaction1Id = 1;
|
||||
long transaction2Id = 2;
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction1Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction1Id, new Put(row1).add(family,
|
||||
column, val1));
|
||||
|
||||
log.writeStartToLog(regionInfo, transaction2Id);
|
||||
log.writeUpdateToLog(regionInfo, transaction2Id, new Put(row2).add(family,
|
||||
column, val2));
|
||||
log.writeCommitToLog(regionInfo, transaction2Id);
|
||||
|
|
Loading…
Reference in New Issue