Why are we using blocking libpq in the backend?

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Why are we using blocking libpq in the backend?
Date: 2023-01-03 20:30:11
Message-ID: 20230103203011.xieafwxbbxz3i6no@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

As noted in [1], and also commented on by other previously, we use libpq in
blocking mode in libpqwalreceiver, postgres_fdw, etc. This is done knowingly,
see e.g. comments like:
/*
* Submit the query. Since we don't use non-blocking mode, this could
* theoretically block. In practice, since we don't send very long query
* strings, the risk seems negligible.
*/

but I don't understand why we do it. It seems like it'd be a fairly small
amount of additional code to just do it right, given that we do so for calls
to PQgetResult() etc?

Greetings,

Andres Freund

[1] https://postgr.es/m/20230103200520.di5hjebqvi72coql%40awork3.anarazel.de

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2023-01-03 20:30:52 Re: enable_timeout_every() and fin_time
Previous Message Peter Geoghegan 2023-01-03 20:30:02 Re: New strategies for freezing, advancing relfrozenxid early