Re: Question about non-blocking mode in libpq - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question about non-blocking mode in libpq
Date
Msg-id 2674201.1698804967@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about non-blocking mode in libpq  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Question about non-blocking mode in libpq  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> 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.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Question about non-blocking mode in libpq
Next
From: Chapman Flack
Date:
Subject: Re: Extract numeric filed in JSONB more effectively