From: Laurenz Albe <laurenz.albe@cybertec.at>
To: depesz@depesz.com
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: How can I change replication slot's restart_lsn from SQL?
Date: Wed, 17 May 2023 15:32:09 +0200
Message-ID: <98dbe2183e75f5527cb43815aa57b745012a5ed6.camel@cybertec.at> (raw)
In-Reply-To: <ZGRyXYfkj0G6xdon@depesz.com>
References: <ZGORxidIQbYlZObB@depesz.com>
<ZGO+2JzKJ4xRqxJK@depesz.com>
<fec2f1b6fd59ead3bb495be039b2785cc4c11810.camel@cybertec.at>
<ZGRyXYfkj0G6xdon@depesz.com>
On Wed, 2023-05-17 at 08:21 +0200, hubert depesz lubaczewski wrote:
> On Wed, May 17, 2023 at 08:16:41AM +0200, Laurenz Albe wrote:
> > On Tue, 2023-05-16 at 19:35 +0200, hubert depesz lubaczewski wrote:
> > > > 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.
> > > >
> > > > How can I advance restart_lsn of a slot?
> > >
> > > 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.
> >
> > You could shutdown the server and edit the file in "pg_replslot" with
> > a hex editor. Not very convenient, and you'd have to study the source
> > to understand the format of the file.
>
> OK. Shutting down production server every 5 minutes to advance the slot
> isn't really an option.
>
> How do "normal" wal consumers update restart_lsn? Is there a reason why
> it can't be done using pg_rec(eive|v)* ?
I thought that was a one-time operation. No idea if there are alternatives.
Yours,
Laurenz Albe
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: laurenz.albe@cybertec.at, depesz@depesz.com
Subject: Re: How can I change replication slot's restart_lsn from SQL?
In-Reply-To: <98dbe2183e75f5527cb43815aa57b745012a5ed6.camel@cybertec.at>
References: <ZGORxidIQbYlZObB@depesz.com> <ZGO+2JzKJ4xRqxJK@depesz.com> <fec2f1b6fd59ead3bb495be039b2785cc4c11810.camel@cybertec.at> <ZGRyXYfkj0G6xdon@depesz.com> <98dbe2183e75f5527cb43815aa57b745012a5ed6.camel@cybertec.at>
* 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