Re: Question about non-blocking mode in libpq

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about non-blocking mode in libpq
Date: 2023-11-01 12:47:33
Message-ID: ZUJI5ea7Ii0Um9am@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 31, 2023 at 10:16:07PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)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.

Okay, I see your point now. Here is an updated patch that addresses
both issues.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Only you can decide what is important to you.

Attachment Content-Type Size
block.diff text/x-diff 898 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2023-11-01 12:56:52 Re: trying again to get incremental backup
Previous Message Aleksander Alekseev 2023-11-01 12:10:48 Re: Tab completion regression test failed on illumos