Don't use pq_putmessage in socket comm function

Поиск
Список
Период
Сортировка
Искать

Don't use pq_putmessage in socket comm function

От:
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Дата:
Вложения:
Hi,

Currently, socket_putmessage_noblock enlarges the output buffer and
then calls pq_putmessage to store the message in the buffer.

pq_putmessage is a macro redirecting to PqCommMethods->putmessage.
This is normally set to socket_putmessage, so
socket_putmessage_noblock calls socket_putmessage as desired.

However, if a custom PqCommMethods is defined, any call to
socket_putmessage_noblock will then loop to the custom putmessage.

This patch fixes the issue by directly using socket_putmessage in
socket_putmessage_noblock.

Regards,
Anthonin Bonnefoy

Re: Don't use pq_putmessage in socket comm function

От:
Michael Paquier <michael@paquier.xyz>
Дата:
Вложения:
On Wed, Jul 22, 2026 at 10:16:53AM +0200, Anthonin Bonnefoy wrote:
> However, if a custom PqCommMethods is defined, any call to
> socket_putmessage_noblock will then loop to the custom putmessage.
> 
> This patch fixes the issue by directly using socket_putmessage in
> socket_putmessage_noblock.

Yes, that's strange.  It seems like a mistake going down to 9.5, as of
2bd9e412f92b where socket_putmessage_noblock() has been introduced,
leaving the pq_putmessage() around.

Thoughts or opinions?
--
Michael

Re: Don't use pq_putmessage in socket comm function

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Wed, Jul 22, 2026 at 5:30 PM Michael Paquier  wrote:
> Yes, that's strange.  It seems like a mistake going down to 9.5, as of
> 2bd9e412f92b where socket_putmessage_noblock() has been introduced,
> leaving the pq_putmessage() around.
>
> Thoughts or opinions?

Agreed. The proposed change looks correct to me.

Regards,

-- 
Fujii Masao


FAQ