Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Exclusive Read Lock

As per my understanding, when a transaction read an object in exclusive read mode, no other transaction will be able to even read the data. Is it possible to bypass, so that if my object is locked by some transaction. Another transaction can just only read the object or my understanding is faulty ??

asked 2014-09-09 08:40:57 -0500

Harvey gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

That’s what Exclusive Read Lock is all about. There is a sole owner for the object when reading it. If you want other transactions to be able to read the object you should consider optimistic locking protocol.

In this case the read operation is not transactional , the transaction may be started when the object is updated (optional). If you update non-recent object you will get an exception , re-read the most recent object and update again.

Shay

answered 2014-09-09 09:26:34 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

I'm trying to understand the precise behaviour when using exclusive_read_lock in 9.6.

What I want is to be able to get a pessimistic lock when I know I'm going to read and then update, so that other similar updates from other threads will block on the read. But allow non-transactional reads to continue to see the existing (committed) space object, without needing to specify extended timeouts.

When I test this, with Thread1 doing a read exclusive in a tx, and Thread2 doing a simple readById with no tx, Thread2 returns null immediately. If I add a timeout to the readyById from Thread2 then it blocks until tx of Thread1 has committed.

From my reading of http://wiki.gigaspaces.com/wiki/displ... doing a read from a null tx whilst tx A has an exclusive read lock should be allowed and shouldn't block.

Can you clarify?

matt gravatar imagematt ( 2015-01-23 02:38:36 -0500 )edit

With Exclusive Read Lock there could be only a single reader.Transactional or non-transactional read operations cannot read the object until the transaction locking the object will be completed.-------- Original message --------From: forum@ask.gigaspaces.orgDate:01/25/2015 10:32 PM (GMT-05:00)

shay hassidim gravatar imageshay hassidim ( 2015-01-25 22:28:40 -0500 )edit
0

It is possible to read objects being held in an exclusive read lock. There is a table under the heading "Locking and Blocking Rules" that explains the options on this page: http://docs.gigaspaces.com/xap97/tran...

answered 2014-09-09 09:37:53 -0500

Patrick gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2014-09-09 08:40:57 -0500

Seen: 190 times

Last updated: Sep 09 '14