Re: Persist slot invalidations before publishing them - Mailing list pgsql-hackers

From Rui Zhao
Subject Re: Persist slot invalidations before publishing them
Date
Msg-id CAHWVJhHNt2vUs6xBPZ9c+sh1HjLroC032+qKjN+_qh+bvc_M4Q@mail.gmail.com
Whole thread
In response to Re: Persist slot invalidations before publishing them  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
On 2026-Sep-25 at 05:54 UTC, Bertrand Drouvot wrote:
> ReplicationSlotPersistInvalidation() has a narrower contract and is only
> intended for persistent or temporary slots.

Since this function also handles temporary slots, could we qualify
the following sentence in 0002's commit message?

> A failed save now leaves the local slot valid, allowing the next
> synchronization to retry.

Could we change that to:

    A failed save now leaves a persistent local slot valid, allowing the
    next synchronization to retry.

I suggest adding "persistent" because SQL error cleanup deletes
temporary synchronized slots. In my v6 test:

1. I ran pg_sync_replication_slots() on the standby. The local
   pending_slot remained temporary because the primary slot's
   restart_lsn was behind the standby slot's restart_lsn.

2. While that call was still running, I made
   pg_replslot/pending_slot/state.tmp a directory on the standby, then
   invalidated pending_slot on the primary (wal_removed).
   Synchronization then tried to save that invalidation on the standby.
   The save failed with "File exists", and error cleanup deleted the
   temporary slot.

3. I called pg_sync_replication_slots() again in the same connection.
   It completed without error but did not recreate pending_slot because
   the primary slot was already invalidated.

Regards,
Rui



pgsql-hackers by date:

Previous
From: "ZizhuanLiu X-MAN"
Date:
Subject: Re: Optimize MCV stats for sortable types and utilize sorted-order properties
Next
From: Thom Brown
Date:
Subject: REPACK (CONCURRENTLY) can lose data in pg_dump output