Re: Log connection establishment timings

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>, andrey(dot)chudnovskiy(at)microsoft(dot)com, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Subject: Re: Log connection establishment timings
Date: 2025-03-03 14:07:12
Message-ID: Z8W3kClxw3dxHdAa@ip-10-97-1-34.eu-west-3.compute.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Feb 28, 2025 at 05:42:37PM -0500, Melanie Plageman wrote:
> And all of these places we have to be super
> careful that the GUCs have already been read before using
> log_connections, so it seems a bit unsafe to check log_connections
> (the global variable) in a function.

Yeah, that could be checking before calling the function (the caller would be
responsible for checking log_connections)

> Also, I also wasn't sure if it would be weird to call a function like
> "LogConnectionTiming()" which in many cases doesn't log the connection
> timing (because it is a different backend type).
>
> But maybe I'm not thinking about it correctly. What were you imagining?

I did not imagine that much ;-) I was just seeing this code being duplicated
and just thought about to avoid the duplication. But now that I read your comments
above then I think we could just macro-ize the child_type check (as you mentioned
up-thread). That would avoid the risk to forget to update the 3 locations doing the
exact same check should we add a new child type in the game.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2025-03-03 14:14:35 Re: making EXPLAIN extensible
Previous Message Israel Barth Rubio 2025-03-03 14:00:29 Re: Add -k/--link option to pg_combinebackup