Re: Issue with logical replication slot during switchover

From: Alexander Kukushkin <cyberdemn(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Fabrice Chapuis <fabrice636861(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Subject: Re: Issue with logical replication slot during switchover
Date: 2025-11-13 13:08:54
Message-ID: CAFh8B==6GzSt_8eSuZdPcmeH9xackqOsYfQKVbRcWGKtXYkNfQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

But the system can die/crash before shutdown.

You mean it will not write WAL?
When a logical replication slot is created we build a snapshot and also
write to WAL:
postgres=# select pg_current_wal_insert_lsn(); select
pg_create_logical_replication_slot('foo', 'pgoutput'); select
pg_current_wal_insert_lsn();
pg_current_wal_insert_lsn
---------------------------
0/37F96F8
(1 row)

pg_create_logical_replication_slot
------------------------------------
(foo,0/37F9730)
(1 row)

pg_current_wal_insert_lsn
---------------------------
0/37F9730
(1 row)

Only after that slot is marked as persistent.

Regards,
--
Alexander Kukushkin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-11-13 13:57:52 Re: pg_getaddrinfo_all() with hintp=NULL
Previous Message Álvaro Herrera 2025-11-13 12:55:01 Re: Consistently use the XLogRecPtrIsInvalid() macro