public inbox for [email protected]
help / color / mirror / Atom feedFrom: Melanie Plageman <[email protected]>
To: Bertrand Drouvot <[email protected]>
Cc: Fujii Masao <[email protected]>
Cc: Guillaume Lelarge <[email protected]>
Cc: Pg Hackers <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Cc: [email protected]
Cc: Jelte Fennema-Nio <[email protected]>
Cc: Jacob Champion <[email protected]>
Subject: Re: Log connection establishment timings
Date: Fri, 28 Feb 2025 17:42:37 -0500
Message-ID: <CAAKRu_Y0vHiDZgsnPriUeFe22NJz6zx-ukbODYJPHreAE1iONQ@mail.gmail.com> (raw)
In-Reply-To: <Z8FGpTkLIF7M3+M/@ip-10-97-1-34.eu-west-3.compute.internal>
References: <CAAKRu_b_smAHK0ZjrnL5GRxnAVWujEXQWpLXYzGbmpcZd3nLYw@mail.gmail.com>
<CAECtzeW3bFOT8v_th9hu6O9c0p+yNkD0ceBneWOtXYcwVd73rA@mail.gmail.com>
<[email protected]>
<CAAKRu_YrNsA7-v5L9d318XZu+tPqcxp+ctCGy2EGYrSt69ON=A@mail.gmail.com>
<CAAKRu_aV+B2yLpkcfh06tJV7XQPodjasxQ=XKh+MjD8ixkXwrA@mail.gmail.com>
<[email protected]>
<[email protected]>
<CAAKRu_bWRipJ2HA8cwvxrZOhSpvpPLkvhcBHecXBx8_wS4cjQQ@mail.gmail.com>
<[email protected]>
<CAAKRu_Zv7e1GWHiTJ9UOZEoqs8hO8sCezZZNuPv7s5mGYe_QkA@mail.gmail.com>
<Z8FGpTkLIF7M3+M/@ip-10-97-1-34.eu-west-3.compute.internal>
On Fri, Feb 28, 2025 at 12:16 AM Bertrand Drouvot
<[email protected]> wrote:
>
> Yup but my idea was to put all those line:
>
> "
> if (Log_connections &&
> (child_type == B_BACKEND || child_type == B_WAL_SENDER))
> {
> instr_time fork_time = ((BackendStartupData *) startup_data)->fork_time;
>
> conn_timing.fork_duration = INSTR_TIME_GET_DURATION_SINCE(fork_time);
> }
> "
>
> into a dedicated helper function.
I ended up finding a bug that means that that exact code isn't
duplicated twice now. For EXEC_BACKEND, I have to wait to calculate
the duration until after reading the GUC values but I need to get the
fork end time before that.
I tried coming up with an inline helper to replace this and most
things I tried felt awkward. It has to have backend type and start
time as parameters. 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. Someone could call the function
in a different place and maybe not know that log_connections won't be
set there.
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?
- Melanie
view thread (24+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Log connection establishment timings
In-Reply-To: <CAAKRu_Y0vHiDZgsnPriUeFe22NJz6zx-ukbODYJPHreAE1iONQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox