Re: pgsql: Track last_inactive_time in pg_replication_slots.

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Robert Haas <robertmhaas@gmail.com>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, shveta malik <shveta.malik@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Amit Kapila <akapila@postgresql.org>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2024-03-26T08:15:23Z
Lists: pgsql-hackers
On Tue, Mar 26, 2024 at 1:09 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2024-Mar-26, Amit Kapila wrote:
>
> > We have a consensus on inactive_since, so I'll make that change.
>
> Sounds reasonable.  So this is a timestamptz if the slot is inactive,
> NULL if active, right?
>

Yes.

>  What value is it going to have for sync slots?
>

The behavior will be the same for non-sync slots. In each sync cycle,
we acquire/release the sync slots. So at the time of release,
inactive_since will be updated. See email [1].

> > I would also like to solicit your opinion on the other slot-level
> > parameter we are planning to introduce.  This new slot-level parameter
> > will be named as inactive_timeout.
>
> Maybe inactivity_timeout?
>
> > This will indicate that once the slot is inactive for the
> > inactive_timeout period, we will invalidate the slot. We are also
> > discussing to have this parameter (inactive_timeout) as GUC [1]. We
> > can have this new parameter both at the slot level and as well as a
> > GUC, or just one of those.
>
> replication_slot_inactivity_timeout?
>

So, it seems you are okay to have this parameter both at slot level
and as a GUC. About names, let us see what others think.

Thanks for the input on the names.


[1] - https://www.postgresql.org/message-id/CAA4eK1KrPGwfZV9LYGidjxHeW%2BrxJ%3DE2ThjXvwRGLO%3DiLNuo%3DQ%40mail.gmail.com

-- 
With Regards,
Amit Kapila.



Commits

  1. Allow synced slots to have their inactive_since.

  2. Change last_inactive_time to inactive_since in pg_replication_slots.

  3. Track last_inactive_time in pg_replication_slots.

  4. Remove vacuum_defer_cleanup_age