Reputation: 621
I am reading the SAGA pattern to solve the distributed transaction problem. Although the names of the concepts in SAGA are different from those in TCC(try-commit-cancel), I don't find essential different ideas between the 2 patterns.
Both TCC and SAGA rely on the local transaction, try/retry/cancel/commit of the local transaction to guarantee the whole transaction. Could somebody explain the key differences that differentiate the 2 patterns and make both models valuable?
I lean SAGA from this document:
https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/saga/saga
Upvotes: 1
Views: 2223
Reputation: 186
The key differences is the data visibility. If you use Saga to do a cross-bank transfer, then the client may see unexpected balance change if the transfer failed. But TCC can avoid that.
It is explained in detail in this article:
https://dev.to/yedf2/best-practice-for-tcc-distributed-transaction-in-go-402m
Upvotes: 2