liuyangming opened a new pull request #2854: modify the enlistment to support 
the transaction propagation REQUIRES_NEW
URL: https://github.com/apache/incubator-shardingsphere/pull/2854
 
 
   XAShardingTransactionManager should not maintain the enlisted resources, 
because it cannot control the association/desociation of transactions. Consider 
the following scenario( service **A**{REQUIRED} -> service **B**{REQUIRES_NEW} 
): 
   0. TM begins a xa transaction(txA) for A;
   1. A performs an insert operation in DataSource demo_ds;
   2. A invokes service B, the propagation of B is REQUIRES_NEW, so TM begins a 
new xa transaction(txB) for B;
   3. B performs an insert operation in the same DataSource demo_ds too;
   in this scenario, the XAResource should be enlisted to both txA and txB. In 
the existing implementation, the XAResource is only enlisted to txA, because 
when B get the connection, there is a dataSourceName associated with current 
thread.
   
   Since the XAShardingTransactionManager does not participate in the thread 
control of transaction, it should always dispatch the enlistment to the TM, the 
TM will decide if and how to enlist these xa resources.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to