Re: Get memory contexts of an arbitrary backend process

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: torikoshia <torikoshia@oss.nttdata.com>, Georgios Kokolatos <gkokolatos@protonmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2020-12-03T01:10:06Z
Lists: pgsql-hackers

On 2020/11/16 19:58, torikoshia wrote:
> On 2020-10-28 15:32, torikoshia wrote:
>> On 2020-10-23 13:46, Kyotaro Horiguchi wrote:
> 
>>> I think we might need to step-back to basic design of this feature
>>> since this patch seems to have unhandled corner cases that are
>>> difficult to find.
> 
> I've written out the basic design below and attached
> corresponding patch.

I'm starting to study how this feature behaves. At first, when I executed
the following query, the function never returned. ISTM that since
the autovacuum launcher cannot respond to the request of memory
contexts dump, the function keeps waiting infinity. Is this a bug?
Probably we should exclude non-backend proceses from the target
processes to dump? Sorry if this was already discussed.

     SELECT pg_get_backend_memory_contexts(pid) FROM pg_stat_activity;


Regards,

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



Commits

  1. Add function to log the memory contexts of specified backend process.

  2. Add pg_backend_memory_contexts system view.

  3. Limit the verbosity of memory context statistics dumps.