hmily icon indicating copy to clipboard operation
hmily copied to clipboard

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

Open jingzhouzhao opened this issue 3 years ago • 0 comments

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

jingzhouzhao avatar Jun 24 '21 08:06 jingzhouzhao