Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify
Дата
Msg-id 4B2ED137.50501@postnewspapers.com.au
обсуждение исходный текст
Ответ на Cheapest way to poll for notifications? & Driver improvement question re SSL and notify  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-jdbc
Maciek Sakrejda wrote:

> Does the jdbc driver work with EmptyQueryResponse? At the protocol
> level, if you send a Query message with an all-whitespace sql string,
> the backend is supposed to reply with a single EmptyQueryResponse
> message and then issue ReadyForQuery again. I have a feeling that jdbc
> is probably "too smart" for this to work, but it could be worth a
> shot.

Even if the JDBC driver avoids sending such a query, it'd be a handy
behavior to use if explicit polling was implemented in the driver
interface. Send an empty Query message, read() from the buffer now that
you know there's something in it (the server's empty query response) and
see if there are any async notifications in the buffer before the empty
query response.

Thanks for the tip. If the JDBC folks ever stick their heads up here to
comment on any of this or to respond to the docs patches I've sent them
I'll see if they'd accept a patch for this and put one together if so.
It wouldn't be as efficient as purely client-side polling as it'd
require a network round trip, but it'd be a whole lot simpler and would
avoid spamming the db logs.

--
Craig Ringer

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

Предыдущее
От: Alexander Pyhalov
Дата:
Сообщение: Re: Get bytes sent to client
Следующее
От: Maciek Sakrejda
Дата:
Сообщение: Re: Cheapest way to poll for notifications? & Driver improvement question re SSL and notify