Re: pg_rewind failure by file deletion in source server

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pg_rewind failure by file deletion in source server
Дата
Msg-id CAB7nPqQPhbKEfM_nKnxSNn-NWRhSq=aKDCqguZaQ9Ri67J+cKQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_rewind failure by file deletion in source server  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: pg_rewind failure by file deletion in source server  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
On Fri, Jun 12, 2015 at 9:02 PM, Fujii Masao wrote:
>> You want to draft a patch? Should I?
>
> Please feel free to try that! :)

OK, so attached are a patch and a test case able to trigger easily the
error. Apply the patch and run the test case to reproduce the
following failure:
$ ERROR:  could not open file "base/16384/16385_fsm" for reading: No
such file or directory
STATEMENT:  SELECT path, begin,
      pg_read_binary_file(path, begin, len) AS chunk
    FROM fetchchunks
The patch adds a call to pg_usleep after the list of files from source
server has been fetched with libpq in pg_rewind.c to let time to run
some DROP actions, like DROP DATABASE, DROP TABLE, etc in order to
trigger the error easily.

In order to reduce the risk of failure to a minimum and to preserve
the performance of the tool when using --source-server, I think that
we should add some check using pg_stat_file to see if a file is still
present or not, and if it is missing we can safely skip it thanks to
minRecoveryPoint. Now the problem is that pg_stat_file fails
automatically if the file targeted is missing. Hence, to avoid a bunch
of round trips with the server with one call to pg_stat_dir per file,
I think that we should add some if_not_exists option to pg_stat_file,
defaulting to false, to skip the error related to the file missing and
have it return NULL in this case. Then we could use this filter on the
file path in libpq_executeFileMap() to fetch only the file chunks that
actually exist on the server. Note that we could as well use some
plpgsql-ing to do the same, but the extension of pg_stat_file looks
more useful to me. Thoughts?
--
Michael

Вложения

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

Предыдущее
От: Prakash Itnal
Дата:
Сообщение: Re: Auto-vacuum is not running in 9.1.12
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Need Multixact Freezing Docs