Re: pgsql: Add function to log the memory contexts of specified backend pro

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Add function to log the memory contexts of specified backend pro
Date: 2025-05-02 00:02:43
Message-ID: 1983bca8-e1c4-45cd-9fd4-de38cd7b5896@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2025/05/02 2:27, Fujii Masao wrote:
>
>
> On 2025/05/01 21:42, Robert Haas wrote:
>> On Thu, May 1, 2025 at 3:53 AM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
>>> Just idea, what do you think about adding a flag to indicate whether
>>> ProcessLogMemoryContextInterrupt() is currently running? Then,
>>> when a backend receives a signal and ProcessLogMemoryContextInterrupt()
>>> is invoked, it can simply return immediately if the flag is already set
>>> like this:
>>
>> I think that something like this could work, but you would need more
>> than this. Otherwise, if the function errors out, the flag would
>> remain permanently set.
>
> Yes, we need to either use PG_TRY()/PG_FINALLY() or handle the flag as
> a global variable and reset it in the error handling path. I think using
> PG_TRY()/PG_FINALLY() is the simpler option.

I've implemented the patch in that way. Patch attached.

Regards,

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

Attachment Content-Type Size
v1-0001-Add-guard-to-prevent-recursive-memory-contexts-lo.patch text/plain 3.6 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2025-05-02 02:37:23 pgsql: doc: first draft of the PG 18 release notes
Previous Message Noah Misch 2025-05-01 23:53:48 pgsql: Doc: stop implying recommendation of insecure search_path value.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-05-02 01:00:53 Re: Add an option to skip loading missing publication to avoid logical replication failure
Previous Message Michael Paquier 2025-05-01 23:03:50 Re: Make COPY format extendable: Extract COPY TO format implementations