ic4y opened a new issue, #2859:
URL: https://github.com/apache/incubator-seatunnel/issues/2859

   ### Search before asking
   
   - [X] I had searched in the 
[feature](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22Feature%22)
 and found no similar feature requirement.
   
   
   ### Description
   
   The exact-once semantics of the current jdbc sink are implemented through XA 
transactions. The current implementation relies on a single database connection 
to open multiple XA transactions at the same time, for example:
   
   ```
   1、Start xid1 transaction
   xa start "xid1"
   xa end  "xid1"
   xa prepare "xid1"
   
   2、Uncommitted but need to open  another xid2
   xa start "xid2"
   xa end  "xid2"
   xa prepare "xid2"
    
   3、Then it is possible to submit
   xa commit "xid1"
   xa commit "xid2"
   ```
   
   This requires a connection to open multiple transactions at the same time, 
which requires version >=8.0.29 in mysql, and other databases need to support 
the same connection to open multiple transactions at the same time.
   
   If a connection can only open one XA transaction at the same time, then we 
can use multiple connections to open multiple XA transactions at the same time. 
This is the session pool。for example:
   
   ```
   1、Get c1 from the connection pool, start xid1
   c1 = pool.getconnection("c1")
   c1 xa start "xid1"
   c1 xa end  "xid1"
   c1 xa prepare "xid1"
   
   2、Get c2 from the connection pool, start xid2
   c2 = pool.getconnection("c2")
   c2 xa start "xid2"
   c2 xa end  "xid2"
   c2 xa prepare "xid2"
    
   3、Then get the connection corresponding to xid from the connection pool to 
commit
   pool.getconnection("c1") --> xa commit "xid1"
   pool.getconnection("c2") -->  xa commit "xid2"
   ```
   
   This problem can be solved by opening multiple XA transactions through 
multiple connections.
   
   ### Usage Scenario
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to