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

Ask Your Question
0

EXCLUSIVE_READ_LOCK

Hi, I'm testing with GigaSpaces 7.1 and found that EXCLUSIVE_READ_LOCK doesn't block other transactional reads if I use SQLQuery to read or readmultiple the data. However, if I use readById, then it works.

I'm using spring managed transaction with Jini Tx Manager and Isolation.REPEATABLE_READ.

What could be the problem?

Thanks. h4. Attachments

[sample.zip|/upfiles/13759705633293196.zip]

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

asked 2010-06-21 15:03:09 -0500

gddxykxq gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Does it work when you take out the Isolation.REPEATABLE_READ?
How your code looks like?

Attachments

  1. sample.zip

answered 2010-06-21 22:57:31 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

I was trying to do a read from gigaspace, increase a count inside of the object I read and then write it back. If I'm running multiple threads doing the same thing, I get the following exception and the count in the object is not increased at all (by either thread). The code and the log are as attached. When I debug, I clearly see the 1st read doesn't block 2nd.
It doesn't make any difference if I set the isolation level to repeatable read, read commit or just default.

DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] Removed value [org.openspaces.core.transaction.manager.JiniTransactionHolder@6de609] for key [com.sun.jini.mahalo.TxnMgrProxy@38d9f11a] from thread [1] org.openspaces.core.UpdateOperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry; nested exception is com.j_spaces.core.client.OperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry at org.openspaces.core.exception.DefaultExceptionTranslator.internalTranslate(DefaultExceptionTranslator.java:190) at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:50) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:629) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:621) at sample.CountDAO.updateCount(CountDAO.java:64) at sample.CountDAO$$FastClassByCGLIB$$a18a87e7.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:108) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) at sample.CountDAO$$EnhancerByCGLIB$$27523d8a.updateCount(<generated>) at sample.CountDAO$1.run(CountDAO.java:44) Caused by: com.j_spaces.core.client.OperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry Exception in thread "1" org.openspaces.core.UpdateOperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry; nested exception is com.j_spaces.core.client.OperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry at org.openspaces.core.exception.DefaultExceptionTranslator.internalTranslate(DefaultExceptionTranslator.java:190) at org.openspaces.core.exception.DefaultExceptionTranslator.translate(DefaultExceptionTranslator.java:50) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:629) at org.openspaces.core.DefaultGigaSpace.write(DefaultGigaSpace.java:621) at sample.CountDAO.updateCount(CountDAO.java:64) at sample.CountDAO$$FastClassByCGLIB$$a18a87e7.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:108) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625) at sample.CountDAO$$EnhancerByCGLIB$$27523d8a.updateCount(<generated>) at sample.CountDAO$1.run(CountDAO.java:44) Caused by: com.j_spaces.core.client.OperationTimeoutException: Timeout expired after waiting for a transactional proper matching entry

Edited by: Andy Liu on Jun 22, 2010 1:40 PM h4. Attachments

[sample.zip|/upfiles/13759705642179537.zip]

gddxykxq gravatar imagegddxykxq ( 2010-06-22 13:17:38 -0500 )edit
0

After I add support of Exclusive Read Lock to the space object, the behavior just changed but again, 1st read doesn't block 2nd read - instead, 2nd read returns null now.

The line I added:
space.getSpace().setReadModifiers(ReadModifiers.EXCLUSIVEREADLOCK);

Does anyone know why? The documentation clearly says EXCLUSIVEREADLOCK should block other reads.

Thanks.

answered 2010-06-28 09:03:02 -0500

gddxykxq gravatar image
edit flag offensive delete link more

Comments

Andy,

Sorry for the late response.

EXCLUSIVEREADLOCK should be used with readById.
If you would like to lock multiple objects , you should query these using readMultiple and then lock each individuality.

See below how you should update objects in pessimistic mode:
http://www.gigaspaces.com/wiki/display/XAP71/PessimisticLocking

Shay

shay hassidim gravatar imageshay hassidim ( 2010-07-06 11:40:55 -0500 )edit

Does this mean that there's no way to get exclusive read lock in 6.6 since 6.6 doesn't have readbyid method? But the flag is there in 6.6 documentation.

Thx

Andy

gddxykxq gravatar imagegddxykxq ( 2010-07-07 16:19:18 -0500 )edit

Sure there is. If it does not work for you please submit a support case.
Shay

shay hassidim gravatar imageshay hassidim ( 2010-07-15 08:44:04 -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: 2010-06-21 15:03:09 -0500

Seen: 77 times

Last updated: Jun 28 '10