public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bruce Momjian <[email protected]>
To: Tom Lane <[email protected]>
Cc: Yugo NAGATA <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: [email protected]
Subject: Re: Question about non-blocking mode in libpq
Date: Wed, 1 Nov 2023 08:47:33 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Tue, Oct 31, 2023 at 10:16:07PM -0400, Tom Lane wrote:
> Bruce Momjian <[email protected]> writes:
> > On Tue, Oct 31, 2023 at 09:11:06PM -0400, Tom Lane wrote:
> >> What I'm objecting to is removal of the bit about "if they need to be
> >> called again". That provides a hint that retry is the appropriate
> >> response to a failure. Admittedly, it's not 100% clear, but your
> >> version makes it 0% clear.
>
> > I thought the original docs said you had to re-call on failure (it would
> > not block but it would fail if it could not be sent), while we are now
> > saying that it will be queued in the input buffer.
>
> For these functions in nonblock mode, failure means "we didn't queue it".
>
> > Is retry really something we need to mention now? If out of memory is
> > our only failure case now ("unable to enlarge the buffer because OOM"),
> > is retry really a realistic option?
>
> Well, ideally the application would do something to alleviate the
> OOM problem before retrying. I don't know if we want to go so far
> as to discuss that. I do object to giving the impression that
> failure is impossible, which I think your proposed wording does.
>
> An orthogonal issue with your latest wording is that it's unclear
> whether *unsuccessful* calls to these functions will block.
Okay, I see your point now. Here is an updated patch that addresses
both issues.
--
Bruce Momjian <[email protected]> https://momjian.us
EDB https://enterprisedb.com
Only you can decide what is important to you.
Attachments:
[text/x-diff] block.diff (898B, ../[email protected]/2-block.diff)
download | inline diff:
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 64b2910fee..ffff0e528d 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -5316,11 +5316,12 @@ int PQsetnonblocking(PGconn *conn, int arg);
</para>
<para>
- In the nonblocking state, calls to
+ In the nonblocking state, successful calls to
<xref linkend="libpq-PQsendQuery"/>, <xref linkend="libpq-PQputline"/>,
<xref linkend="libpq-PQputnbytes"/>, <xref linkend="libpq-PQputCopyData"/>,
- and <xref linkend="libpq-PQendcopy"/> will not block but instead return
- an error if they need to be called again.
+ and <xref linkend="libpq-PQendcopy"/> will not block; their changes
+ are stored in the local output buffer until they are flushed.
+ Unsuccessful calls will return an error and must be retried.
</para>
<para>
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Question about non-blocking mode in libpq
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox