提交 8e29ff1f authored 作者: andrei's avatar andrei

Atomic change of transaction state

上级 313e60db
......@@ -277,7 +277,7 @@ public class TransactionMap<K, V> {
}
}
VersionedValue newValue = new VersionedValue(
TransactionStore.getOperationId(transaction.transactionId, transaction.logId),
TransactionStore.getOperationId(transaction.transactionId, transaction.getLogId()),
value);
if (current == null) {
// a new value
......
......@@ -345,16 +345,15 @@ public class TransactionStore {
*
* @param t the transaction
* @param maxLogId the last log id
* @param oldStatus last status
*/
void commit(Transaction t, long maxLogId) {
void commit(Transaction t, long maxLogId, int oldStatus) {
if (store.isClosed()) {
return;
}
// TODO could synchronize on blocks (100 at a time or so)
rwLock.writeLock().lock();
int oldStatus = t.getStatus();
try {
t.setStatus(Transaction.STATUS_COMMITTING);
for (long logId = 0; logId < maxLogId; logId++) {
Long undoKey = getOperationId(t.getId(), logId);
Object[] op = undoLog.get(undoKey);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论