Re: pg_log_backend_memory_contexts() and log level

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_log_backend_memory_contexts() and log level
Date: 2022-01-27 03:45:33
Message-ID: d6a75be9-9f54-3903-4787-895396333b1a@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/01/26 14:28, torikoshia wrote:
> On 2022-01-26 13:17, Fujii Masao wrote:
>> Hi,
>>
>> pg_log_backend_memory_contexts() should be designed not to send the
>> messages about the memory contexts to the client regardless of
>> client_min_messages. But I found that the message "logging memory
>> contexts of PID %d" can be sent to the client because it's ereport()'d
>> with LOG level instead of LOG_SERVER_ONLY. Is this a bug, and
>> shouldn't we use LOG_SERVER_ONLY level to log that message? Patch
>> attached.
>>
>> Regards,
>
> Thanks! I think it's a bug.
>
> There are two clients: "the client that executed pg_log_backend_memory_contexts()" and "the client that issued the query that was the target of the memory context logging", but I was only concerned about the former when I wrote that part of the code.
> The latter is not expected.
>
> It seems better to use LOG_SERVER_ONLY as the attached patch.
>
> The patch was successfully applied and there was no regression test error on my environment.

Thanks for the review! So barring any objection, I will commit the patch and backport it to v14 where pg_log_backend_memory_contexts() is added.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-01-27 04:07:09 Re: snapper and skink and fairywren (oh my!)
Previous Message Fujii Masao 2022-01-27 03:45:10 Re: pg_log_backend_memory_contexts() and log level