Re: Persist slot invalidations before publishing them

From: Rui Zhao <zhaorui126(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, JoongHyuk Shin <sjh910805(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Persist slot invalidations before publishing them
Date: 2026-09-25 16:18:00
Message-ID: CAHWVJhHNt2vUs6xBPZ9c+sh1HjLroC032+qKjN+_qh+bvc_M4Q@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thom Brown 2026-09-25 16:28:12 REPACK (CONCURRENTLY) can lose data in pg_dump output
Previous Message ZizhuanLiu X-MAN 2026-09-25 16:05:34 Re: Optimize MCV stats for sortable types and utilize sorted-order properties