Re: Reporting the commit LSN at commit time

From: Greg Stark <stark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject: Re: Reporting the commit LSN at commit time
Date: 2014-08-18 19:05:09
Message-ID: CAM-w4HOzzqgwgfTnOjqOwkk4AJWmcVfjMzNf0isq4DuAM4oSnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15 Aug 2014 14:54, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-08-14 12:21:38 -0400, Robert Haas wrote:
> >> And what does that actually do? Send back a result-set, or a new
> >> protocol message?
>
> > What I was thinking of was to return "COMMIT X/X" instead of
> > "COMMIT". Since that's only sent when COMMIT WITH (report_commit_lsn ON)
> > was set it won't break clients/libraries that don't need it.
>
> Au contraire: it will break any piece of code that is expecting a COMMIT
> command tag to look like exactly "COMMIT" and not "COMMIT something".

Two comments. Firstly, we can't freeze everything forever. This seems like
it would be the least of people's issues to deal with for an upgrade. We
should search for the cleanest solution, not bolt on features for fear that
integrating them where they make the most sense might break someone's code
somewhere.

I fear putting out anywhere but in the commit message would have race
conditions. Having it in the commit message guarantees the client never has
to deal with strange states like " I know this transaction committed but I
know when" which would make clients vastly simpler.

But secondly there will *always* be race conditions in this. This is the
same problem as our hokey synchronous commit which commits transactions but
then hides them from the client. All it does is move the uncertainty around.

The long term solution will be something more like 2PC. At the beginning of
your transaction you get an identifier for the transaction and store that
in a transaction manager. The transaction manager knows how to determine
which transcribe are committed on which nodes and how to resolve conflicts.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-08-18 19:06:58 Re: Reporting the commit LSN at commit time
Previous Message Robert Haas 2014-08-18 18:12:57 Re: pg_shmem_allocations view