Re: [HACKERS] replication slot restart_lsn initialization

2015-09-06 Thread Michael Paquier
On Sun, Sep 6, 2015 at 8:32 PM, Andres Freund wrote: > [fixes] > > Committed, thanks for the patch. > Visibly I missed one/two things when hacking out this stuff. Thanks for the extra cleanup and the commit. -- Michael

Re: [HACKERS] replication slot restart_lsn initialization

2015-09-06 Thread Andres Freund
On 2015-08-15 21:16:11 +0900, Michael Paquier wrote: > Well, this has taken less time than I thought: > =# CREATE_REPLICATION_SLOT toto PHYSICAL; > slot_name | consistent_point | snapshot_name | output_plugin > ---+--+---+--- > toto | 0/0

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-17 Thread Michael Paquier
On Tue, Aug 18, 2015 at 4:46 AM, Andres Freund wrote: > On 2015-08-17 15:22:44 -0400, Peter Eisentraut wrote: >> On 8/14/15 3:54 AM, Andres Freund wrote: >> > I'd name it RESERVE_WAL. > >> Why "reserve"? > Isn't it "preserve"? > > Hm. I honestly do not know. I was thinking of ticket reservations..

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-17 Thread Andres Freund
On 2015-08-17 15:22:44 -0400, Peter Eisentraut wrote: > On 8/14/15 3:54 AM, Andres Freund wrote: > > I'd name it RESERVE_WAL. > Why "reserve"? > Isn't it "preserve"? Hm. I honestly do not know. I was thinking of ticket reservations... -- Sent via pgsql-hackers mailing list (pgsql-hackers@post

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-17 Thread Peter Eisentraut
On 8/14/15 3:54 AM, Andres Freund wrote: > I'd name it RESERVE_WAL. My feeling is that the options for the logical > case are geared towards the output plugin, not the walsender. I think > it'd be confusing to use (slot_options) differently for physical slots. Why "reserve"? Isn't it "preserve"?

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-15 Thread Michael Paquier
On Fri, Aug 14, 2015 at 4:54 PM, Andres Freund wrote: > On 2015-08-14 16:44:44 +0900, Michael Paquier wrote: >> Commit 6fcd8851, which is the result of this thread, is not touching >> the replication protocol at all. This looks like an oversight to me: >> we should be a maximum consistent between

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-14 Thread Andres Freund
On 2015-08-14 11:09:38 +0200, Shulgin, Oleksandr wrote: > Yes, but the options list you pass to START_REPLICATION ... LOGICAL, not to > CREATE_REPLICATION_SLOT. I know, but we might want to extend that at some point. - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-14 Thread Shulgin, Oleksandr
On Fri, Aug 14, 2015 at 9:54 AM, Andres Freund wrote: > On 2015-08-14 16:44:44 +0900, Michael Paquier wrote: > > Commit 6fcd8851, which is the result of this thread, is not touching > > the replication protocol at all. This looks like an oversight to me: > > we should be a maximum consistent betw

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-14 Thread Andres Freund
On 2015-08-14 16:44:44 +0900, Michael Paquier wrote: > Commit 6fcd8851, which is the result of this thread, is not touching > the replication protocol at all. This looks like an oversight to me: > we should be a maximum consistent between the SQL interface and the > replication protocol if possible

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-14 Thread Michael Paquier
On Wed, Aug 12, 2015 at 8:20 AM, Andres Freund wrote: > On 2015-08-11 15:59:59 -0700, Gurjeet Singh wrote: >> In your version, I don't see a comment that refers to the fact that it >> works on the currently active (global variable) slot. > > Hm? > > /* > * Reserve WAL for the currently active slo

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-11 Thread Andres Freund
On 2015-08-11 15:59:59 -0700, Gurjeet Singh wrote: > In your version, I don't see a comment that refers to the fact that it > works on the currently active (global variable) slot. Hm? /* * Reserve WAL for the currently active slot. * * Compute and set restart_lsn in a manner that's appropriate

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-11 Thread Gurjeet Singh
On Mon, Aug 10, 2015 at 7:12 AM, Andres Freund wrote: > On 2015-07-07 09:42:54 -0700, Gurjeet Singh wrote: > > /* > > + * Grab and save an LSN value to prevent WAL recycling past that point. > > + */ > > +void > > +ReplicationSlotRegisterRestartLSN() > > +{ > > Didn't like that description and f

Re: [HACKERS] replication slot restart_lsn initialization

2015-08-10 Thread Andres Freund
On 2015-07-07 09:42:54 -0700, Gurjeet Singh wrote: > --- a/src/backend/replication/slot.c > +++ b/src/backend/replication/slot.c > @@ -40,10 +40,10 @@ > #include > > #include "access/transam.h" > +#include "access/xlog_internal.h" > #include "common/string.h" > #include "miscadmin.h" > #inc

Re: [HACKERS] replication slot restart_lsn initialization

2015-07-07 Thread Andres Freund
On 2015-07-07 09:42:54 -0700, Gurjeet Singh wrote: > On a side note, I see that the pg_create_*_replication_slot() functions do > not behave transactionally; that is, rolling back a transaction does not > undo the slot creation. It can't, because otherwise you couldn't run them on a standby. > Sh

Re: [HACKERS] replication slot restart_lsn initialization

2015-07-07 Thread Gurjeet Singh
On Tue, Jul 7, 2015 at 6:49 AM, Andres Freund wrote: > On 2015-07-07 06:41:55 -0700, Gurjeet Singh wrote: > > There seems to be a misplaced not operator ! in that if statement, as > > well. That sucks :( The MacOS gcc binary is actually clang, and its > output > > is too noisy [1], which is prob

Re: [HACKERS] replication slot restart_lsn initialization

2015-07-07 Thread Andres Freund
On 2015-07-07 06:41:55 -0700, Gurjeet Singh wrote: > There seems to be a misplaced not operator ! in that if statement, as > well. That sucks :( The MacOS gcc binary is actually clang, and its output > is too noisy [1], which is probably why I might have missed warning if any. Which version of cl

Re: [HACKERS] replication slot restart_lsn initialization

2015-07-07 Thread Gurjeet Singh
On Tue, Jul 7, 2015 at 4:59 AM, Andres Freund wrote: > On 2015-06-10 13:13:41 -0700, Gurjeet Singh wrote: > > + /* > > + * Log an xid snapshot for logical replication. > It's not needed for > > + * physical slots as it is done in BGWri

Re: [HACKERS] replication slot restart_lsn initialization

2015-07-07 Thread Andres Freund
On 2015-06-10 13:13:41 -0700, Gurjeet Singh wrote: > /* > + * Grab and save an LSN value to prevent WAL recycling past that point. > + */ > +void > +ReplicationSlotRegisterRestartLSN() > +{ > + ReplicationSlot *slot = MyReplicationSlot; > + > + Assert(slot != NULL); > + Assert(slot->da

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Gurjeet Singh
On Wed, Jun 10, 2015 at 9:10 AM, Gurjeet Singh wrote: > > I am in the process of writing up a doc patch, and will submit that as > well in a short while. > Please find attached the patch with the doc update. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ physical_repl_slot_activate_

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Gurjeet Singh
On Wed, Jun 10, 2015 at 8:36 AM, Andres Freund wrote: > On 2015-06-10 08:24:23 -0700, Gurjeet Singh wrote: > > On Wed, Jun 10, 2015 at 8:07 AM, Andres Freund > wrote: > > > That doesn't look right to me. Why is this code logging a standby > > > snapshot for physical slots? > > > > > > > This is

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Andres Freund
On 2015-06-10 08:24:23 -0700, Gurjeet Singh wrote: > On Wed, Jun 10, 2015 at 8:07 AM, Andres Freund wrote: > > That doesn't look right to me. Why is this code logging a standby > > snapshot for physical slots? > > > > This is the new function I referred to above. The logging of the snapshot > is

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Gurjeet Singh
On Wed, Jun 10, 2015 at 8:07 AM, Andres Freund wrote: > On 2015-06-10 08:00:28 -0700, Gurjeet Singh wrote: > > > pg_create_logical_replication_slot() prevents LSN from being > > recycled that by looping (worst case 2 times) until there's no > > conflict with the checkpointer recycling the segment

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Andres Freund
On 2015-06-10 08:00:28 -0700, Gurjeet Singh wrote: > Attached is the patch that takes the former approach (initialize > restart_lsn when the slot is created). If it's an option that's imo a sane approach. > pg_create_logical_replication_slot() prevents LSN from being > recycled that by looping (w

Re: [HACKERS] replication slot restart_lsn initialization

2015-06-10 Thread Gurjeet Singh
On Tue, May 5, 2015 at 5:53 PM, Andres Freund wrote: > > > Was there any consideration for initializing restart_lsn to the latest > > WAL write pointer when a slot is created? Or for allowing an optional > > parameter in pg_create_(physical|logical)_replication_slot() for > > specifying the resta

Re: [HACKERS] replication slot restart_lsn initialization

2015-05-05 Thread Andres Freund
Hi, On 2015-05-06 00:42:14 +, Duran, Danilo wrote: > I am looking to better understand the thought behind a replication > slot's restart_lsn initialization. Currently in 9.4 and master, a > replication slot's restart_lsn is set to InvalidXLogRecPtr and will > only start tracking restart_lsn on