/** {@inheritDoc} */ @Override public GridCacheVersion version() { return tx.xidVersion(); }
/** * @param mapping Mapping to finish. */ private void readyNearMappingFromBackup(GridDistributedTxMapping mapping) { if (mapping.hasNearCacheEntries()) { GridCacheVersion xidVer = tx.xidVersion(); mapping.dhtVersion(xidVer, xidVer); tx.readyNearLocks(mapping, Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList(), Collections.<GridCacheVersion>emptyList()); } }
/** * @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. * @param timeout Timeout. */ public GridNearTxSelectForUpdateFuture(GridCacheContext<?, ?> cctx, GridNearTxLocal tx, long timeout) { super(CU.longReducer()); this.cctx = cctx; this.tx = tx; this.timeout = timeout; futId = IgniteUuid.randomUuid(); lockVer = tx.xidVersion(); log = cctx.logger(GridNearTxSelectForUpdateFuture.class); }
/** * Suspends transaction. * Should not be used directly. Use tx.suspend() instead. * * @param tx Transaction to be suspended. * * @see #resumeTx(GridNearTxLocal, long) * @see GridNearTxLocal#suspend() * @see GridNearTxLocal#resume() * @throws IgniteCheckedException If failed to suspend transaction. */ public void suspendTx(final GridNearTxLocal tx) throws IgniteCheckedException { assert tx != null && !tx.system() : tx; if (!tx.state(SUSPENDED)) { throw new IgniteCheckedException("Trying to suspend transaction with incorrect state " + "[expected=" + ACTIVE + ", actual=" + tx.state() + ']'); } clearThreadMap(tx); transactionMap(tx).remove(tx.xidVersion(), tx); }
/** * Resume transaction in current thread. * Please don't use directly. Use tx.resume() instead. * * @param tx Transaction to be resumed. * @param threadId Thread id to restore. * * @see #suspendTx(GridNearTxLocal) * @see GridNearTxLocal#suspend() * @see GridNearTxLocal#resume() * @throws IgniteCheckedException If failed to resume tx. */ public void resumeTx(GridNearTxLocal tx, long threadId) throws IgniteCheckedException { assert tx != null && !tx.system() : tx; if (!tx.state(ACTIVE)) { throw new IgniteCheckedException("Trying to resume transaction with incorrect state " + "[expected=" + SUSPENDED + ", actual=" + tx.state() + ']'); } assert !threadMap.containsValue(tx) : tx; assert !transactionMap(tx).containsValue(tx) : tx; assert !haveSystemTxForThread(Thread.currentThread().getId()); if (threadMap.putIfAbsent(threadId, tx) != null) throw new IgniteCheckedException("Thread already has started a transaction."); if (transactionMap(tx).putIfAbsent(tx.xidVersion(), tx) != null) throw new IgniteCheckedException("Thread already has started a transaction."); tx.threadId(threadId); }
lockVer = tx != null ? tx.xidVersion() : cctx.versions().next();
/** * */ private void ackBackup() { if (mappings.empty()) return; if (!tx.needReturnValue() || !tx.implicit()) return; // GridCacheReturn was not saved at backup. GridDistributedTxMapping mapping = mappings.singleMapping(); if (mapping != null) { UUID nodeId = mapping.primary().id(); Collection<UUID> backups = tx.transactionNodes().get(nodeId); if (!F.isEmpty(backups)) { assert backups.size() == 1 : backups; UUID backupId = F.first(backups); ClusterNode backup = cctx.discovery().node(backupId); // Nothing to do if backup has left the grid. if (backup == null) { // No-op. } else if (backup.isLocal()) cctx.tm().removeTxReturn(tx.xidVersion()); else cctx.tm().sendDeferredAckResponse(backupId, tx.xidVersion()); } } }
if (txIdMap.remove(tx.xidVersion(), tx)) {
lockVer = tx != null ? tx.xidVersion() : cctx.versions().next();
/** {@inheritDoc} */ @Override protected void updateExplicitVersion(IgniteTxEntry txEntry, GridCacheEntryEx entry) throws GridCacheEntryRemovedException { if (entry.detached()) { GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId(), entry.txKey()); if (cand != null && !xidVersion().equals(cand.version())) { GridCacheVersion candVer = cand.version(); txEntry.explicitVersion(candVer); if (candVer.compareTo(minVer) < 0) minVer = candVer; } } else super.updateExplicitVersion(txEntry, entry); }
/** */ private static void blockProbe(IgniteEx ign, Transaction tx) { ((TestRecordingCommunicationSpi)ign.configuration().getCommunicationSpi()) .blockMessages((node, msg) -> { if (msg instanceof DeadlockProbe) { DeadlockProbe msg0 = (DeadlockProbe)msg; GridNearTxLocal tx0 = ((TransactionProxyImpl)tx).tx(); return msg0.initiatorVersion().equals(tx0.xidVersion()); } return false; }); }
GridCacheVersion aXidVer = ((TransactionProxyImpl)txA).tx().xidVersion();
.mapToObj(this::grid) .filter(g -> g != victim) .map(g -> txsOnNode(g, nearTx.xidVersion())) .flatMap(Collection::stream) .collect(Collectors.toList());
miniId, tx.topologyVersion(), tx.xidVersion(), tx.commitVersion(), tx.threadId(),
tx.xidVersion(), tup.version(), nodeId, detachedEntry.resetFromPrimary(tup.value(), tx.xidVersion());
.mapToObj(i -> txsOnNode(grid(i), nearTx.xidVersion())) .flatMap(Collection::stream) .collect(Collectors.toList());
.mapToObj(i -> txsOnNode(grid(i), nearTx.xidVersion())) .flatMap(Collection::stream) .collect(Collectors.toList());
GridNearCacheEntry cached = (GridNearCacheEntry)entry.cached(); cached.dhtNodeId(tx.xidVersion(), primary.id());
tx.xidVersion(), tx.threadId(), commit,