Re: Explicit lock whithin a transaction

2016-11-20 Thread akaptsan
Would you please evaluate another variant: use READ_COMMITTED mode and invoke
an EntryProcessor to acquire explicit lock 



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9106.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-19 Thread vkulichenko
In case of PESSIMISTIC/REPEATABLE_READ transaction get() method is
semantically ReadAndLock, while getAllOutTx() is simple Read. You can
probably argue the API usability here, but functionality is available and I
don't see any hacks.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9104.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-19 Thread akaptsan
I guess we could use getAllOutTx for read-only objects. But honestly it looks
like nasty hack

Explicit ReadAndLock semantic is widely used in relational databases and
other frameworks. I beleive Ignite should also provide it.




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9102.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-18 Thread vkulichenko
What do you mean by "inter-thread async communication"? This is not happening
in getAllOutTx, the whole purpose of this method is to allow reading outside
of transaction without delegating it to another thread.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9089.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-18 Thread akaptsan
I do know objects which I'm going to update in advance, but I don't know
objects which I'm going to read.

The getAllOutTx() can be used, but I don't like it. First of all performance
would be much worse (it involves inter-thread async communication). 
I need read lot of objects but only very few of them must be locked




--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9069.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-17 Thread vkulichenko
If you don't know whether you're going to update in advance, how do you know
whether to lock? If you want to read outside of transaction somewhere in the
middle, you can use IgniteCache.getAllOutTx(..) method.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9061.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-17 Thread akaptsan
Yes I read and don't update some other objects.
It would be very difficult to read objectsoutside of transaction. I need to
execute qute complicated logic within transacttion. During the execution I
can read/update many objects depending on conditions, settings and so on. I
can't know which objects I need to read until I come to certain point within
transaction.

In SQL I have following options:
- read without lock - select ... 
- read and lock - select ... for update





--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9059.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-17 Thread akaptsan
PESSIMISTIC-READ_COMMITTED locks ALL objects I read in transaction. It's
overkill 
I need to readAndLock for some objects and readWithoutLock for others



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9054.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-17 Thread vdpyatkov
Hi,

I recoment to use PESSIMISTIC, READ_COMMITTED (without any locks)
transaction for each account.  And look at the comment on Val[1].

You are doing somtink like this, as I understand from first post.

Why is this method is not suitable?

[1]:
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p8593.html



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p9051.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-11-01 Thread akaptsan
May be I should use empty EntryProcessor for this?



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p8647.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-10-29 Thread akaptsan
We don't need lock ALL entries on read, only SOME of them. 
Typically we need lock objects which will be modified latter in the
transactions but we don't want lock all read-only objects 



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p8608.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.


Re: Explicit lock whithin a transaction

2016-10-28 Thread vkulichenko
Hi,

You should use PESSIMISTIC, REPEATABLE_READ transaction in this case. It
will lock the entry on read.

-Val



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Explicit-lock-whithin-a-transaction-tp8586p8593.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.