Re: libpq SSL with non-blocking sockets

Поиск
Список
Период
Сортировка
От Martin Pihlak
Тема Re: libpq SSL with non-blocking sockets
Дата
Msg-id 4DF90602.7060201@gmail.com
обсуждение исходный текст
Ответ на Re: libpq SSL with non-blocking sockets  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: libpq SSL with non-blocking sockets  (Steve Singer <ssinger_pg@sympatico.ca>)
Список pgsql-hackers
On 06/12/2011 04:22 AM, Robert Haas wrote:
> One idea is that we could add outBuffer2/outBufSize2 to struct
> pg_conn, or something along those lines with less obviously stupid
> naming.  Normally those would be unused, but in the special case where
> SSL indicates that we must retry the call with the same arguments, we
> set a flag that "freezes" the out buffer and forces any further data
> to be stuffed into outBuffer2.  If or when the operation finally
> succeeds, we then move the data from outBuffer2 into outBuffer.
>

Yes, that sounds like a good idea -- especially considering that COPY
is not the only operation that can cause SSL_write retries.

Attached is a first attempt at a patch to implement the described two
buffer approach. This modifies pqSendSome so that whenever a SSL
write retry is needed it saves the current outBuffer with its length
and attempted write size to connection's sslRetry* variables. A new
outBuffer is then allocated and used for any further data pushing.

After the SSL write retry buffer is set up, any further calls to
pqSendSome will first attempt to send the contents of the retry buffer,
returning 1 to indicate that not all of the data could be sent. If the
retry buffer is finally emptied it is freed and pqSendSome starts
sending from the regular outBuffer.

This is of course still "work in progress", needs cleaning up and
definitely more testing. But at this point before going any further,
I'd really appreciate a quick review from resident libpq gurus.

regards,
Martin

Вложения

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: FK NOT VALID can't be deferrable?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: creating CHECK constraints as NOT VALID