Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qy0mK-0057Jl-JI for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2023 02:16:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qy0mI-005SEe-U1 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Nov 2023 02:16:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qy0mI-005SEW-Ka for pgsql-hackers@lists.postgresql.org; Wed, 01 Nov 2023 02:16:18 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qy0mB-003NTh-SW for pgsql-hackers@postgresql.org; Wed, 01 Nov 2023 02:16:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3A12G7kp2674202; Tue, 31 Oct 2023 22:16:07 -0400 From: Tom Lane To: Bruce Momjian cc: Yugo NAGATA , Alvaro Herrera , pgsql-hackers@postgresql.org Subject: Re: Question about non-blocking mode in libpq In-reply-to: References: <20210719231129.b2ab655c0d0e80545274c86f@sraoss.co.jp> <202107201605.b3hmz4g6uqqz@alvherre.pgsql> <20210721101509.7e70e0f801a4457a2f6a6174@sraoss.co.jp> <2604997.1698775114@sss.pgh.pa.us> <2666892.1698801066@sss.pgh.pa.us> Comments: In-reply-to Bruce Momjian message dated "Tue, 31 Oct 2023 21:55:49 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2674200.1698804967.1@sss.pgh.pa.us> Date: Tue, 31 Oct 2023 22:16:07 -0400 Message-ID: <2674201.1698804967@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Bruce Momjian 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