Re: Remove extra Logging_collector check before calling SysLogger_Start()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove extra Logging_collector check before calling SysLogger_Start()
Date: 2021-12-03 17:45:34
Message-ID: 2312934.1638553534@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> writes:
> On Fri, Dec 3, 2021 at 1:43 PM Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>> On 3 Dec 2021, at 08:58, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>>> It seems like there's an extra Logging_collector check before calling
>>> SysLogger_Start().

>> I think the code reads clearer with the Logging_collector check left intact,
>> and avoiding a function call in this codepath doesn't hurt.

> In that case, can we remove if (!Logging_collector) within
> SysLogger_Start() and have the check outside?

I think it's fine as-is; good belt-and-suspenders-too programming.
It's not like the extra check inside SysLogger_Start() is costly.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-12-03 17:46:51 Re: Skip vacuum log report code in lazy_scan_heap() if possible
Previous Message Tom Lane 2021-12-03 17:42:47 Re: Do sys logger and stats collector need wait events WAIT_EVENT_SYSLOGGER_MAIN/_PGSTAT_MAIN?