Two-Phase Commit
The term two-phase commit comes from the fact that there are two phases to committing a distributed transaction where two or more databases are updated. The two phases consist of:
• Agreement between all sites to commit
• Committing the updates
Star manages these two phases in the following way:
Phase 1
Phase 1 begins when the user issues a commit statement. Ingres Star sends a prepare-to-commit notice to each database involved in the distributed transaction. If all databases indicate that they are prepared to commit, Ingres Star makes the decision to commit the transaction. The local databases remain in the prepare-to-commit state and wait for Ingres Star's instruction to commit.
Phase 2
Ingres Star sends a commit to all sites involved in the transaction. Ingres Star guarantees that all sites will commit.
If the connection to a local database is lost between the time that Ingres Star decides to commit and the time the local database actually obeys that instruction, Ingres Star keeps trying to complete the transaction until the connection is restored and the commit is made. Ingres Star does not return control to the end user until all nodes have committed.
Note: Notes:
• If any part of Phase 1 fails, for example, if Ingres Star loses a network connection to a node before all databases are prepared to commit, Ingres Star rolls back the transaction at all sites, including those that are already prepared to commit.
• If any part of Phase 2 fails, Ingres Star still eventually commits the transaction.
Last modified date: 08/28/2024