Re: Streaming replication and non-blocking I/O

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Streaming replication and non-blocking I/O
Дата
Msg-id 4B4F0AB4.4010306@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Streaming replication and non-blocking I/O  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: Streaming replication and non-blocking I/O
Список pgsql-hackers
After reading up on SSL_read() and SSL_pending(), it seems that there is
unfortunately no reliable way of checking if there is incoming data that
can be read using SSL_read() without blocking, short of putting the
socket to non-blocking mode. It also seems that we can't rely on poll()
returning POLLHUP if the remote end has disconnected; it's not doing
that at least on my laptop.

So, the only solution I can see is to put the socket to non-blocking
mode. But to keep the change localized, let's switch to non-blocking
mode only temporarily, just when polling to see if there's data to read
(or EOF), and switch back immediately afterwards.

I've added a pq_getbyte_if_available() function to pqcomm.c to do that.
The API to the upper levels is quite nice, the function returns a byte
if one is available without blocking. Only minimal changes are required
elsewhere.

See that in my git repository. Attached is a new version of the whole
streaming replication patch, for the benefit of archives and git non-users.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

Вложения

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Small Bug in GetConflictingVirtualXIDs
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Hot Standby and query cancel