Re: Reporting the commit LSN at commit time

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reporting the commit LSN at commit time
Date: 2014-08-15 13:59:28
Message-ID: 20140815135928.GN28805@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-08-15 09:54:01 -0400, Tom Lane 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".

Well, if your code doesn't support it. Don't use it.

> The risk still remains, therefore, that one layer of the client-side
> software stack might try to enable this feature even though another
> layer is not prepared for it.

Well, then the user will have to fix that. It's not like the feature
will magically start to be used by itself.

One alternative would be to expose a pg_get_last_commit_lsn(); function
that'd return the the last commit's lsn stored in a static variable if
set. That'll increase the window in which the connection can break, but
that window already exists.

> And, again, I think that controlling this via something as widely
> changeable as a GUC is sheer folly, potentially even reaching the point
> of being a security bug. (Applications that fail to recognize when
> their transactions have committed would be broken in very nasty ways.)

*I*'ve never suggested making this depend on a guc. I think that'd a
major PITA.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Steve Singer 2014-08-15 14:08:06 Re: 9.4 logical decoding assertion
Previous Message Bruce Momjian 2014-08-15 13:58:33 Re: [PATCH] Fix search_path default value separator.