Re: 2-phase commit

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "'Zeugswetter Andreas SB SD'" <ZeugswetterA(at)spardat(dot)at>, "'Andrew Sullivan'" <andrew(at)libertyrms(dot)info>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: 2-phase commit
Date: 2003-09-29 15:39:33
Message-ID: 24759.1064849973@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2003-09-29 15:41:38 Re: [ADMIN] postgres 6.2 vacuum
Previous Message Bruce Momjian 2003-09-29 15:35:42 Re: pg_dump no longer honors --no-reconnect