-
1. Re: TransactionCoordinator using one phase commit for PESSIMISTIC locking
mircea.markus Sep 5, 2012 7:33 PM (in response to dengansh)Very good question Arne.
Addind a prepare (1 network call) in order to check if the cluster is redundant as the tx originator would be informed by that by jgroups/the transport layer.
Now of course there is a chance for a node (or many nodes for that reason) to go down *after* prepare, before commit: we have transaction recovery in place that would help you to reconcile transaction's state in that case: https://docs.jboss.org/author/display/ISPN/Transaction+recovery
-
2. Re: TransactionCoordinator using one phase commit for PESSIMISTIC locking
dengansh Sep 6, 2012 3:03 AM (in response to mircea.markus)Thanks for answering, Markus.
Clearly even 2PC does not prevent transaction recovery situations completely. 2PC has been designed, however, to make this as unlikely as possible. The TransactionCoordinator should never ignore 2PC, I believe, because it does add *some* extra safety, doesn't it?
Especially when integrating a 1PC resource (e.g. non-XA database) in a 2PC transaction, using the Last Resource Commit Optimization (LRCO, see https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/5/html/Administration_And_Configuration_Guide/lrco-overview.html), the prepare phase should not be ommitted: LRCO performs the commit on the 1PC resource in the prepare phase. If the Infinispan prepare phase is left out, other Infinispan nodes wouldn't even know that we have a transaction recovery situation, would they?
Therefore I would suggest to change Infinispan to never do the 1PC optimisation in the TransactionCoordinator if it originally was a 2PC transaction. As the TransactionXaAdapter.commit method calls txCoordinator.prepare and txCoordinator.commit even in a 1PC situation, it could be changed to propagate the information "isOnePhase" to the TransactionCoordinator.prepare and commit methods. There, the 1PC optimisation must not be done if it originally was a 2PC transaction. (At least, this should be configurable.)
I can file a JIRA or even provide a patch if this helps. Please let me know.
Keep up the good work!
-
3. Re: TransactionCoordinator using one phase commit for PESSIMISTIC locking
mircea.markus Sep 6, 2012 8:04 AM (in response to dengansh)Especially when integrating a 1PC resource (e.g. non-XA database) in a 2PC transaction, using the Last Resource Commit Optimization (LRCO, see https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/5/html/Administration_And_Configuration_Guide/lrco-overview.html), the prepare phase should not be ommitted: LRCO performs the commit on the 1PC resource in the prepare phase. If the Infinispan prepare phase is left out, other Infinispan nodes wouldn't even know that we have a transaction recovery situation, would they?
Of course if last resosurce optimisation is in place(or if the prepare is marked onePhase==true for that reson) we don't ommit the prepare :-)
For 2PC though I'm not sure the prepare has any added value, as we'd only use for failure detection and there are other built in mechanisms that would inform us about a node leaving.