From: | Gurjeet Singh <gurjeet(at)singh(dot)im> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de> |
Cc: | "Duran, Danilo" <danilod(at)amazon(dot)com>, "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: replication slot restart_lsn initialization |
Date: | 2015-06-10 15:00:28 |
Message-ID: | CABwTF4VZR0E-CGCCT=-uuB+=Eau_8h4-BYn7L2DBWDNNduwiVw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, May 5, 2015 at 5:53 PM, Andres Freund <andres(at)anarazel(dot)de> 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 restart_lsn at slot creation?
>
> I've been wondering about allowing for the latter alternative. I could
> have used it a couple times. The former doesn't make much sense to me,
> it could be too far *ahead* in many cases actually. A patch for this
> would be fairly trivial.
>
Attached is the patch that takes the former approach (initialize
restart_lsn when the slot is created). I think it's better than the latter
approach (depend on user to specify an LSN) because the LSN user specifies
may have already been recycled. 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. So I have
used the same approach.
The function pg_create_physical_replication_slot() now has an additional
boolean parameter 'activate' which user can use to allocate restart_lsn as
part of the creation process.
Best regards,
--
Gurjeet Singh http://gurjeet.singh.im/
Attachment | Content-Type | Size |
---|---|---|
physical_repl_slot_activate_restart_lsn.patch | application/octet-stream | 8.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-06-10 15:01:25 | Re: s_lock() seems too aggressive for machines with many sockets |
Previous Message | Robert Haas | 2015-06-10 14:59:33 | Re: s_lock() seems too aggressive for machines with many sockets |