replication slot restart_lsn initialization

From: "Duran, Danilo" <danilod(at)amazon(dot)com>
To: "robertmhaas(at)gmail(dot)com" <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: replication slot restart_lsn initialization
Date: 2015-05-06 00:42:14
Message-ID: B8D538AC5587C84898B261FCB8C7D8A41FDE1017@ex10-mbx-36009.ant.amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

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 once a walreceiver has confirmed receipt of an lsn.

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 believe there are valid usage patterns where the user would like to start holding transaction logs from being removed/recycled during the time that the standby is being restored from base backup. Currently this can be worked around by using pg_receivexlog immediately after creating the replication slot but it feels kind of hacky.

It is also strange that the return type for pg_create_(physical|logical)_replication_slot includes xlog_position but as far as I can tell, it will never contain a value. Is this intended for something in the future?

Thanks,
Danilo

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-05-06 00:53:23 Re: replication slot restart_lsn initialization
Previous Message Andreas Karlsson 2015-05-05 22:53:41 Re: BRIN range operator class