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

Ask Your Question
0

Object Dissappears when I lock it

Hi ! I'm using 7.0-rc1. Two pu's. PU1, under transaction, reads an object using SQLQuery and readmodifier of "ReadModifiers.EXCLUSIVE_READ_LOCK + ReadModifiers.READ_COMMITTED".

If during PU1 transaction the other PU tries to do the same, same SQLQuery and same read modifier, the result of query is NULL. No PU performs a take or a delete, so why has it dissapeared ? The same query after the other transaction is commited returns the object correctly.

The transactions are configured ok, since other transactions see the changes only after the commit is called.

So my questions are:

  • The read method should block until the first transaction ends, right ?

  • The read call returns immediately. The read method is supposed to wait if there is no object. Is this applicable only to read with templates and no to SQLQuery ?

Thanks !

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3130]{quote}

asked 2009-06-07 22:04:07 -0500

pruggia gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

Hello,

I would assume you are using GigaSpaces.read() method. The API is designed for distributed partitioned environment, and hence by default the read timeout is 0. Meaning, if there is no object read to be read during the call the method will return with null result.
If you'd like to wait until the other object is being released from it's lock, add additional wait time as a parameter to the method.

In addition, there is no point using in conjunction readcommitted and exclusiveread. You can satisfy in your case to use only exclusive_read.

Guy

answered 2009-06-08 04:13:02 -0500

nirpaz gravatar image
edit flag offensive delete link more

Comments

I'm using a time out parameter. Here is my call: masterGigaSpace.read(new SQLQuery<dataimportjobstatus>( DataImportJobStatus.class, "jobId='" + jobId + "'"), 10000, ReadModifiers.EXCLUSIVE_READ_LOCK); This call should wait until the object lock is released right ? Thanks !

pruggia gravatar imagepruggia ( 2009-06-08 08:56:41 -0500 )edit

Timeout based operation (aka blocking operations) - i.e. read or take with timeout > 0 with remote client using partitioned space are not currently supported. These will work only with a single space or when using the primary-backup cluster schema.

You should use the same technique used with the ContainerComponent , where the ReceiveOperationHandler used in Non-Blocking mode. See: http://www.gigaspaces.com/wiki/displa...

Here we perform internally a period a read against each partition in round robin manner.

Another comment- if you don't need to use SQLQuery - try to avoid it to reduce the overhead of the SQL query parsing. Use regular template instead.

Shay

shay hassidim gravatar imageshay hassidim ( 2009-06-08 11:45:35 -0500 )edit

But it is not a partitioned space, may be he is thinking it's a partitioned space.
It's only one remote space, very strange.
Thanks !

pruggia gravatar imagepruggia ( 2009-06-08 12:52:00 -0500 )edit

Changing the way I get the object (using templates instead of SQLQuery) solved the issue. SqlQuery + read + read exclusive + timeout is not supported. You can only do this blocking query usuing snapshots. It's documented here: http://www.gigaspaces.com/wiki/displa... -- "Using SQLQuery with Blocking Operations through Snapshot".

Thanks !

pruggia gravatar imagepruggia ( 2009-06-09 13:20:46 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2009-06-07 22:04:07 -0500

Seen: 49 times

Last updated: Jun 08 '09