From: hubert depesz lubaczewski <depesz@depesz.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: How can I change replication slot's restart_lsn from SQL?
Date: Tue, 16 May 2023 19:35:20 +0200
Message-ID: <ZGO+2JzKJ4xRqxJK@depesz.com> (raw)
In-Reply-To: <ZGORxidIQbYlZObB@depesz.com>
References: <ZGORxidIQbYlZObB@depesz.com>
On Tue, May 16, 2023 at 04:23:02PM +0200, hubert depesz lubaczewski wrote:
> Hi,
> I'm working on a workaround for a bug in Pg
> (https://www.postgresql.org/message-id/flat/Yz2hivgyjS1RfMKs%40depesz.com)
> I want to create replication slot, and advance is manually, keeping it
> always a bit lagging behind real replication slot.
>
> I can create slot, no problem:
> select pg_create_logical_replication_slot('depesz', 'test_decoding');
> and then I can, theoretically, advance it to whatever position with
> select * from pg_replication_slot_advance('depesz', '...');
>
> *BUT* - it changes only confirmed_flush_lsn, leaving restart_lsn as it
> was.
>
> How can I advance restart_lsn of a slot?
>
> Generally my idea is to get lsn from real replication slot, subtract,
> let's say 1GB from it, and advance my "fake slot" to this value, this
> keeping always buffer of 1GB in case the bug with removed wal happened
> again.
>
> I will be doing this on Pg12, which can limit my options, but perhaps
> there is some way to do it via plain(ish) SQL ?
Hi,
if doing it via SQL is not an option, is there any way to have
replication slot and modify it's restart_lsn, regardless of whether it
will b e physical, or logical, and what tool shoudl I use.
I tried with pg_recvlogical, and read
https://www.postgresql.org/docs/current/protocol-replication.html but
I don't see how I can make restart_lsn advance to anything.
Best regards,
depesz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: depesz@depesz.com
Subject: Re: How can I change replication slot's restart_lsn from SQL?
In-Reply-To: <ZGO+2JzKJ4xRqxJK@depesz.com>
References: <ZGORxidIQbYlZObB@depesz.com> <ZGO+2JzKJ4xRqxJK@depesz.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox