Re: 2-phase commit

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Andrew Sullivan <andrew(at)libertyrms(dot)info>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 2-phase commit
Date: 2003-09-29 18:56:44
Message-ID: Pine.LNX.4.44.0309292047430.24925-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers

Tom Lane writes:

> No. The real problem with 2PC in my mind is that its failure modes
> occur *after* you have promised commit to one or more parties. In
> multi-master, if you fail you know it before you have told the client
> his data is committed.

I have a book here which claims that the solution to the problems of
2-phase commit is 3-phase commit, which goes something like this:

coordinator participant
----------- -----------
INITIAL INITIAL
prepare -->
WAIT
<-- vote commit
READY
(all voted commit)
prepare-to-commit -->
PRE-COMMIT
<-- ready-to-commit
PRE-COMMIT
global-commit -->
COMMIT COMMIT

If the coordinator fails and all participants are in state READY, they can
safely decide to abort after some timeout. If some participant is already
in state PRE-COMMIT, it becomes the new coordinator and sends the
global-commit message.

Details are left as an exercise. :-)

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-advocacy by date

  From Date Subject
Next Message Manfred Spraul 2003-09-29 19:35:26 Re: 2-phase commit
Previous Message Marc G. Fournier 2003-09-28 00:51:37 Re: [CORE] PostgreSQL conferences

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-09-29 18:57:58 7.4 status
Previous Message Rod Taylor 2003-09-29 18:50:56 Re: 2-phase commit