Re: libpq SSL with non-blocking sockets

Поиск
Список
Период
Сортировка
От Martin Pihlak
Тема Re: libpq SSL with non-blocking sockets
Дата
Msg-id 4E2C1627.2030908@gmail.com
обсуждение исходный текст
Ответ на Re: libpq SSL with non-blocking sockets  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: libpq SSL with non-blocking sockets
Список pgsql-hackers
On 07/16/2011 12:46 AM, Tom Lane wrote:
> I think the direction to move in ought to be to use the existing buffer
> as-is, and have pqCheckOutBufferSpace refuse to enlarge the buffer while
> we are in "write frozen" state.  It should be OK to append data to the
> buffer, though, so long as we remember how much we're allowed to pass to
> SSL_write when we next try to write.

Alternative to freezing the outBuffer would be to set
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER mode during SSL initialisation.
That would enable the buffer address to be changed in-between the
SSL_write calls, so long as the content remains the same. Attached
is a patch that uses the single buffer approach described by Tom, but
with a moving SSL write buffer enabled.

Modifying pqCheckOutBufferSpace is also an option, but it'd break some
(arguably already broken) client applications that don't have proper
retry handling. Notably some versions of psycopg2 have problems with
handling zero return values from PQputCopyData. So ISTM that from
backporting perspective the moving write buffer is a bit safer.

I'll see if I can come up with a test case for the SSL_read retry before
attempting to fix that.

regards,
Martin

Вложения

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

Предыдущее
От: Stefan Kaltenbrunner
Дата:
Сообщение: Re: pgbench cpu overhead (was Re: lazy vxid locks, v1)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgbench cpu overhead (was Re: lazy vxid locks, v1)