/** * Checks if mapped transaction can be committed on one phase. * One-phase commit can be done if transaction maps to one primary node and not more than one backup. * * @param txMapping Transaction mapping. */ final void checkOnePhase(GridDhtTxMapping txMapping) { checkOnePhase(tx.transactionNodes()); }
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) { if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']'); GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc() .<IgniteInternalTx>versionedFuture(res.version(), res.futureId()); if (fut == null) { U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); return; } IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable IgniteInternalTx res, @Nullable Throwable err) { if (err != null) ERR_UPD.compareAndSet(GridNearPessimisticTxPrepareFuture.this, null, err); err = this.err; if ((!tx.onePhaseCommit() || tx.mappings().get(cctx.localNodeId()) == null) && (err == null || tx.needCheckBackup())) tx.state(PREPARED); if (super.onDone(tx, err)) { cctx.mvcc().removeVersionedFuture(this); return true; } return false; }
/** {@inheritDoc} */ @Override public String toString() { Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() { @Override public String apply(IgniteInternalFuture<?> f) { if (f instanceof MiniFuture) { return "[node=" + ((MiniFuture)f).primary().id() + ", loc=" + ((MiniFuture)f).primary().isLocal() + ", done=" + f.isDone() + "]"; } else return f.toString(); } }); return S.toString(GridNearPessimisticTxPrepareFuture.class, this, "innerFuts", futs, "txId", tx.nearXidVersion(), "super", super.toString()); }
((GridNearTxPrepareFutureAdapter)prepFut).onNearTxLocalTimeout();
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable IgniteInternalTx res, @Nullable Throwable err) { if (err != null) ERR_UPD.compareAndSet(GridNearPessimisticTxPrepareFuture.this, null, err); err = this.err; if (err == null || tx.needCheckBackup()) tx.state(PREPARED); if (super.onDone(tx, err)) { cctx.mvcc().removeVersionedFuture(this); return true; } return false; }
/** {@inheritDoc} */ @Override public String toString() { Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() { @Override public String apply(IgniteInternalFuture<?> f) { if (f instanceof MiniFuture) { return "[node=" + ((MiniFuture)f).primary().id() + ", loc=" + ((MiniFuture)f).primary().isLocal() + ", done=" + f.isDone() + "]"; } else return f.toString(); } }); return S.toString(GridNearPessimisticTxPrepareFuture.class, this, "innerFuts", futs, "txId", tx.nearXidVersion(), "super", super.toString()); }
((GridNearTxPrepareFutureAdapter)prepFut).onNearTxLocalTimeout();
/** * @param nodeId Node ID. * @param res Response. */ private void processNearTxPrepareResponse(UUID nodeId, GridNearTxPrepareResponse res) { if (txPrepareMsgLog.isDebugEnabled()) txPrepareMsgLog.debug("Received near prepare response [txId=" + res.version() + ", node=" + nodeId + ']'); GridNearTxPrepareFutureAdapter fut = (GridNearTxPrepareFutureAdapter)ctx.mvcc() .<IgniteInternalTx>versionedFuture(res.version(), res.futureId()); if (fut == null) { U.warn(log, "Failed to find future for near prepare response [txId=" + res.version() + ", node=" + nodeId + ", res=" + res + ']'); return; } IgniteInternalTx tx = fut.tx(); assert tx != null; res.txState(tx.txState()); fut.onResult(nodeId, res); }
/** * Checks if mapped transaction can be committed on one phase. * One-phase commit can be done if transaction maps to one primary node and not more than one backup. * * @param txMapping Transaction mapping. */ final void checkOnePhase(GridDhtTxMapping txMapping) { checkOnePhase(tx.transactionNodes()); }