apache / apache/incubator-seata

全局事务状态似乎永远无法进入到TimeoutRollbackRetrying

Open
#7,470 4 comments 0 reactions 1 assignee Claimed by @simzyoo View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

### Check Ahead

- [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.
https://github.com/apache/incubator-seata/issues/5293
我看这个issuce也提了这个问题,但是我在2.4版本上复现了这个问题,我在提交里也没看到相关的问题修复。这个问题确定得到修复了吗?

### Ⅰ. Issue Description

从代码来看,全局事务的状态要进入到TimeoutRollbackRetrying,路径如下:
a.从这里超时的全局事务状态从beigin 变成 TimeoutRollbacking

org.apache.seata.server.coordinator.DefaultCoordinator#init
```
timeoutCheck.scheduleAtFixedRate(
() -> SessionHolder.distributedLockAndExecute(TX_TIMEOUT_CHECK, this::timeoutCheck), 0,
TIMEOUT_RETRY_PERIOD, TimeUnit.MILLISECONDS);
```

b.然后下面这个定时任务会重试回滚处于TimeoutRollbacking状态的全局事务

org.apache.seata.server.coordinator.DefaultCoordinator#init
```
retryRollbacking.scheduleAtFixedRate(
() -> SessionHolder.distributedLockAndExecute(RETRY_ROLLBACKING, this::handleRetryRollbacking), 0,
ROLLBACKING_RETRY_PERIOD, TimeUnit.MILLISECONDS);
```

Image

c.下一步这里的处理和首次回滚处理复用了同一个方法,这里retry为true,全局事务的状态是没法转变成TimeoutRollbackRetrying的

org.apache.seata.server.coordinator.DefaultCore#doGlobalRollback

Image

我跑了一个例子验证,超时触发的回滚,server不断重试,但全局事务的状态仍然是TimeoutRollbacking,也就是我认为TimeoutRollbackRetrying目前是一个无法到达的全局事务状态。

### Ⅱ. Describe what happened

同上

### Ⅲ. Describe what you expected to happen

_No response_

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

_No response_

### Ⅴ. Anything else we need to know?

_No response_

### Ⅵ. Environment

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.