apache / apache/incubator-seata

Seata SAGA模式提示:seata_state_machine_inst.PRIMARY

Open
#6,489 5 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

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
使用Seata时,SAGA模式。一个接口比如创建订单,前一个创建订单请求,由于特殊场景(比如在扣库存请求失败时库存服务重启,或者处理事务时服务重启)导致事务处理失败。后面的创建订单请求,无法正常进行事务处理,会提示状态机实例表(seata_state_machine_inst)主键冲突。理论上,一个新的请求,应该有一个全新的全局事务id(xid),为何会出现此问题?

### Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

```
Record statemachine start error: [10000] [Unknown error] [Internal error], StateMachine: CreateOrder, XID: 172.23.0.244:8091:524592202459856896, Reason: Duplicate entry '172.23.0.244:8091:524592202459856896' for key 'seata_state_machine_inst.PRIMARY'

```

### Ⅲ. Describe what you expected to happen
提示上面的错误,是使用seata时,使用了相同的全局事务id。导致了插入数据库表:seata_state_machine_inst,提示主键冲突。期望应该不会出现生成重复的全局事务id,能正常进行分布式事务处理。

### Ⅳ. How to reproduce it (as minimally and precisely as possible)

Minimal yet complete reproducer code (or URL to code):

### Ⅴ. Anything else we need to know?
希望可以解释一下出现这种问题的原因,在不升级seata版本的前提下,能够修复或者避免出现此类情况。

### Ⅵ. Environment:

- JDK version(e.g. `java -version`): 1.8
- Seata client/server version: 1.4.1
- Database version: mysql 8.0.25
- OS(e.g. `uname -a`): Linux 4.19.91-26.al7.x86_64
- Others:

Contributor guide

Open the contributing guide

Research direction

Start with the reported SAGA failure involving seata_state_machine_inst and the duplicate XID, using the Seata 1.4.1, JDK 1.8, MySQL 8.0.25, and Linux environment described here. No reproducer, source file, or test is provided; done means explaining why a later request reuses the XID and identifying a way to avoid or fix the primary-key conflict without upgrading Seata.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.