Re: Spurious pgstat_drop_replslot() call

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Spurious pgstat_drop_replslot() call
Date: 2024-03-08 10:55:39
Message-ID: Zeruq1KGdsz35-WU@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Mar 08, 2024 at 10:19:11AM +0000, Bertrand Drouvot wrote:
> Indeed, it does not seem appropriate to remove stats during slot invalidation as
> one could still be interested to look at them.

Yeah, my take is that this can still be interesting to know, at least
for debugging. This would limit the stats to be dropped when the slot
is dropped, and that looks like a sound idea.

> This spurious call has been introduced in be87200efd. I think that initially we
> designed to drop slots when a recovery conflict occurred during logical decoding
> on a standby. But we changed our mind to invalidate such a slot instead.
>
> The spurious call is probably due to the initial design but has not been removed.

This is not a subject that has really been touched on the original
thread mentioned on the commit, so it is a bit hard to be sure. The
only comment is that a previous version of the patch did the stats
drop in the slot invalidation path at an incorrect location.

> I don't think it's worth to add a test but can do if one feel the need.

Well, that would not be complicated while being cheap, no? We have a
few paths in the 035 test where we know that a slot has been
invalidated so it is just a matter of querying once
pg_stat_replication_slot and see if some data is still there.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-03-08 10:56:57 Re: Stack overflow issue
Previous Message Michael Paquier 2024-03-08 10:46:26 Re: Missing LWLock protection in pgstat_reset_replslot()