Re: pg_stat_statements temporary file

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: pg_stat_statements temporary file
Дата
Msg-id CAEYLb_W8KX8O=_e5cL6w4hSTVbDPL=64dufUERje2eY3-zy9jw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_stat_statements temporary file  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: pg_stat_statements temporary file  (Andres Freund <andres@2ndquadrant.com>)
Re: pg_stat_statements temporary file  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pg_stat_statements temporary file  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
On 25 May 2012 14:13, Magnus Hagander <magnus@hagander.net> wrote:
> Here's a patch that does the two easy fixes:
> 1) writes the file to a temp file and rename()s it over the main file
> as it writes down. This removes the (small) risk of corruption because
> of a crash during write
>
> 2) unlinks the file after reading it. this makes sure it's not
> included in online backups.

Seems reasonable. It might be better to consistently concatenate the
string literals PGSS_DUMP_FILE and ".tmp" statically. Also, I'd have
updated the string in the errmsg callsite after the "error" tag too,
to refer to the tmp file rather than the file proper. Forgive the
pedantry, but I should mention that I believe that it is project
policy to not use squiggly parenthesis following an if expression when
that is unnecessary due to there only being a single statement.

> I still think we should consider the placement of this file to not be
> in the global/ directory, but this is a quick (back-patchable) fix...

Where do you suggest the file be written to?

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Make skipped sort explicit in EXPLAIN ANALYZE
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pg_stat_statements temporary file