Re: Improve pg_sync_replication_slots() to wait for primary to advance

Ajin Cherian <itsajin@gmail.com>

From: Ajin Cherian <itsajin@gmail.com>
To: shveta malik <shveta.malik@gmail.com>
Cc: Ashutosh Sharma <ashu.coek88@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2025-10-02T11:23:34Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Enhance slot synchronization API to respect promotion signal.

  2. Fix inconsistent elevel in pg_sync_replication_slots() retry logic.

  3. Refactor slot synchronization logic in slotsync.c.

  4. Fix intermittent BF failure in 040_standby_failover_slots_sync.

  5. Add retry logic to pg_sync_replication_slots().

  6. Fix LOCK_TIMEOUT handling in slotsync worker.

  7. Add slotsync skip statistics.

Attachments

On Fri, Sep 26, 2025 at 8:14 PM shveta malik <shveta.malik@gmail.com> wrote:
>
>
> It seems it is missed to be changed perhaps due to bringing back
> previous implementation of slotsync_api_reread_config()
>
> >
> > > b)
> > > There is double space in DETAIL msg: "have changed  since"
> > >
> > > Will it be better to shorten the DETAIL as: 'One or more of
> > > primary_conninfo, primary_slot_name, or hot_standby_feedback were
> > > modified.'
> > >
> >
> > Changed.
> >

Fixed.

>
> This too is missed.
>
> > > 6)
> > > postgres=# SELECT pg_sync_replication_slots();
> > > ERROR:  exiting from slot synchronization as promotion is triggered
> > >
> > > Shall we rephrase it similar to the previous message: 'cannot continue
> > > replication slots synchronization as standby promotion is triggered'
> > >
> > Changed.
> >
> > Attaching patch v14 incorporating the above changes.
> >
>

This was rephrased.

> Few trivial comments:
>
> 1)
> slotsync_api_reread_config():
> + * Returns true if conninfo, primary_slot_name or hot_standby_feedback changed.
>
> This comment is no longer valid, we can remove it.
>

Removed.

> 2)
>   /* We are done with sync, so reset sync flag */
>   reset_syncing_flag();
> +
>
> This extra blank line is not needed.

Fixed.

Attaching patch v15 addressing these comments.

regards,
Ajin Cherian
Fujitsu Australia