Jump to content

Two-phase commit

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 194.72.110.12 (talk) at 11:13, 1 April 2004. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

A commit operation is an operation that is all or nothing.

A two phase commit allows data to be written to more than location and for all operations to be rolled back, if one or more of the operation fails.

It does this using a two-phase commit.

Basically....

Phase 1 Each participants resource manager coordinates local operations If successful

 respond "OK" 

If unsuccessful

 either allow a time-out or respond "NOT OK" 

Phase 2 If all participants respond "OK":

 Coordinator instructs participating resource managers to "COMMIT" 
 Participants complete operation

Otherwise:

 Coordinator instructs participating resource managers to "ROLLBACK" 
 Participants complete their respective local undos