Re: Missing LWLock protection in pgstat_reset_replslot()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Missing LWLock protection in pgstat_reset_replslot()
Date: 2024-03-08 05:12:54
Message-ID: ZeqeVpo_PIgT7oP3@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 07, 2024 at 11:30:55AM +0530, shveta malik wrote:
> It slightly improves the chances. pgstat_fetch_replslot is only
> called from pg_stat_get_replication_slot(), I thought it might be
> better to acquire lock before we call pgstat_fetch_replslot and
> release once we are done copying the results for that particular slot.
> But I also understand that it will not prevent someone from dropping
> that slot at a later stage when the rest of the calls of
> pg_stat_get_replication_slot() are still pending.

I doubt that there will be more callers of pgstat_fetch_replslot() in
the near future, but at least we would be a bit safer with these
internals IDs when manipulating the slots, when considered in
isolation of this API call

> So I am okay with the current one.

Okay, noted.

Let's give a couple of days to others, in case there are more
comments. (Patch looked OK here after a second look this afternoon.)
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amul Sul 2024-03-08 05:13:57 Re: Add system identifier to backup manifest
Previous Message shveta malik 2024-03-08 05:09:21 Re: Synchronizing slots from primary to standby