提交 cc52d9fb authored 作者: Andrei Tokar's avatar Andrei Tokar

rename COMMITTING -> COMMITTED

上级 f9694244
......@@ -253,7 +253,7 @@ public class MVTableEngine implements TableEngine {
public void initTransactions() {
List<Transaction> list = transactionStore.getOpenTransactions();
for (Transaction t : list) {
if (t.getStatus() == Transaction.STATUS_COMMITTING) {
if (t.getStatus() == Transaction.STATUS_COMMITTED) {
t.commit();
} else if (t.getStatus() != Transaction.STATUS_PREPARED) {
t.rollback();
......
......@@ -46,7 +46,7 @@ public class Transaction {
* When opening a store, such transactions will automatically
* be processed and closed as committed.
*/
public static final int STATUS_COMMITTING = 3;
public static final int STATUS_COMMITTED = 3;
/**
* The status of a transaction that currently in a process of rolling back
......@@ -192,19 +192,19 @@ public class Transaction {
case STATUS_PREPARED:
valid = currentStatus == STATUS_OPEN;
break;
case STATUS_COMMITTING:
case STATUS_COMMITTED:
valid = currentStatus == STATUS_OPEN ||
currentStatus == STATUS_PREPARED ||
// this case is only possible if called
// from endLeftoverTransactions()
currentStatus == STATUS_COMMITTING;
currentStatus == STATUS_COMMITTED;
break;
case STATUS_ROLLED_BACK:
valid = currentStatus == STATUS_OPEN ||
currentStatus == STATUS_PREPARED;
break;
case STATUS_CLOSED:
valid = currentStatus == STATUS_COMMITTING ||
valid = currentStatus == STATUS_COMMITTED ||
currentStatus == STATUS_ROLLED_BACK;
break;
default:
......@@ -361,11 +361,11 @@ public class Transaction {
Throwable ex = null;
boolean hasChanges = false;
try {
long state = setStatus(STATUS_COMMITTING);
long state = setStatus(STATUS_COMMITTED);
hasChanges = hasChanges(state);
int previousStatus = getStatus(state);
if (hasChanges) {
store.commit(this, previousStatus == STATUS_COMMITTING);
store.commit(this, previousStatus == STATUS_COMMITTED);
}
} catch (Throwable e) {
ex = e;
......
......@@ -166,7 +166,7 @@ public class TransactionStore {
String name;
if (data == null) {
status = mapName.charAt(UNDO_LOG_NAME_PEFIX.length()) == UNDO_LOG_OPEN ?
Transaction.STATUS_OPEN : Transaction.STATUS_COMMITTING;
Transaction.STATUS_OPEN : Transaction.STATUS_COMMITTED;
name = null;
} else {
status = (Integer) data[0];
......@@ -337,7 +337,7 @@ public class TransactionStore {
transactions.set(transactionId, transaction);
if (undoLogs[transactionId] == null) {
String undoName = getUndoLogName(status == Transaction.STATUS_COMMITTING, transactionId);
String undoName = getUndoLogName(status == Transaction.STATUS_COMMITTED, transactionId);
MVMap<Long, Object[]> undoLog = store.openMap(undoName, undoLogBuilder);
undoLogs[transactionId] = undoLog;
}
......
......@@ -411,7 +411,7 @@ public class TestTransactionStore extends TestBase {
List<Transaction> list = ts.getOpenTransactions();
if (list.size() != 0) {
tx = list.get(0);
if (tx.getStatus() == Transaction.STATUS_COMMITTING) {
if (tx.getStatus() == Transaction.STATUS_COMMITTED) {
i++;
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论