apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.83k stars 6.71k forks source link

executeBatch not support xa transaction #32187

Open chenqi14 opened 2 months ago

chenqi14 commented 2 months ago

Bug Report

sharding version : 5.4.0

scene : I opened xa transaction and executed executeBatch sql, but xa failed。

cause: ShardingSpherePreparedStatement.executeBatch

image
terrymanu commented 2 months ago

What is the exception or behavior when XA failed?

chenqi14 commented 2 months ago

When some instances sql failed, all instances should be rolled back, but there is not, some insertions succeed and some fail.

terrymanu commented 2 months ago

What is the frequency of this issue occurring, does it require high concurrency or does it happen frequently? What is the cause of the SQL execute failure, is there a detail of error message?

chenqi14 commented 1 month ago

必现的,如果是广播表插入数据,如果有一个实例uk冲突导致失败,那么只有这一个实例插入失败了,其他的实例插入成功。没有回滚。原因是executeBatch逻辑就是一个并行插入的逻辑,没有做事务控制

comecny commented 1 month ago

hi @terrymanu , could you assign this issue to me ?

strongduanmu commented 1 month ago

@comecny Welcome, I just assign this issue to you.

comecny commented 1 month ago

hi @chenqi14 , Provide more information, configuration details, or code usage examples