/** * @param cctx Cache context. * @param tx Transaction. * @param timeout Timeout. * @param rdc Compound future reducer. */ public GridNearTxAbstractEnlistFuture( GridCacheContext<?, ?> cctx, GridNearTxLocal tx, long timeout, @Nullable IgniteReducer<T, T> rdc) { super(rdc); assert cctx != null; assert tx != null; this.cctx = cctx; this.tx = tx; this.timeout = timeout; threadId = tx.threadId(); lockVer = tx.xidVersion(); futId = IgniteUuid.randomUuid(); mvccSnapshot = tx.mvccSnapshot(); assert mvccSnapshot != null; log = cctx.logger(getClass()); }
/** * @param cctx Cache context. * @param tx Transaction. * @throws IgniteCheckedException If failed. * @return Mvcc snapshot. */ public static MvccSnapshot requestSnapshot(GridCacheContext cctx, GridNearTxLocal tx) throws IgniteCheckedException { assert tx != null; MvccSnapshot snapshot; tx = checkActive(tx); if ((snapshot = tx.mvccSnapshot()) == null) { MvccProcessor prc = cctx.shared().coordinators(); snapshot = prc.requestWriteSnapshotLocal(); if (snapshot == null) snapshot = prc.requestWriteSnapshotAsync().get(); tx.mvccSnapshot(snapshot); } return snapshot; }
/** */ private void onFinishFutureDone(IgniteInternalFuture<IgniteInternalTx> fut) { GridNearTxLocal tx = tx(); Throwable err = fut.error(); if (tx.state() == TransactionState.COMMITTED) tx.context().coordinators().ackTxCommit(tx.mvccSnapshot()) .listen(fut0 -> onDone(tx, addSuppressed(err, fut0.error()))); else { tx.context().coordinators().ackTxRollback(tx.mvccSnapshot()); onDone(tx, err); } }
assert tx0.mvccSnapshot() != null; tx0.mvccSnapshot(), tx0.threadId(), IgniteUuid.randomUuid(),
.schemaName(schemaName); if (curTx != null && curTx.mvccSnapshot() != null) req.mvccSnapshot(curTx.mvccSnapshot()); else if (mvccTracker != null) req.mvccSnapshot(mvccTracker.snapshot());
tx.subjectId(), tx.taskNameHash(), tx.mvccSnapshot(), tx.activeCachesDeploymentEnabled() );
/** {@inheritDoc} */ @Override public void onResponse(MvccSnapshot res) { tx.mvccSnapshot(res); onDone(); }
/** {@inheritDoc} */ @Override public void onResponse(MvccSnapshot res) { tx.mvccSnapshot(res); onDone(); }
/** * @param cctx Cache context. * @param tx Transaction. * @param timeout Timeout. * @param rdc Compound future reducer. */ public GridNearTxAbstractEnlistFuture( GridCacheContext<?, ?> cctx, GridNearTxLocal tx, long timeout, @Nullable IgniteReducer<T, T> rdc) { super(rdc); assert cctx != null; assert tx != null; this.cctx = cctx; this.tx = tx; this.timeout = timeout; threadId = tx.threadId(); lockVer = tx.xidVersion(); futId = IgniteUuid.randomUuid(); mvccSnapshot = tx.mvccSnapshot(); assert mvccSnapshot != null; log = cctx.logger(getClass()); }
/** * @param cctx Cache context. * @param tx Transaction. * @throws IgniteCheckedException If failed. * @return Mvcc snapshot. */ public static MvccSnapshot requestSnapshot(GridCacheContext cctx, GridNearTxLocal tx) throws IgniteCheckedException { MvccSnapshot snapshot; tx = checkActive(tx); if ((snapshot = tx.mvccSnapshot()) == null) { MvccProcessor prc = cctx.shared().coordinators(); snapshot = prc.tryRequestSnapshotLocal(tx); if (snapshot == null) // TODO IGNITE-7388 snapshot = prc.requestSnapshotAsync(tx).get(); tx.mvccSnapshot(snapshot); } return snapshot; }
/** {@inheritDoc} */ @Override public void applyx(IgniteInternalFuture<IgniteInternalTx> fut) throws IgniteCheckedException { assert fut.isDone(); MvccQueryTracker tracker = tx.mvccQueryTracker(); MvccSnapshot mvccSnapshot = tx.mvccSnapshot(); if (tracker != null) // Optimistic tx. tracker.onDone(tx, false); else if (mvccSnapshot != null)// Pessimistic tx. tx.context().coordinators().ackTxRollback(mvccSnapshot); } }
/** * @param res Response. * @param updateMapping Update mapping flag. */ void onResult(GridNearTxPrepareResponse res, boolean updateMapping) { if (res.error() != null) onError(res.error()); else { if (res.mvccSnapshot() != null) tx.mvccSnapshot(res.mvccSnapshot()); onPrepareResponse(m, res, updateMapping); onDone(res); } }
/** {@inheritDoc} */ @Override public IgniteInternalFuture<Void> onDone(@NotNull GridNearTxLocal tx, boolean commit) { MvccSnapshot snapshot = snapshot(), txSnapshot = tx.mvccSnapshot(); if (!checkDone() || snapshot == null && txSnapshot == null) return commit ? new GridFinishedFuture<>() : null; MvccProcessor prc = cctx.shared().coordinators(); if (snapshot != null) prc.removeQueryTracker(id); if (txSnapshot == null) prc.ackQueryDone(snapshot, id); else if (commit) return prc.ackTxCommit(txSnapshot, snapshot, id); else prc.ackTxRollback(txSnapshot, snapshot, id); return null; }
MvccSnapshot mvccSnapshot = tx.mvccSnapshot();
nodes = cacheCtx.affinity().nodesByKey(txEntry.key(), topVer); if (tx.mvccSnapshot() == null && mvccCrd == null && cacheCtx.mvccEnabled()) { mvccCrd = cacheCtx.affinity().mvccCoordinator(topVer); assert !tx.txState().mvccEnabled() || tx.mvccSnapshot() != null || mvccCrd != null;
.schemaName(schemaName); if (curTx != null && curTx.mvccSnapshot() != null) req.mvccSnapshot(curTx.mvccSnapshot()); else if (mvccTracker != null) req.mvccSnapshot(mvccTracker.snapshot());
MvccSnapshot snapshot = tx.mvccSnapshot();
tx.subjectId(), tx.taskNameHash(), tx.mvccSnapshot(), tx.activeCachesDeploymentEnabled() );