Skip to content
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

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

Open
MilliumOrion opened this issue Dec 16, 2024 · 0 comments
Open

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

MilliumOrion opened this issue Dec 16, 2024 · 0 comments

Comments

@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)
如果超时就会放弃执行回滚操作

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

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

1 participant