apache / incubator-seata-samples

Apache Seata(incubating) Samples for Java
https://seata.apache.org/
Apache License 2.0
2.27k stars 1.91k forks source link

master版的XA mode demo几乎不能运行,请修正 #653

Closed cwqbupt closed 5 months ago

cwqbupt commented 5 months ago

我运行至少遇到这几个问题: 1 :bussiness默认AT mode而不是XA mode 2:order项目缺少controller文件,以致于bussniss找不到rpc create方法 3:storage项目显示xid为null: 2024-04-15 21:41:57.315 INFO 24345 --- [nio-8081-exec-1] org.apache.seata.service.StorageService : Stock Service Begin ... xid: null 2024-04-15 21:41:57.315 INFO 24345 --- [nio-8081-exec-1] org.apache.seata.service.StorageService : Deducting inventory SQL: update stock_tbl set count = count - 2 where commodity_code = C00321 2024-04-15 21:41:57.322 INFO 24345 --- [nio-8081-exec-1] org.apache.seata.service.StorageService : Stock Service End ... ^@^@^@^@^@2024-04-15 21:46:23.923 INFO 24345 --- [nio-8081-exec-3] org.apache.seata.service.StorageService : Stock Service Begin ... xid: null 2024-04-15 21:46:23.924 INFO 24345 --- [nio-8081-exec-3] org.apache.seata.service.StorageService : Deducting inventory SQL: update stock_tbl set count = count - 2 where commodity_code = C00321 2024-04-15 21:46:23.925 INFO 24345 --- [nio-8081-exec-3] org.apache.seata.service.StorageService : Stock Service End ...

最终结果是:purchase运行失败,但是库存却减少了: mysql> select * from stock_tbl; +----+----------------+-------+ | id | commodity_code | count | +----+----------------+-------+ | 24 | C00321 | 98 | +----+----------------+-------+

ptyin commented 5 months ago
  1. BussinessService is just an action trigger. What it does is to wrap RPC calls with @GlobalTransactional. In that case, there is no need for special configuration in XA mode.
  2. You are right. We need to fix it.
  3. You are right. AccountService, OrderSevice and StorageService are not binding the global transaction

Thank you for raising it. I would fix those issues.

cwqbupt commented 5 months ago

为这响应速度点赞!

cwqbupt commented 5 months ago

还有个小问题,配置中的:spring.datasource.url=jdbc:mysql://127.0.0.1:3306/seata?userSSL=false&useUnicode=true&characterEncoding=UTF8 userSSL拼写错误,应该是useSSL