Re: Get memory contexts of an arbitrary backend process - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Get memory contexts of an arbitrary backend process
Date
Msg-id 20210331.151612.259240960686480846.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: Get memory contexts of an arbitrary backend process  (torikoshia <torikoshia@oss.nttdata.com>)
Responses Re: Get memory contexts of an arbitrary backend process  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
At Wed, 31 Mar 2021 15:02:02 +0900, torikoshia <torikoshia@oss.nttdata.com> wrote in 
> On 2021-03-31 04:36, Fujii Masao wrote:
> > On 2021/03/30 22:06, torikoshia wrote:
> >> Modified the patch according to the suggestions.
> > Thanks for updating the patch!
> > I applied the cosmetic changes to the patch and added the example of
> > the function call into the document. Attached is the updated version
> > of the patch. Could you check this version?
> > 
> 
> Thanks a lot!
> 
> 
> +The memory contexts will be logged in the log file. For example:
> 
> When 'log_destination = stderr' and 'logging_collector = off', it does
> not log in the file but in the stderr.
> 
> Description like below would be a bit more accurate but I'm wondering
> it's  repeating the same words.
> 
> + The memory contexts will be logged based on the log configuration
> set. For example:
> 
> How do you think?

How about "The memory contexts will be logged in the server log" ?
I think "server log" doesn't suggest any concrete target.

> +<programlisting>
> +postgres=# SELECT pg_log_backend_memory_contexts(pg_backend_pid());
> + pg_log_backend_memory_contexts
> +--------------------------------
> + t
> +(1 row)
> +
> +The memory contexts will be logged in the log file. For example:
> +LOG:  logging memory contexts of PID 10377
> +STATEMENT:  SELECT pg_log_backend_memory_contexts(pg_backend_pid());
> +LOG: level: 0; TopMemoryContext: 80800 total in 6 blocks; 14432 free
> (5 chunks); 66368 used
> +LOG: level: 1; pgstat TabStatusArray lookup hash table: 8192 total in
> 1 blocks; 1408 free (0 chunks); 6784 used
> 
> The line "The memory contexts will be logged in the log file. For
> example:"
> is neither nor SQL command and its outputs, it might be better to
> differentiate it.
> 
> 
> What about the following like attached patch?
> 
> +<programlisting>
> +postgres=# SELECT pg_log_backend_memory_contexts(pg_backend_pid());
> + pg_log_backend_memory_contexts
> +--------------------------------
> + t
> +(1 row)
> +</programlisting>
> +The memory contexts will be logged in the log file. For example:
> +<screen>
> +LOG:  logging memory contexts of PID 10377
> +STATEMENT:  SELECT pg_log_backend_memory_contexts(pg_backend_pid());
> +LOG: level: 0; TopMemoryContext: 80800 total in 6 blocks; 14432 free
> (5 chunks); 66368 used
> +LOG: level: 1; pgstat TabStatusArray lookup hash table: 8192 total in
> 1 blocks; 1408 free (0 chunks); 6784 used
> ...(snip)...
> +LOG: level: 1; ErrorContext: 8192 total in 1 blocks; 7928 free (3
> chunks); 264 used
> +LOG: Grand total: 1651920 bytes in 201 blocks; 622360 free (88
> chunks); 1029560 used
> +</screen>

+1 from me. It looks like more compliant with the standard?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Guillaume Lelarge
Date:
Subject: Re: Extensions not dumped when --schema is used
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Remove page-read callback from XLogReaderState.