RE: Newly created replication slot may be invalidated by checkpoint

Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>

From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Amit Kapila' <amit.kapila16@gmail.com>
Cc: Vitaly Davydov <v.davydov@postgrespro.ru>, suyu.cmj <mengjuan.cmj@alibaba-inc.com>, tomas <tomas@vondra.me>, michael <michael@paquier.xyz>, bharath.rupireddyforpostgres <bharath.rupireddyforpostgres@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, Alexander Korotkov <aekorotkov@gmail.com>
Date: 2025-11-11T04:03:11Z
Lists: pgsql-hackers

Attachments

Dear Amit,

> We need to check whether a similar change is required in
> reserve_wal_for_local_slot() as well for sync slots.

Good point. I confirmed similar issue could happen while synchronizing slots.
PSA the reproducer.

0001-PG17... patch simulates the issue that WAL segments were discarded in-between
slot's restart_lsn is set and the pointed record is being protected. Can be
applied atop PG17.
0001-HEAD... patch simulates the issue that restart_lsn obtained from primary is
discarded on standby. This can be applied atop HEAD.

Best regards,
Hayato Kuroda
FUJITSU LIMITED