[COMMITTERS] pgsql: Fix WaitEventSetWait() to handle write-ready waits properly onW

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Fix WaitEventSetWait() to handle write-ready waits properly onW
Дата
Msg-id E1cox4o-0007ps-Ng@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix WaitEventSetWait() to handle write-ready waits properly on Windows.

Windows apparently will not detect socket write-ready events unless a
preceding send attempt returned WSAEWOULDBLOCK.  In many usage patterns
that's satisfied by the caller of WaitEvenSetWait(), but not always.

Apply the same solution that we already had in pgwin32_select(), namely to
perform a dummy WSASend() call with len=0.  This will return WSAEWOULDBLOCK
if there's no buffer space (even though it could legitimately do nothing
and report success, which makes me a bit nervous about this solution;
but since it's been working fine in libpq, let's roll with it).

In passing, improve the comments about this in pgwin32_select(), and remove
duplicated code there.

Back-patch to 9.6 where WaitEventSetWait() was introduced.  We might need
to back-patch something similar into predecessor code.  But given the lack
of complaints so far, it's not clear that the case ever gets exercised
in the back branches, so I'm not going to expend effort on it right now.

This should resolve recurring failures on buildfarm member bowerbird,
which has been failing since 1e8a85009 went in.

Diagnosis and patch by Petr Jelinek, cosmetic adjustments by me.

Discussion: https://postgr.es/m/5b6a6d6d-fb45-0afb-2e95-5600063c3dbd@2ndquadrant.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f7819baa618c528f60e266874051563ecfe08207

Modified Files
--------------
src/backend/port/win32/socket.c | 28 ++++++++++++----------------
src/backend/storage/ipc/latch.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 16 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Rename "pg_clog" directory to "pg_xact".
Следующее
От: Michael Meskes
Дата:
Сообщение: [COMMITTERS] pgsql: Fix schedule of ecpg test files to only try two-phase committes