Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-23 Thread Florent Guiliani
On Fri, Jul 17, 2015 at 6:53 PM, Robert Haas wrote: > On Fri, Jul 17, 2015 at 8:31 AM, Florent Guiliani wrote: >> A pg_export_snapshot_for_slot(...) would work very well. >> >> Let me explain the use case. You have many downstream systems that are >> replicated with logical decoding. Using a dedi

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-17 Thread Robert Haas
On Fri, Jul 17, 2015 at 8:31 AM, Florent Guiliani wrote: > A pg_export_snapshot_for_slot(...) would work very well. > > Let me explain the use case. You have many downstream systems that are > replicated with logical decoding. Using a dedicated replication slot > for each target is not practical.

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-17 Thread Florent Guiliani
On Thu, Jul 16, 2015 at 7:13 PM, Andres Freund wrote: > On 2015-07-16 13:08:48 -0400, Robert Haas wrote: >> On Thu, Jul 16, 2015 at 12:54 PM, Andres Freund wrote: >> > Well, in combination with logical decoding it kinda has one: It should >> > allow you to take a dump of the database with a certa

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-17 Thread Robert Haas
On Fri, Jul 17, 2015 at 4:16 AM, Florent Guiliani wrote: >> but such an LSN need not exist. Suppose A writes a commit record at >> LSN 0/1, 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 t

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-17 Thread Florent Guiliani
On Thu, Jul 16, 2015 at 6:40 PM, Robert Haas wrote: > 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", I like this definition. > but such

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-16 Thread Andres Freund
On 2015-07-16 13:08:48 -0400, Robert Haas wrote: > On Thu, Jul 16, 2015 at 12:54 PM, Andres Freund wrote: > > 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 ls

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-16 Thread Robert Haas
On Thu, Jul 16, 2015 at 12:54 PM, Andres Freund wrote: > 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 co

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-16 Thread Andres Freund
On 2015-07-16 12:40:07 -0400, Robert Haas wrote: > On Wed, Jul 15, 2015 at 12:51 PM, Florent Guiliani > 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

Re: [HACKERS] Retrieve the snapshot's LSN

2015-07-16 Thread Robert Haas
On Wed, Jul 15, 2015 at 12:51 PM, Florent Guiliani 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 snapsh

[HACKERS] Retrieve the snapshot's LSN

2015-07-15 Thread Florent Guiliani
Hello everyone, I would need to start a read repeatable transaction and retrieve the corresponding LSN. I'm looking for pointers or Ideas on how to achieve this. Andres F. suggested me to extend pg_export_snapshot() [1] and call GetLatestSnapshot() [2] while reliably retrieving the current LSN. S