private boolean skipBackupLogReplication() { //todo: what if backupLogsCreated are created? return durability == 0 || transactionLog.size() <= 1 || backupAddresses.length == 0; }
private boolean skipBackupLogReplication() { //todo: what if backupLogsCreated are created? return durability == 0 || transactionLog.size() <= 1 || backupAddresses.length == 0; }
/** * Checks if this Transaction needs to be prepared. * <p> * Preparing a transaction costs time since the backup log potentially needs to be copied and * each logrecord needs to prepare its content (e.g. by acquiring locks). This takes time. * <p> * If a transaction is local or if there is 1 or 0 items in the transaction log, instead of * preparing, we are just going to try to commit. If the lock is still acquired, the write * succeeds, and if the lock isn't acquired, the write fails; this is the same effect as a * prepare would have. * * @return true if {@link #prepare()} is required. */ public boolean requiresPrepare() { if (transactionType == ONE_PHASE) { return false; } return transactionLog.size() > 1; }
/** * Checks if this Transaction needs to be prepared. * <p> * Preparing a transaction costs time since the backup log potentially needs to be copied and * each logrecord needs to prepare its content (e.g. by acquiring locks). This takes time. * <p> * If a transaction is local or if there is 1 or 0 items in the transaction log, instead of * preparing, we are just going to try to commit. If the lock is still acquired, the write * succeeds, and if the lock isn't acquired, the write fails; this is the same effect as a * prepare would have. * * @return true if {@link #prepare()} is required. */ public boolean requiresPrepare() { if (transactionType == ONE_PHASE) { return false; } return transactionLog.size() > 1; }
public List<Future> rollback(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); ListIterator<TransactionLogRecord> iterator = recordList.listIterator(size()); while (iterator.hasPrevious()) { TransactionLogRecord record = iterator.previous(); Future future = invoke(nodeEngine, record, record.newRollbackOperation()); futures.add(future); } return futures; }
public List<Future> rollback(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); ListIterator<TransactionLogRecord> iterator = recordList.listIterator(size()); while (iterator.hasPrevious()) { TransactionLogRecord record = iterator.previous(); Future future = invoke(nodeEngine, record, record.newRollbackOperation()); futures.add(future); } return futures; }
public List<Future> prepare(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); for (TransactionLogRecord record : recordList) { Future future = invoke(nodeEngine, record, record.newPrepareOperation()); futures.add(future); } return futures; }
public List<Future> prepare(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); for (TransactionLogRecord record : recordList) { Future future = invoke(nodeEngine, record, record.newPrepareOperation()); futures.add(future); } return futures; }
public List<Future> commit(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); for (TransactionLogRecord record : recordList) { Future future = invoke(nodeEngine, record, record.newCommitOperation()); futures.add(future); } return futures; }
public List<Future> commit(NodeEngine nodeEngine) { List<Future> futures = new ArrayList<Future>(size()); for (TransactionLogRecord record : recordList) { Future future = invoke(nodeEngine, record, record.newCommitOperation()); futures.add(future); } return futures; }
try { if (transactionType == TWO_PHASE) { if (transactionLog.size() > 1) { if (state != PREPARED) { throw new IllegalStateException("Transaction is not prepared");
try { if (transactionType == TWO_PHASE) { if (transactionLog.size() > 1) { if (state != PREPARED) { throw new IllegalStateException("Transaction is not prepared");