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

Ask Your Question
0

Transaction Atomicity

Hi, I have an issue concerning transactions, hopefully someone has experienced this as well.

PU1 creates a transaction, changes() a nested property (List<String>) of ObjectA with the Id of ObjectB, writes ObjectB, commits transaction.

PU2 has a listener for ObjectB, is notified of the write, and then performs a readMultiple() for matching ObjectA(s), using a SQLQuery which iterates over the nested List<String>. But sometimes the readMultiple() returns no matching results.

The readMultiple() uses a READ_COMMITTED flag. We are using the sync2backup-replication topology. The objects could be in different partitions. This transactional work is all completed in one thread on the PU1 side. The Gigaspaces proxy object has been configured with a distributed transaction manager.

Should we not be able to assume that when notified of an action that took place when a transaction was committed that the other actions have also been committed?

Thanks, John.

asked 2016-04-28 12:35:14 -0600

jmg gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

John

I would like to know exactly how you are notified, but I don't think it will change the response. You should use a read-if-exists with a timeout. This will block until the timeout or the object exists. This is necessary because the transaction may not have have completed when you are notified of the write. If this call returns with an object, as it should, you can make the readMultiple call at that time. Note that this is necessary when using read committed.

Please let me know if you have any further questions

John

answered 2016-05-02 09:32:52 -0600

jb gravatar image
edit flag offensive delete link more

Comments

I'm using a NotifyContainer as a listener, with the ListenerEventTypes set to WRITE and UPDATE. I have to complicate matters further: The only link between ObjectA and ObjectB is the list on ObjectA. But it's possible for ObjectB to be associated with multiple ObjectA instances. It's possible we update the list in 2 separate ObjectA instances, that's why I'm using the readMultiple(). If the read-if-exists returns a result, is it safe to assume that both are updated? Or is it possible that only one of them may have updated? We may need to modify our model if so. I'll write a test to check anyway.

jmg gravatar imagejmg ( 2016-05-03 04:46:54 -0600 )edit

Hi John, it seems that readIfExists waits until the transaction has fully committed, thanks for your help.

jmg gravatar imagejmg ( 2016-05-03 08:55:04 -0600 )edit
0

John

Precisely how does PU1 create a transaction?

Regards

John

answered 2016-04-28 12:52:32 -0600

jb gravatar image
edit flag offensive delete link more

Comments

Hi John, the transaction is created programmatically, using a distributed transaction manager and a DefaultTransactionDefinition.

jmg gravatar imagejmg ( 2016-04-28 16:25:01 -0600 )edit

To rule out issues with multiple transaction managers I've written a test which listens in the same PU, using the same txManager and space proxy. I'm still seeing the same issue.

jmg gravatar imagejmg ( 2016-04-29 05:11:29 -0600 )edit

I create my transaction as specified here: http://docs.gigaspaces.com/xap110/tra...

jmg gravatar imagejmg ( 2016-04-29 05:12:56 -0600 )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: 2016-04-28 12:35:14 -0600

Seen: 891 times

Last updated: May 02 '16