Search in sources :

Example 16 with IgniteInternalTx

use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.

the class GridCacheAdapter method commitTxAsync.

/**
     * Asynchronously commits transaction after all previous asynchronous operations are completed.
     *
     * @param tx Transaction to commit.
     * @return Transaction commit future.
     */
@SuppressWarnings("unchecked")
IgniteInternalFuture<IgniteInternalTx> commitTxAsync(final GridNearTxLocal tx) {
    FutureHolder holder = lastFut.get();
    holder.lock();
    try {
        IgniteInternalFuture fut = holder.future();
        if (fut != null && !fut.isDone()) {
            IgniteInternalFuture<IgniteInternalTx> f = new GridEmbeddedFuture<>(fut, new C2<Object, Exception, IgniteInternalFuture<IgniteInternalTx>>() {

                @Override
                public IgniteInternalFuture<IgniteInternalTx> apply(Object o, Exception e) {
                    return tx.commitNearTxLocalAsync();
                }
            });
            saveFuture(holder, f, /*retry*/
            false);
            return f;
        }
        IgniteInternalFuture<IgniteInternalTx> f = tx.commitNearTxLocalAsync();
        saveFuture(holder, f, /*retry*/
        false);
        ctx.tm().resetContext();
        return f;
    } finally {
        holder.unlock();
    }
}
Also used : IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) IgniteTxRollbackCheckedException(org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException) InvalidObjectException(java.io.InvalidObjectException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) EntryProcessorException(javax.cache.processor.EntryProcessorException) IgniteInterruptedCheckedException(org.apache.ignite.internal.IgniteInterruptedCheckedException) ClusterTopologyServerNotFoundException(org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException) IOException(java.io.IOException) ObjectStreamException(java.io.ObjectStreamException) IgniteException(org.apache.ignite.IgniteException) ClusterTopologyException(org.apache.ignite.cluster.ClusterTopologyException) NoSuchElementException(java.util.NoSuchElementException) IgniteTxHeuristicCheckedException(org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException) ClusterTopologyCheckedException(org.apache.ignite.internal.cluster.ClusterTopologyCheckedException) GridClosureException(org.apache.ignite.internal.util.lang.GridClosureException) GridDhtInvalidPartitionException(org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException) GridEmbeddedFuture(org.apache.ignite.internal.util.future.GridEmbeddedFuture)

Example 17 with IgniteInternalTx

use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.

the class GridCacheMapEntry method peek.

/** {@inheritDoc} */
@Nullable
@Override
public CacheObject peek(@Nullable IgniteCacheExpiryPolicy plc) throws GridCacheEntryRemovedException, IgniteCheckedException {
    IgniteInternalTx tx = cctx.tm().localTxx();
    AffinityTopologyVersion topVer = tx != null ? tx.topologyVersion() : cctx.affinity().affinityTopologyVersion();
    return peek(true, false, topVer, plc);
}
Also used : IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) AffinityTopologyVersion(org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion) Nullable(org.jetbrains.annotations.Nullable)

Example 18 with IgniteInternalTx

use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.

the class GridCacheEventManager method addEvent.

/**
     * @param part Partition.
     * @param key Key for the event.
     * @param evtNodeId Node ID.
     * @param owner Possible surrounding lock.
     * @param type Event type.
     * @param newVal New value.
     * @param hasNewVal Whether new value is present or not.
     * @param oldVal Old value.
     * @param hasOldVal Whether old value is present or not.
     * @param subjId Subject ID.
     * @param cloClsName Closure class name.
     * @param taskName Task name.
     */
public void addEvent(int part, KeyCacheObject key, UUID evtNodeId, @Nullable GridCacheMvccCandidate owner, int type, @Nullable CacheObject newVal, boolean hasNewVal, CacheObject oldVal, boolean hasOldVal, UUID subjId, String cloClsName, String taskName, boolean keepBinary) {
    IgniteInternalTx tx = owner == null ? null : cctx.tm().tx(owner.version());
    addEvent(part, key, evtNodeId, tx == null ? null : tx.xid(), owner == null ? null : owner.version(), type, newVal, hasNewVal, oldVal, hasOldVal, subjId, cloClsName, taskName, keepBinary);
}
Also used : IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx)

