| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | Alexander Kukushkin <cyberdemn(at)gmail(dot)com> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Fabrice Chapuis <fabrice636861(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>, shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Subject: | Re: Issue with logical replication slot during switchover |
| Date: | 2025-11-14 03:15:47 |
| Message-ID: | CAJpy0uBkF9OiXvb3ob=h5uS_y_NUCP5S7=ySyeYdaE5JXZfkNA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, Nov 13, 2025 at 6:39 PM Alexander Kukushkin <cyberdemn(at)gmail(dot)com> wrote:
>
>
>
>> 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.
>
There can be a scenario where a replication slot is dropped and
recreated, and its WAL is also replicated to the standby. However,
before the new slot state can be synchronized via slotsync, the
primary crashes and the standby is promoted. Later, the user manually
reconfigures the old primary to follow the newly promoted standby (no
pg-rewind in play). I was wondering whether in such a case, would it
be a good idea to overwrite the newly created slot on old primary with
promoted-standby's synced slot (old one) by default? Thoughts?
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ajin Cherian | 2025-11-14 03:17:31 | Re: Add support for COPY TO in tablesync for partitioned tables. |
| Previous Message | 段坤仁 (刻韧) | 2025-11-14 02:25:54 | 回复:回复:another autovacuum scheduling thread |