Re: 2-phase commit - Mailing list pgsql-hackers

From Tom Lane
Subject Re: 2-phase commit
Date
Msg-id 24759.1064849973@sss.pgh.pa.us
Whole thread Raw
In response to Re: 2-phase commit  (Hiroshi Inoue <Inoue@tpf.co.jp>)
List pgsql-hackers
Hiroshi Inoue <Inoue@tpf.co.jp> writes:
> But is it 2-phase commit protocol in the first place ?

> That is, in your exmaple below

>  Example:

>         Master          Slave
>         ------          -----
>         commit ready-->
>                         <--OK
>         commit done->XX

> is the "commit done" message needed ?

Absolutely --- otherwise, we'd not be having this whole discussion.  The
problem is that the slave is holding ready to commit but doesn't know
whether he should or not ... or alternatively, he did commit but the
master didn't get the acknowledgement.

It's not that big a deal for the master to remember past committed
transactions until it knows all slaves have acknowledged committing
them; you only need a bit or so per transaction.  It's a much bigger
deal if the slave has to hold the transaction ready-to-commit for a
long time.  That transaction is holding locks, and also the sheer
volume of log data is way bigger.  (For comparison, we recycle pg_xlog
details about a transaction much sooner than we recycle pg_clog.)

I think you really want some way for the slave to decide it can time out
and abort the transaction after all ... but I don't see how you do
that without breaking the 2PC protocol.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_dump no longer honors --no-reconnect
Next
From: Jan Wieck
Date:
Subject: Re: [ADMIN] postgres 6.2 vacuum