Re: Retrieve the snapshot's LSN

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Florent Guiliani <florent(at)guiliani(dot)fr>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Retrieve the snapshot's LSN
Date: 2015-07-16 16:54:49
Message-ID: 20150716165449.GR5520@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-07-16 12:40:07 -0400, Robert Haas wrote:
> On Wed, Jul 15, 2015 at 12:51 PM, Florent Guiliani <florent(at)guiliani(dot)fr> wrote:
> > During slot creation, the snapshot building and exporting code seems
> > highly coupled with the logical decoding stuff. It doesn't seems much
> > reusable to retrieve the snapshot's LSN outside of logical decoding.
>
> I don't think "the snapshot's LSN" has a well-defined meaning in
> general. The obvious meaning would be "the LSN such that all commits
> prior to that LSN are visible and all later commits are invisible",
> but such an LSN need not exist. Suppose A writes a commit record at
> LSN 0/10000, and then B writes a commit record at 0/10100, and then B
> calls ProcArrayEndTransaction(). At this point, B is visible and A is
> not visible, even though A's commit record precedes that of B.

Well, in combination with logical decoding it kinda has one: It should
allow you to take a dump of the database with a certain snapshot and
replay all transactions with a commit lsn bigger than the "snapshot's
lsn" and end up with a continually consistent database.

Visibility for HS actually works precisely in commit LSN order, even if
that is possibly different than on the primary...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-07-16 17:07:55 Re: RFC: replace pg_stat_activity.waiting with something more descriptive
Previous Message Alvaro Herrera 2015-07-16 16:42:07 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file