/** */ private void neighborcastPartitionCountersAndRollback(IgniteInternalTx tx) { TxCounters txCounters = tx.txCounters(false); if (txCounters == null || txCounters.updateCounters() == null) tx.rollbackAsync(); PartitionCountersNeighborcastFuture fut = new PartitionCountersNeighborcastFuture(tx, cctx); fut.listen(fut0 -> tx.rollbackAsync()); fut.init(); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> apply(IgniteInternalTx tx, IgniteTxManager tm) { IgniteTxRemoteEx remote = (IgniteTxRemoteEx)tx; if (tx.isRollbackOnly() || tx.state() == COMMITTING || tx.state() == COMMITTED) return new GridFinishedFuture<>(); if (tx.state() == TransactionState.PREPARED) remote.doneRemote(tx.xidVersion(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); return tx.rollbackAsync(); } }
/** {@inheritDoc} */ @Override public void apply(IgniteInternalFuture<IgniteInternalTx> t) { try { t.get(); } catch (IgniteTxOptimisticCheckedException ignore) { if (log.isDebugEnabled()) log.debug("Optimistic failure while committing prepared transaction (will rollback): " + tx); try { tx.rollbackAsync(); } catch (Throwable e) { U.error(log, "Failed to automatically rollback transaction: " + tx, e); } } catch (IgniteCheckedException e) { U.error(log, "Failed to commit transaction during failover: " + tx, e); } } }
/** * Commits or rolls back prepared transaction. * * @param tx Transaction. * @param commit Whether transaction should be committed or rolled back. */ public void finishTxOnRecovery(final IgniteInternalTx tx, boolean commit) { if (log.isInfoEnabled()) log.info("Finishing prepared transaction [commit=" + commit + ", tx=" + tx + ']'); if (!tx.markFinalizing(RECOVERY_FINISH)) { if (log.isInfoEnabled()) log.info("Will not try to commit prepared transaction (could not mark finalized): " + tx); return; } if (tx instanceof IgniteTxRemoteEx) { IgniteTxRemoteEx rmtTx = (IgniteTxRemoteEx)tx; rmtTx.doneRemote(tx.xidVersion(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); } if (commit) tx.commitAsync().listen(new CommitListener(tx)); else if (tx.mvccSnapshot() != null && !tx.local()) // remote (backup) mvcc transaction sends partition counters to other backup transaction // in order to keep counters consistent neighborcastPartitionCountersAndRollback(tx); else tx.rollbackAsync(); }
tx.rollbackAsync(); }); tx.rollbackAsync();
/** */ private void neighborcastPartitionCountersAndRollback(IgniteInternalTx tx) { TxCounters txCounters = tx.txCounters(false); if (txCounters == null || txCounters.updateCounters() == null) tx.rollbackAsync(); PartitionCountersNeighborcastFuture fut = new PartitionCountersNeighborcastFuture(tx, cctx); fut.listen(fut0 -> tx.rollbackAsync()); fut.init(); }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<IgniteInternalTx> apply(IgniteInternalTx tx, IgniteTxManager tm) { IgniteTxRemoteEx remote = (IgniteTxRemoteEx)tx; if (tx.isRollbackOnly() || tx.state() == COMMITTING || tx.state() == COMMITTED) return new GridFinishedFuture<>(); if (tx.state() == TransactionState.PREPARED) remote.doneRemote(tx.xidVersion(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); return tx.rollbackAsync(); } }
/** {@inheritDoc} */ @Override public void apply(IgniteInternalFuture<IgniteInternalTx> t) { try { t.get(); } catch (IgniteTxOptimisticCheckedException ignore) { if (log.isDebugEnabled()) log.debug("Optimistic failure while committing prepared transaction (will rollback): " + tx); try { tx.rollbackAsync(); } catch (Throwable e) { U.error(log, "Failed to automatically rollback transaction: " + tx, e); } } catch (IgniteCheckedException e) { U.error(log, "Failed to commit transaction during failover: " + tx, e); } } }
/** * Commits or rolls back prepared transaction. * * @param tx Transaction. * @param commit Whether transaction should be committed or rolled back. */ public void finishTxOnRecovery(final IgniteInternalTx tx, boolean commit) { if (log.isInfoEnabled()) log.info("Finishing prepared transaction [commit=" + commit + ", tx=" + tx + ']'); if (!tx.markFinalizing(RECOVERY_FINISH)) { if (log.isInfoEnabled()) log.info("Will not try to commit prepared transaction (could not mark finalized): " + tx); return; } if (tx instanceof IgniteTxRemoteEx) { IgniteTxRemoteEx rmtTx = (IgniteTxRemoteEx)tx; rmtTx.doneRemote(tx.xidVersion(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); } if (commit) tx.commitAsync().listen(new CommitListener(tx)); else if (tx.mvccSnapshot() != null && !tx.local()) // remote (backup) mvcc transaction sends partition counters to other backup transaction // in order to keep counters consistent neighborcastPartitionCountersAndRollback(tx); else tx.rollbackAsync(); }
tx.rollbackAsync(); }); tx.rollbackAsync();