Re: Small memory fixes for pg_createsubcriber - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Small memory fixes for pg_createsubcriber
Date
Msg-id CAEudQApo8Lk2FfaqNjxadovj_nAGoBjoF86+t7mG56hrYQSfbA@mail.gmail.com
Whole thread Raw
In response to Re: Small memory fixes for pg_createsubcriber  ("Euler Taveira" <euler@eulerto.com>)
List pgsql-hackers
Em qua., 12 de fev. de 2025 às 00:54, Michael Paquier <michael@paquier.xyz> escreveu:
On Tue, Feb 11, 2025 at 01:32:32PM -0300, Euler Taveira wrote:
> There is no bug. They are the same behind the scenes. I'm fine changing it. It
> is a new code and it wouldn't cause a lot of pain to backpatch patches in the
> future.

On consistency grounds, and as this is documented in fe-exec.c at the
top of PQfreemem(), I can get behind the switch.

> Even if the pg_createsubscriber aims to run in a small amount of time, hence,
> it is fine to leak memory, the initial commit cleaned up all variables but a
> subsequent commit 4867f8a555c apparently didn't. Although it is just a low
> impact improvement, it is better to be strict and shut up SASTs.

check_and_drop_existing_subscriptions() is called once per database in
setup_subscriber(), and we are not going to have millions of them in
this list.  We don't usually care for such short-lived things, but as
the original commit did the effort in d44032d01463, I don't see why we
cannot do it here, either.
Thanks Michael.

best regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: Dagfinn Ilmari Mannsåker
Date:
Subject: Re: TAP test command_fails versus command_fails_like
Next
From: Andres Freund
Date:
Subject: Re: Small memory fixes for pg_createsubcriber