-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After Seata is integrated into distributed transactions, how can Seata AT processes not be executed in a single data source scenario (TransactionType.LOCAL is sufficient) #34556
Comments
|
I understand what you're saying, most of the time the methods in the service operate on a single data source and don't involve distributed transactions at this point, in a few cases it involves distributed transactions because of the use of shard tables or remote calls. When it does not involve distributed transactions, it is still brokered by Seata, requiring global transaction ids, registering branch transactions, etc., which do not actually need to be carried out. If you can use this annotation like @GlobalTransactional, then use distributed transactions. Using @transactional continues to execute local transactions. I think it's more of an optimization point |
|
@GlobalTransactional is just an example and is not intended to implement its logic on the shardingjdbc side. What I want to say is that after configuring TRANSACTION=BASE, all data sources are brokered globally by Seata. In the case of a single data source, the full Seata AT process could not have been executed because using external components would have introduced more risk, and it would have been better to commit the transaction more simply and quickly, without the need to involve Seata's two-stage commit. Seata's two-phase commit is performed only when distributed transactions are involved. I just want to consult whether there is such a solution in shardingjdbc, but I don't know. If not, I will use the current global proxy. |
|
What you say makes sense, I tried to implement it before, but I know some of shardingjdbc source code, not completely familiar with it, so it did not succeed. Now I'd rewrite the SeataATShardingSphereTransactionManager to read seata configuration from the NACOS , rather than seata.conf. I try to implement this from SeataATShardingSphereTransactionManager logic. Thank you for your answer |
|
Yes, ZooKeeper is now supported in version 5.x as a registry, and it's even better for seata.conf to read the configuration from ZooKeeper or another configuration center like NACOS |
|
version
Seata: 2.0.0
ShardingJDBC: 5.3.2
question
After Seata is integrated into distributed transactions, adding @transactional(rollbackFor = Except.class) on the business methods AT this point will execute the Seata AT process to execute the transaction. However, there are many scenarios where a single data source is being manipulated and TransactionType. LOCAL is sufficient. Is there a solution that only executes the Seata AT Spring transactions process in the case of multiple data sources, and that @transactional(rollbackFor = Exception.class) executes normal Spring transactions in the case of a single data source?
The text was updated successfully, but these errors were encountered: