Re: Non-blocking synchronization in libpq using pipeline mode

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: jbe-mlist(at)magnetkern(dot)de, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Non-blocking synchronization in libpq using pipeline mode
Date: 2024-03-19 11:49:23
Message-ID: 202403191149.asubmjesltim@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 2024-Mar-06, PG Doc comments form wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/16/libpq-pipeline-mode.html
> Description:
>
> The calls to PQpipelineSync and PQsendFlushRequest may either report failure
> or success, but not that data could not be written as of yet because the
> request would block.

Is this a literal quote? If so, where do you see it?

> Does this mean that
>
> 1. these functions will always block when invoked and the socket is not
> ready to accept the number of bytes that need to be written (assuming the
> number of bytes required to be written is greater than one byte)

No.

> 2. the synchronization or flush request need to be flushed manually with
> successive PQflush calls

Yes.

> or
>
> 3. the functions will return an error condition when the connection is
> non-blocking and no data could be written.

No.

> Any clarification in the documentation would be appreciated.

So I checked https://www.postgresql.org/docs/16/libpq-pipeline-mode.html
and it has this, under PQsendFlushRequest:

The server flushes its output buffer automatically as a result of
PQpipelineSync being called, or on any request when not in pipeline
mode; this function is useful to cause the server to flush its output
buffer in pipeline mode without establishing a synchronization point.
Note that the request is not itself flushed to the server
automatically; use PQflush if necessary.

which I think answers what you are asking.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Just treat us the way you want to be treated + some extra allowance
for ignorance." (Michael Brusser)

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Greg Sabino Mullane 2024-03-19 15:04:18 Re: Discourage splitting pg_wal directory
Previous Message David Rowley 2024-03-18 22:24:10 Re: Monetary Data Types Improvement