Search in sources :

Example 11 with CacheStoreManager

use of org.apache.ignite.internal.processors.cache.store.CacheStoreManager in project ignite by apache.

the class IgniteTxLocalAdapter method userRollback.

/**
 * {@inheritDoc}
 */
@Override
public void userRollback(boolean clearThreadMap) throws IgniteCheckedException {
    TransactionState state = state();
    if (state != ROLLING_BACK && state != ROLLED_BACK) {
        setRollbackOnly();
        throw new IgniteCheckedException("Invalid transaction state for rollback [state=" + state + ", tx=" + this + ']');
    }
    if (near()) {
        // transaction manager, so they will be removed from cache.
        for (IgniteTxEntry e : allEntries()) evictNearEntry(e, false);
    }
    if (DONE_FLAG_UPD.compareAndSet(this, 0, 1)) {
        cctx.tm().rollbackTx(this, clearThreadMap, skipCompletedVersions());
        cctx.mvccCaching().onTxFinished(this, false);
        if (!internal()) {
            Collection<CacheStoreManager> stores = txState.stores(cctx);
            if (stores != null && !stores.isEmpty()) {
                assert isWriteToStoreFromDhtValid(stores) : "isWriteToStoreFromDht can't be different within one transaction";
                boolean isWriteToStoreFromDht = F.first(stores).isWriteToStoreFromDht();
                if (!stores.isEmpty() && (near() || isWriteToStoreFromDht))
                    sessionEnd(stores, false);
            }
        }
    }
}
Also used : TransactionState(org.apache.ignite.transactions.TransactionState) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) CacheStoreManager(org.apache.ignite.internal.processors.cache.store.CacheStoreManager)

Aggregations

CacheStoreManager (org.apache.ignite.internal.processors.cache.store.CacheStoreManager)11 ArrayList (java.util.ArrayList)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 CacheStore (org.apache.ignite.cache.store.CacheStore)4 CacheDataStructuresManager (org.apache.ignite.internal.processors.cache.datastructures.CacheDataStructuresManager)3 GridDhtCache (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCache)3 GridDhtCacheAdapter (org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter)3 GridDhtAtomicCache (org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache)3 GridDhtColocatedCache (org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache)3 GridNearAtomicCache (org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache)3 GridNearTransactionalCache (org.apache.ignite.internal.processors.cache.distributed.near.GridNearTransactionalCache)3 GridCacheDrManager (org.apache.ignite.internal.processors.cache.dr.GridCacheDrManager)3 GridLocalCache (org.apache.ignite.internal.processors.cache.local.GridLocalCache)3 GridLocalAtomicCache (org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache)3 GridCacheQueryManager (org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager)3 CacheContinuousQueryManager (org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager)3 CachePluginManager (org.apache.ignite.internal.processors.plugin.CachePluginManager)3 CacheObject (org.apache.ignite.internal.processors.cache.CacheObject)2 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)2 GridTimeoutObject (org.apache.ignite.internal.processors.timeout.GridTimeoutObject)2