/** {@inheritDoc} */ @Override public void apply(StringBuilder sb, GridKernalContext ctx) { sb.append(U.nl()) .append("Related transactions [dhtVer=").append(dhtVer) .append(", nearVer=").append(nearVer).append("]: "); boolean found = false; for (IgniteInternalTx tx : ctx.cache().context().tm().activeTransactions()) { if (dhtVer.equals(tx.xidVersion()) || nearVer.equals(tx.nearXidVersion())) { sb.append(U.nl()) .append(" ") .append(tx.getClass().getSimpleName()) .append(" [ver=").append(tx.xidVersion()) .append(", nearVer=").append(tx.nearXidVersion()) .append(", topVer=").append(tx.topologyVersion()) .append(", state=").append(tx.state()) .append(", fullTx=").append(tx).append(']'); found = true; } } if (!found) sb.append(U.nl()).append("Failed to find related transactions."); }
/** {@inheritDoc} */ @Nullable @Override public CacheObject peek() throws GridCacheEntryRemovedException, IgniteCheckedException { IgniteInternalTx tx = cctx.tm().localTx(); AffinityTopologyVersion topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion(); return peek(true, false, topVer, null); }
/** * Detects deadlock starting from given keys. * * @param tx Target tx. * @param keys Keys. * @return {@link TxDeadlock} if found, otherwise - {@code null}. */ TxDeadlockFuture detectDeadlock(IgniteInternalTx tx, Set<IgniteTxKey> keys) { GridCacheVersion txId = tx.nearXidVersion(); if (log.isDebugEnabled()) { log.debug("Deadlock detection started " + "[nodeId=" + cctx.localNodeId() + ", xidVersion=" + txId + ", keys=" + keys + ']'); } TxDeadlockFuture fut = new TxDeadlockFuture(cctx, txId, tx.topologyVersion(), keys); fut.init(); return fut; }
/** * @param tx Transaction. * @param txEntry Entry to unlock. */ private void txUnlock(IgniteInternalTx tx, IgniteTxEntry txEntry) { while (true) { try { GridCacheEntryEx entry = txEntry.cached(); assert entry != null; if (entry.detached()) break; entry.txUnlock(tx); break; } catch (GridCacheEntryRemovedException ignored) { if (log.isDebugEnabled()) log.debug("Got removed entry in TM txUnlock(..) method (will retry): " + txEntry); txEntry.cached(txEntry.context().cache().entryEx(txEntry.key(), tx.topologyVersion())); } } }
tx.threadId(), tx.xidVersion(), tx.topologyVersion(), timeout, /*reenter*/false,
dhtTx.nearNodeId(), dhtTx.nearXidVersion(), tx.topologyVersion(), tx.threadId(), tx.xidVersion(),
tx.topologyVersion(), tx.local());
tx.endVersion(cctx.versions().next(tx.topologyVersion()));
boolean valid = valid(tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion());
CacheObject old; final boolean valid = valid(tx != null ? tx.topologyVersion() : topVer);
valid = entry.valid(tx.topologyVersion());
final boolean valid = valid(tx != null ? tx.topologyVersion() : topVer);
txEntry1.cached(cacheCtx.cache().entryEx(txEntry1.key(), tx.topologyVersion()));
assert mvccVer != null; final boolean valid = valid(tx.topologyVersion());
valid = entry.valid(tx.topologyVersion());
assert tx != null; final boolean valid = valid(tx.topologyVersion());
valid = entry.valid(tx.topologyVersion());
/** {@inheritDoc} */ @Nullable @Override public CacheObject peek(@Nullable IgniteCacheExpiryPolicy plc) throws GridCacheEntryRemovedException, IgniteCheckedException { IgniteInternalTx tx = cctx.tm().localTx(); AffinityTopologyVersion topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion(); return peek(true, false, topVer, plc); }
/** * Detects deadlock starting from given keys. * * @param tx Target tx. * @param keys Keys. * @return {@link TxDeadlock} if found, otherwise - {@code null}. */ TxDeadlockFuture detectDeadlock(IgniteInternalTx tx, Set<IgniteTxKey> keys) { GridCacheVersion txId = tx.nearXidVersion(); if (log.isDebugEnabled()) { log.debug("Deadlock detection started " + "[nodeId=" + cctx.localNodeId() + ", xidVersion=" + txId + ", keys=" + keys + ']'); } TxDeadlockFuture fut = new TxDeadlockFuture(cctx, txId, tx.topologyVersion(), keys); fut.init(); return fut; }
/** * @param tx Transaction. * @param txEntry Entry to unlock. */ private void txUnlock(IgniteInternalTx tx, IgniteTxEntry txEntry) { while (true) { try { GridCacheEntryEx entry = txEntry.cached(); assert entry != null; if (entry.detached()) break; entry.txUnlock(tx); break; } catch (GridCacheEntryRemovedException ignored) { if (log.isDebugEnabled()) log.debug("Got removed entry in TM txUnlock(..) method (will retry): " + txEntry); txEntry.cached(txEntry.context().cache().entryEx(txEntry.key(), tx.topologyVersion())); } } }