Example 19 with IgniteInternalTx

use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.

the class GridCommonAbstractTest method dumpCacheDebugInfo.

/**
     * @param ignite Node.
     */
public void dumpCacheDebugInfo(Ignite ignite) {
    GridKernalContext ctx = ((IgniteKernal) ignite).context();
    log.error("Cache information update [node=" + ignite.name() + ", client=" + ignite.configuration().isClientMode() + ']');
    GridCacheSharedContext cctx = ctx.cache().context();
    log.error("Pending transactions:");
    for (IgniteInternalTx tx : cctx.tm().activeTransactions()) log.error(">>> " + tx);
    log.error("Pending explicit locks:");
    for (GridCacheExplicitLockSpan lockSpan : cctx.mvcc().activeExplicitLocks()) log.error(">>> " + lockSpan);
    log.error("Pending cache futures:");
    for (GridCacheFuture<?> fut : cctx.mvcc().activeFutures()) log.error(">>> " + fut);
    log.error("Pending atomic cache futures:");
    for (GridCacheFuture<?> fut : cctx.mvcc().atomicFutures()) log.error(">>> " + fut);
}
Also used : IgniteKernal(org.apache.ignite.internal.IgniteKernal) IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) GridKernalContext(org.apache.ignite.internal.GridKernalContext) GridCacheExplicitLockSpan(org.apache.ignite.internal.processors.cache.GridCacheExplicitLockSpan) GridCacheSharedContext(org.apache.ignite.internal.processors.cache.GridCacheSharedContext)

Example 20 with IgniteInternalTx

use of org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx in project ignite by apache.

the class GridNearTxFinishFuture method finishOnePhase.

/**
     * @param commit Commit flag.
     */
private void finishOnePhase(boolean commit) {
    assert Thread.holdsLock(this);
    if (finishOnePhaseCalled)
        return;
    finishOnePhaseCalled = true;
    GridDistributedTxMapping locMapping = mappings.localMapping();
    if (locMapping != null) {
        // No need to send messages as transaction was already committed on remote node.
        // Finish local mapping only as we need send commit message to backups.
        IgniteInternalFuture<IgniteInternalTx> fut = cctx.tm().txHandler().finishColocatedLocal(commit, tx);
        // Add new future.
        if (fut != null)
            add(fut);
    }
}
Also used : IgniteInternalTx(org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx) GridDistributedTxMapping(org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxMapping)

Aggregations

IgniteInternalTx (org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx)29 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)8 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)7 ClusterTopologyCheckedException (org.apache.ignite.internal.cluster.ClusterTopologyCheckedException)5 IgniteException (org.apache.ignite.IgniteException)3 IgfsPath (org.apache.ignite.igfs.IgfsPath)3 IgniteTxManager (org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager)3 TransactionProxyImpl (org.apache.ignite.internal.processors.cache.transactions.TransactionProxyImpl)3 GridCacheVersion (org.apache.ignite.internal.processors.cache.version.GridCacheVersion)3 HashMap (java.util.HashMap)2 ClusterNode (org.apache.ignite.cluster.ClusterNode)2 IgniteInterruptedCheckedException (org.apache.ignite.internal.IgniteInterruptedCheckedException)2 IgniteKernal (org.apache.ignite.internal.IgniteKernal)2 NodeStoppingException (org.apache.ignite.internal.NodeStoppingException)2 GridCacheEntryRemovedException (org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException)2 GridCacheMvccCandidate (org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate)2 GridCacheReturn (org.apache.ignite.internal.processors.cache.GridCacheReturn)2 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)2 IgniteTxEntry (org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry)2 IgniteTxHeuristicCheckedException (org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException)2