Interviewer: How to solve the suspension problem in TCC?
Hanging means that for a distributed transaction, the second-stage Cancel interface executes before the Try interface.
The reason for this is that when a branch transaction Try is called, TM notifies RM to roll back the distributed transaction because of a time-out due to network congestion, and it is possible that the rollback is complete before the Try request reaches the participant for real execution, the business resources reserved by a Try method can only be used by the distributed transaction, and the business resources reserved by the first stage of the distributed transaction can no longer be handled by anyone, we call this suspension, where a business resource is reserved and can not be processed further.
The idea is that if phase 2 execution is complete, then that phase can not continue. Judgment during the execution of a phase transaction under the global transaction, judgment
Recommended reading: