You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by richabali <ri...@gmail.com> on 2017/09/03 05:19:30 UTC

Apache ignite transaction issue: Failed to enlist entry

I am using transaction as below:

ignite = Ignition.ignite();
igniteTransactions = ignite.transactions();
Transaction igniteTransaction = igniteTransactions.tx();
        if(igniteTransaction == null){
            igniteTransaction =
igniteTransactions.txStart(TransactionConcurrency.OPTIMISTIC,
                                                           
TransactionIsolation.SERIALIZABLE);
            igniteTransaction.timeout(timeInMillis);
        }

It gives below error when I try to put something in cache:

class org.apache.ignite.IgniteCheckedException: Failed to enlist write value
for key (cannot have update value in transaction after EntryProcessor is
applied): 14630037
    
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.enlistWriteEntry(GridNearTxLocal.java:1340)
    
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.enlistWrite(GridNearTxLocal.java:856)
    
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.putAsync0(GridNearTxLocal.java:534)
    
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal.putAsync(GridNearTxLocal.java:386)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter$21.op(GridCacheAdapter.java:2355)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter$21.op(GridCacheAdapter.java:2353)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter.syncOp(GridCacheAdapter.java:4107)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter.put0(GridCacheAdapter.java:2353)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2334)
    
org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2311)
    
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.put(IgniteCacheProxy.java:1502)

Please give some explanation on why this error occurs and what can be done
to avoid it.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Apache ignite transaction issue: Failed to enlist entry

Posted by Вячеслав Коптилин <sl...@gmail.com>.
Hi,

I tried the following code and it works as expected (without any exceptions)

        Ignite ignite = Ignition.start();

        CacheConfiguration cfg = new CacheConfiguration()
            .setName("test-transactional-cache")
            .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

        IgniteCache cache = ignite.getOrCreateCache(cfg);

        Integer key = new Integer(12);

        IgniteTransactions transactions = ignite.transactions();

        try (Transaction tx =
transactions.txStart(TransactionConcurrency.OPTIMISTIC,
TransactionIsolation.SERIALIZABLE)) {
            cache.put(key, 42);

            tx.commit();
        }

        System.out.println("key=" + key + ", value=" + cache.get(key));


Could you please provide cache configuration and full code snippet that can
be used as reproducer?

Thanks!

2017-09-03 8:19 GMT+03:00 richabali <ri...@gmail.com>:

> I am using transaction as below:
>
> ignite = Ignition.ignite();
> igniteTransactions = ignite.transactions();
> Transaction igniteTransaction = igniteTransactions.tx();
>         if(igniteTransaction == null){
>             igniteTransaction =
> igniteTransactions.txStart(TransactionConcurrency.OPTIMISTIC,
>
> TransactionIsolation.SERIALIZABLE);
>             igniteTransaction.timeout(timeInMillis);
>         }
>
> It gives below error when I try to put something in cache:
>
> class org.apache.ignite.IgniteCheckedException: Failed to enlist write
> value
> for key (cannot have update value in transaction after EntryProcessor is
> applied): 14630037
>
> org.apache.ignite.internal.processors.cache.distributed.
> near.GridNearTxLocal.enlistWriteEntry(GridNearTxLocal.java:1340)
>
> org.apache.ignite.internal.processors.cache.distributed.
> near.GridNearTxLocal.enlistWrite(GridNearTxLocal.java:856)
>
> org.apache.ignite.internal.processors.cache.distributed.
> near.GridNearTxLocal.putAsync0(GridNearTxLocal.java:534)
>
> org.apache.ignite.internal.processors.cache.distributed.
> near.GridNearTxLocal.putAsync(GridNearTxLocal.java:386)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$21.op(
> GridCacheAdapter.java:2355)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter$21.op(
> GridCacheAdapter.java:2353)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.syncOp(
> GridCacheAdapter.java:4107)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.put0(
> GridCacheAdapter.java:2353)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(
> GridCacheAdapter.java:2334)
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(
> GridCacheAdapter.java:2311)
>
> org.apache.ignite.internal.processors.cache.IgniteCacheProxy.put(
> IgniteCacheProxy.java:1502)
>
> Please give some explanation on why this error occurs and what can be done
> to avoid it.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>