8000 SAGA任务在超过timeLimit后放弃回滚 · Issue #538 · dtm-labs/dtm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SAGA任务在超过timeLimit后放弃回滚 #538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MilliumOrion opened this issue Dec 16, 2024 · 1 comment
Open

SAGA任务在超过timeLimit后放弃回滚 #538

MilliumOrion opened this issue Dec 16, 2024 · 1 comment

Comments

8000
@MilliumOrion
Copy link
	if t.Status == dtmcli.StatusAborting {
		prepareToCompensate()
	}
	for time.Now().Before(timeLimit) && t.Status == dtmcli.StatusAborting {
		toRun := pickToRunCompensates()
		runBranches(toRun)
		if rsCDone == rsCToStart { // no branch is running, so break
			break
		}
		logger.Debugf("rsCDone: %d rsCToStart: %d", rsCDone, rsCToStart)
		waitDoneOnce()
	}
	if t.Status == dtmcli.StatusAborting && rsCToStart == rsCSucceed {
		t.changeStatus(dtmcli.StatusFailed)
	}

我正在阅读DTM的源码。
我发现在dtmsvr/trans_type_saga.go中处理sage任务时,如果任务状态被标记为StatusAborting则会执行回滚。
但在执行前会判断整个Submit请求是否超时committime.Now().Before(timeLimit)
如果超时就会放弃执行回滚操作

这里让我非常地困惑,不知道是我理解出现了偏差,还是设计如此,亦或是有其他额外的重试机制。

@yedf2
Copy link
Contributor
yedf2 commented Feb 4, 2025

这个并不是放弃回滚操作,而是说如果这一次运行超过了时间,那么这次不再继续处理这个事务,等待下一次到时间再尝试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0