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 20171212044330.3nclev2sfrab36tf@alap3.anarazel.de
Whole thread Raw
In response to 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  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Using ProcSignal to get memory context stats from a running backend  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 2017-12-12 11:57:41 +0800, Craig Ringer wrote:
> TL;DR: Lets add a ProcSignalReason that makes a backend
> call MemoryContextStats when it sees it and a C func that users can use to
> set it on a proc. Sane?

It's not unproblematic. procsignal_sigusr1_handler() runs in a signal
handler, so you can't really rely on a lot of stuff being legal to
do.

It'd be easy to set a flag in the handler and then have
CHECK_FOR_INTERRUPTS() do the MemoryContextStats() call. But that'd have
the disadvanatage that it possibly would take a while till the
MemoryContextStats() is executed. Not sure if that's still good enough
for you?

Another question is whether printing to stderr, bypassing proper
logging!, is good enough for something like this.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: RE: Using ProcSignal to get memory context stats from a runningbackend
Next
From: Jeff Janes
Date:
Subject: Re: [HACKERS] postgres_fdw super user checks