apache / apache/incubator-seata

使用AT的全局事务和本地事务共存时,回滚失败的问题

Open
#5,416 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

seata事务模式:AT

账户服务,提供扣减账户余额的接口。只加普通事务(@Transactional)
订单服务,提供下单接口,增加seata全局事务(@GlobalTransactional)。代码逻辑如下
1. 开启全局事务
2. 调用账户服务扣余额
3. 休眠3秒钟,模拟服务hang住了
4. 生成订单数据
5. int i = 1/0;模拟服务异常需要回滚
6. 提交事务

操作流程:
1. 调用订单服务下单接口(扣减账户余额100元)
2. 观察账户服务日志,发现第1步调用账户扣减成功后,再直接调用账户的扣减账户余额接口,扣减200元。因为账户服务只有本地事务,所以能快速成功。

结果:
账户服务用户实际扣了300元。
订单服务显示数据回滚失败,再次请求下单接口,报错:get global lock fail
账户服务一直打印回滚失败的错误日志

麻烦看一下这个问题, 谢谢。

Contributor guide

Open the contributing guide

Research direction

Reproduce the AT scenario with the account service using @Transactional and the order service using @GlobalTransactional: debit 100, wait three seconds, create the order, then trigger the reported failure while a separate 200-unit debit runs. Start by tracing the account and order service transaction logs. Done means the rollback result and subsequent global-lock behavior are explained and the reported failure is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.