From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: torikoshia@oss.nttdata.com
Cc: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Cc: gkokolatos@protonmail.com
Cc: kasahara.tatsuhito@gmail.com
Cc: craig@2ndquadrant.com
Subject: Re: Get memory contexts of an arbitrary backend process
Date: Fri, 26 Mar 2021 12:49:16 +0900
Message-ID: <5b190984-5b6a-30ce-088a-85ba1af2cfdd@oss.nttdata.com> (raw)
In-Reply-To: <6738f309-a41b-cbe6-bb57-a1c58ce9f05a@oss.nttdata.com>
References: <0b0657d5febd0e46565a6bc9c62ba3f6@oss.nttdata.com>
<2be9b430-e664-a342-7799-c92779808029@oss.nttdata.com>
<a8af0d22d87a9fd3f5983d3c6db55b03@oss.nttdata.com>
<20210326.120104.2148406039277091336.horikyota.ntt@gmail.com>
<6738f309-a41b-cbe6-bb57-a1c58ce9f05a@oss.nttdata.com>
On 2021/03/26 12:26, Fujii Masao wrote:
>
>
> On 2021/03/26 12:01, Kyotaro Horiguchi wrote:
>> At Thu, 25 Mar 2021 23:45:17 +0900, torikoshia <torikoshia@oss.nttdata.com> wrote in
>>> Attached new one.
>
> Regarding the argument max_children, isn't it better to set its default value,
> e.g., 100 like MemoryContextStats() uses?
+ mcxtLogData->maxChildrenPerContext = max_children;
+
+ if(!SendProcSignal(pid, PROCSIG_LOG_MEMORY_CONTEXT, proc->backendId))
+ PG_RETURN_BOOL(true);
Do we need memory barrier here? Otherwise, there is a race condition
where maxChildrenPerContext has not been set yet when the target backend
that received signal read that shared variable. No?
+ Note that when multiple
+ <function>pg_get_backend_memory_contexts</function> called in
+ succession or simultaneously, <parameter>max_children</parameter> can
+ be the one of another
+ <function>pg_get_backend_memory_contexts</function>.
+ </para></entry>
This might not be an issue in practice as Horiguchi-san said upthread.
But this looks a bit ugly and might be footgun later. The current approach
using shared memory to pass this information to the target backends
might be overkill, and too complicated to polish the design at the stage
just before feature freeze. So I'd withdraw my previous comment and
am OK to use the hard-coded value as max_children at the first version
of this feature. Thought?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
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: pgsql-hackers@postgresql.org
Cc: masao.fujii@oss.nttdata.com, horikyota.ntt@gmail.com, torikoshia@oss.nttdata.com, tgl@sss.pgh.pa.us, gkokolatos@protonmail.com, kasahara.tatsuhito@gmail.com, craig@2ndquadrant.com
Subject: Re: Get memory contexts of an arbitrary backend process
In-Reply-To: <5b190984-5b6a-30ce-088a-85ba1af2cfdd@oss.nttdata.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox