ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kotamrajuyashasvi <kotamrajuyasha...@gmail.com>
Subject Locking rows within Ignite Transactions
Date Mon, 04 Dec 2017 09:29:33 GMT
Hi

I'm using Ignite Transactions(Ignite Version 2.1.0 and
*TransactionConcurrency.PESSIMISTIC,TransactionIsolation.REPEATABLE_READ*")
and after starting a transaction I need to lock certain rows.

According to Ignite 2.1.0 Documentation 
*"Explicit locks are not transactional and cannot not be used from within
transactions (exception will be thrown). If you do need explicit locking
within transactions, then you should use TransactionConcurrency.PESSIMISTIC
concurrency control for transactions which will acquire explicit locks for
relevant cache operations."*

When I try to use lock() method within a Transaction I get the following
Exception:
*"Exception in thread "main" javax.cache.CacheException: Explicit lock can't
be acquired within a transaction.
	at
org.apache.ignite.internal.processors.cache.CacheLockImpl.checkTx(CacheLockImpl.java:214)
	at
org.apache.ignite.internal.processors.cache.CacheLockImpl.lock(CacheLockImpl.java:72)"*

When I use Cache.get() then the rows are automatically getting locked. But I
do not need entire row for 
a cache PK hence cache.get() method is an overhead. I just need to lock a
row with a given cache PK. How can I achieve this within the Transaction.



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

Mime
View raw message