Re: Using ProcSignal to get memory context stats from a runningbackend

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Using ProcSignal to get memory context stats from a runningbackend
Дата
Msg-id 20171221065810.4khb3naphokov4ml@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Using ProcSignal to get memory context stats from a running backend  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: Using ProcSignal to get memory context stats from a running backend  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
Hi,

On 2017-12-21 14:49:28 +0800, Craig Ringer wrote:
> +/*
> + * Accumulate writes into the buffer in diag_request_buf,
> + * for use with functions that expect a printf-like callback.
> + */
> +static void
> +printwrapper_stringinfo(void *extra, const char * fmt, ...)
> +{
> +    StringInfo out = extra;
> +    for (;;)
> +    {
> +        va_list        args;
> +        int            needed;
> +        va_start(args, fmt);
> +        needed = appendStringInfoVA(out, fmt, args);
> +        va_end(args);
> +        if (needed == 0)
> +            break;
> +        enlargeStringInfo(out, needed);
> +    }
>  }

Hm, so I'm not entirely sure it's ok to use something that ERRORs on
OOM. There's plenty of scenarios with thousands of memory contexts,
making this output fairly large. If we want to make this usable in
production, I'm not sure it's ok to introduce additional ERRORs.  I
wonder if we can change this to emit a static message if collecting the
output exhausted memory.

Greetings,

Andres Freund


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Using ProcSignal to get memory context stats from a running backend
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Using ProcSignal to get memory context stats from a running backend