Re: pg_stat_statements temporary file

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: pg_stat_statements temporary file
Дата
Msg-id CABUevEyFnP6mFA=sJTY6VAT+WkKPw135OuBETLDKfcxSkz3r7g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_stat_statements temporary file  (Peter Geoghegan <peter@2ndquadrant.com>)
Ответы Re: pg_stat_statements temporary file  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
On Thu, May 24, 2012 at 2:16 PM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
> On 24 May 2012 12:42, Magnus Hagander <magnus@hagander.net> wrote:
>> What actually happens if it tries to repalloc() something huge? palloc
>> will throw an elog(ERROR), and since this happens during postmaster
>> startup, are you sure it won't prevent the server from starting?
>
> Oh, yes, missed that.
>
>                /* Previous incarnation might have had a larger query_size */
>                if (temp.query_len >= buffer_size)
>                {
>                        buffer = (char *) repalloc(buffer, temp.query_len + 1);
>                        buffer_size = temp.query_len + 1;
>                }
>
> Here, "temp" receives its value from an fread().
>
> This could probably be coded to be defensive against such things, but
> a better fix would be preferred. I have to wonder how much of a
> problem corruption is likely to be though, given that we only save to
> disk in a corresponding pgss_shmem_shutdown() call, which actually has
> more protections against corruption. The window for the saved file to
> be corrupt seems rather small, though I accept that a better window
> would be zero.

Right. But writing to a temp file and rename()ing it into place is trivial.

It's really the other issues raised that are bigger ;)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: pg_stat_statements temporary file
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: shared_preload_libraries path