TCC mode

A distributed global transaction, the whole is a two-phase commit model. A global transaction is composed of several branch transactions. The branch transactions must meet the requirements of the two-phase commit model, that is, each branch transaction needs to have its own:

One stage, prepare behavior.

Phase two, commit or rollback behavior.

Branch transactions are divided into Automatic (Branch) Transaction Mode and Manual (Branch) Transaction Mode according to the different behavior modes of the two phases.

AT mode is based on a relational database that supports native ACID transactions: .

One-stage prepare behavior: In the local transaction, the business data update and the corresponding rollback log records are submitted together. .

Two-stage commit behavior: it will end successfully immediately, and the rollback logs will be automatically and asynchronously cleaned up in batches.

Two-stage rollback behavior: by rolling back logs, compensation operations are automatically generated to complete data rollback.

Correspondingly, the TCC mode does not depend on the transaction support of the underlying data resources:

One-stage prepare behavior: call custom prepare logic.

Two-phase commit behavior: call custom commit logic.

Two-stage rollback behavior: call custom rollback logic.

The so-called TCC mode refers to the support for incorporating custom branch transactions into the management of global transactions.

Last updated