Re: pg_ctl promote wait

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_ctl promote wait
Дата
Msg-id 20160219191534.yunti6ppenvqpqms@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_ctl promote wait  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On 2016-02-19 13:48:52 -0500, Peter Eisentraut wrote:
> Is it safe to read pg_control externally without a lock?  pg_controldata
> will just report a CRC error and proceed, and if you're not sure you can
> just run it again.  But if a promotion fails every so often because of
> concurrent pg_control writes, that would make this feature annoying.

Yes, the OS should give sufficient guarantees here:
      If write() is interrupted by a signal before it writes any data, it shall return −1 with errno set to [EINTR].
      If write() is interrupted by a signal after it successfully writes some data, it shall return the number of bytes
written.
      If the value of nbyte is greater than {SSIZE_MAX}, the result is implementation-defined.
      After a write() to a regular file has successfully returned:
       *  Any successful read() from each byte position in the file that was modified by that write shall return the
dataspecified          by the write() for that position until such byte positions are again modified.
 

We currently assume that all "small" writes succeed in one go (and throw
errors if not). Thus the guarantees by read/write are sufficient.

Regards,

Andres



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: pg_ctl promote wait
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pg_ctl promote wait