Two-phase commit in session 6.1.6 in EJB in Action (2nd edition)
posted 1 year ago
In session 6.1.6, it says
In the first phrase, the transaction manager polls resource manager asking them if they are ready to commit. If all of the resource managers reply affirmatively, the transaction manager then issues a commit message to each resource manager. If any one of the resource managers responds negatively, the transaction is rolled back. Each resource manager is responsible for maintaining a transaction log....
In Figure 6.3, it shows phase 1 (voting phase),
each database reports back to the transaction manager that changes can be persisted. In phase 2 (commit phase), the transaction manager tells the individual database to commit.
In quote 1, the resource manager is involved. But in quote 2, there is no resource manager shown in the figure.
So, which statement is correct?
In my opinion, I think quote 2 is correct. The transaction manager interacts directly with the database, commit the changes or roll back to the original state.
If we use quote 1, the transaction manager has to interact with the resource manager, which takes longer time to commit or roll back. This may affect the performance.