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

如果updateStartStatus失败是否会导致事务悬挂? #318

Open
jingzhouzhao opened this issue Jun 24, 2021 · 0 comments
Open

如果updateStartStatus失败是否会导致事务悬挂? #318

jingzhouzhao opened this issue Jun 24, 2021 · 0 comments

Comments

@jingzhouzhao
Copy link

HmilyTransaction hmilyTransaction = executor.preTry(point);
try {
//execute try
returnValue = point.proceed();
hmilyTransaction.setStatus(HmilyActionEnum.TRYING.getCode());
//假设执行到此处宕机,此时Transaction 和 Participant status应该还是PRE_TRY?
executor.updateStartStatus(hmilyTransaction);

然后在Recovery时:
for (HmilyParticipant hmilyParticipant : hmilyParticipantList) {
....
这里判断是PRE_TRY,直接continue
if (hmilyParticipant.getStatus() == HmilyActionEnum.PRE_TRY.getCode()) {
//try not complete
continue;
}
final boolean successful = hmilyRepository.lockHmilyParticipant(hmilyParticipant);
// determine that rows > 0 is executed to prevent concurrency when the business side is in cluster mode
if (successful) {
LOGGER.info("hmily tcc transaction begin self recovery: {}", hmilyParticipant.toString());
HmilyTransaction globalHmilyTransaction = hmilyRepository.findByTransId(hmilyParticipant.getTransId());
if (Objects.isNull(globalHmilyTransaction)) {
tccRecovery(hmilyParticipant.getStatus(), hmilyParticipant);
} else {
//这里transaction状态也是PRE_TRY?
tccRecovery(globalHmilyTransaction.getStatus(), hmilyParticipant);
}
}
}

   最后没cancel,也没commit,悬挂了?
   
   不知道理解对不对。可能还有其他地方没看到。         
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