pg_rewind fails if there is a read only file.

Поиск
Список
Период
Сортировка
От Paul Guo
Тема pg_rewind fails if there is a read only file.
Дата
Msg-id CABQrizcU8FTZG_OUJ8b2bV+h9Roqhs1DuSyvNapV6xwu1cHDJA@mail.gmail.com
обсуждение исходный текст
Ответы Re: pg_rewind fails if there is a read only file.  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Several weeks ago I saw this issue in a production environment. The
read only file looks like a credential file. Michael told me that
usually such kinds of files should be better kept in non-pgdata
directories in production environments. Thought further it seems that
pg_rewind should be more user friendly to tolerate such scenarios.

The failure error is "Permission denied" after open(). The reason is
open() fais with the below mode in open_target_file()

      mode = O_WRONLY | O_CREAT | PG_BINARY;
      if (trunc)
          mode |= O_TRUNC;
      dstfd = open(dstpath, mode, pg_file_create_mode);

The fix should be quite simple, if open fails with "Permission denied"
then we try to call chmod to add a S_IWUSR just before open() and call
chmod to reset the flags soon after open(). A stat() call to get
previous st_mode flags is needed.

Any other suggestions or thoughts?

Thanks,

-- 
Paul Guo (Vmware)



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: Refactor "mutually exclusive options" error reporting code in parse_subscription_options
Следующее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Inaccurate error message when set fdw batch_size to 0