Re: [GENERAL] Unlogged Crash Detection

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [GENERAL] Unlogged Crash Detection
Дата
Msg-id CAB7nPqSSQf5X5=wXw+suu4hNFY0HwXU+Q-W-sHzMprY2Kx4PPw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Unlogged Crash Detection  (Gersner <gersner@gmail.com>)
Ответы Re: [GENERAL] Unlogged Crash Detection
Список pgsql-general
On Tue, Aug 29, 2017 at 6:06 PM, Gersner <gersner@gmail.com> wrote:
> I see, interesting.

Please do not top-post. This is not the recommended way of dealing
with threads on this mailing list.

> We have lots of unlogged tables, upon a crash we want to create a
> feedback/alert that data disappeared.
>
> Not very familiar with the internal structure, but is it possible to
> identify if the current table is the INIT_FORKNUM?

Using pg_relation_filepath, you can know the path to a relation file
on disk. So a simple idea would be to use pg_read_binary_file with the
path of the file and the path of the init fork, which is suffixed with
"_init", and then a comparison between both. If the data read is the
same, the relation has been untouched. Note that you can only do such
a thing as a superuser, and that the data is read from disk, not from
shared buffers. So that's not perfect, but it give an indication.
--
Michael


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

Предыдущее
От: Gersner
Дата:
Сообщение: Re: [GENERAL] Unlogged Crash Detection
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Out of memory/corrupted shared memory problem on server