Re: Using ProcSignal to get memory context stats from a runningbackend - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Using ProcSignal to get memory context stats from a runningbackend
Date
Msg-id 20171212185051.vqorvxo5cnmkiums@alap3.anarazel.de
Whole thread Raw
In response to Re: Using ProcSignal to get memory context stats from a running backend  (Craig Ringer <craig@2ndquadrant.com>)
Responses Re: Using ProcSignal to get memory context stats from a running backend  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 2017-12-12 14:25:48 +0800, Craig Ringer wrote:
> If we were willing to wrap variadic calls in a callback and rely on
> vfprintf, we could:

I don't think there's problems with relying on variadic calls, we do
that in plenty places.


> and let the ProcSignal based caller pass an elog wrapper instead, or form a
> StringInfo with appendStringInfoVA then elog it in one go after the
> MemoryContextStatsDetail call returns.

I don't think we want a simple elog wrapper - outputting the context
stats as hundreds of log messages doesn't seem right. So at the least it
seems we should bunch it up in stringinfo - which seems to at least
require expanding the API to pass around a void *callback_data or such.

I do wonder if the right thing here wouldn't be to put the result into a
dsm segment, and then return that to the UDF on the requesting
side. Logging to the server log and then have the requestor dig that out
doesn't seem particularly user friendly.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: pgbench's expression parsing & negative numbers
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] parallel.c oblivion of worker-startup failures