why the xa transaction does not work? #32010
gejing1108
started this conversation in
General
Replies: 1 comment
-
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
version: 5.4.1
I've followed the github step to generate the examples for shardingsphere
![image](https://private-user-images.githubusercontent.com/126172599/328006765-8c6d2efc-fc04-4689-916a-8ed57bbb67d6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMzAyNjksIm5iZiI6MTczOTMyOTk2OSwicGF0aCI6Ii8xMjYxNzI1OTkvMzI4MDA2NzY1LThjNmQyZWZjLWZjMDQtNDY4OS05MTZhLThlZDU3YmJiNjdkNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwMzEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00OGQzZDFlZDliN2QxYzc4YjIxMGU2MzA2M2ZhNmUwOWFkODk4Mjc4ZDljNWE3ZDQwMGM3NTNjMjU2YjEyOGUzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.1yjvBhlQ4UlEI0cluKte9uaQ_ImGale6I30nlhitIvE)
![image](https://private-user-images.githubusercontent.com/126172599/328006944-878a2d79-ae24-4e99-8321-209be5ae4ba7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVz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mWC1BbXotRGF0ZT0yMDI1MDIxMlQwMzEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zY2YzNTk0N2QwNzk1YjFlNGE1Y2Q3OGI0MTQ1ZGRlMmEwZTg0ZDk0MmM5NjE3NjQ0MzdhYjhjN2NlY2M3MjEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Dg3JaEvQ56yycYLwUfLsTFmBDs17OsvzcWf3eSLI18c)
![image](https://private-user-images.githubusercontent.com/126172599/328007035-1600311f-34dd-4d17-9824-4bebaf474f37.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMzAyNjksIm5iZiI6MTczOTMyOTk2OSwicGF0aCI6Ii8xMjYxNzI1OTkvMzI4MDA3MDM1LTE2MDAzMTFmLTM0ZGQtNGQxNy05ODI0LTRiZWJhZjQ3NGYzNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwMzEyNDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mMGZjNjNiZDIzZDk0ZDQ2OWI2ZDc3OGE2YTdkM2Y2ZWUzNGYwYjJiZjM1MmQyM2Y4NDkxODMwODg2N2U2MTIyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.KLOMtoHxp7P4AOIR3jRSmPaq0zU92p3dVnxzL_t2KEU)
and in this example, it runs the named run method to implement xa transaction, while I don't find any annotation on this method, this method only create table, insert records and then drop tables, so I doubt if it can show the function of xa transaction, I've tested in my way:
first, add the transaction type in config file as the sample do:
and then add the bean class as the sample do:
and then import it as the sample do:
and at last, I write a simple method to test it:
in this method, I throw an exception when I've inserted 6 records, if the xa transaction works, it will rollback when the exception appears, while actually, 6 records are inserted into the table, so what have I omitted for xa transaction?
btw: in old version of shardingsphere like 4.X, I should add annotation like @ShardingTransactionType(value = TransactionType.XA), while in the 5.X version, I don't find this annotation, and in the sample generated above, I don't find any annotation on the method
Beta Was this translation helpful? Give feedback.
All reactions