Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIb8R-0006NR-VB for pgsql-committers@arkaria.postgresql.org; Tue, 24 Aug 2021 18:26:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mIb8P-0002rM-El for pgsql-committers@arkaria.postgresql.org; Tue, 24 Aug 2021 18:26:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIb8P-0002rE-97 for pgsql-committers@lists.postgresql.org; Tue, 24 Aug 2021 18:26:53 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIb8H-0002co-5p for pgsql-committers@lists.postgresql.org; Tue, 24 Aug 2021 18:26:50 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id B7173245F73D for ; Tue, 24 Aug 2021 20:26:41 +0200 (CEST) Received: from s934.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id A71BF2E35450; Tue, 24 Aug 2021 20:26:41 +0200 (CEST) Received: from s474.loopia.se (unknown [172.22.191.6]) by s934.loopia.se (Postfix) with ESMTP id A26AD7CE9EF; Tue, 24 Aug 2021 20:26:41 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s934.loopia.se ([172.22.191.6]) by s474.loopia.se (s474.loopia.se [172.22.190.14]) (amavisd-new, port 10024) with LMTP id vONiY5O1Hm8C; Tue, 24 Aug 2021 20:26:41 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from [192.168.72.144] (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s934.loopia.se (Postfix) with ESMTPSA id 2E02F7CEA16; Tue, 24 Aug 2021 20:26:41 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: pgsql: psql: Add test for query canceling From: Daniel Gustafsson In-Reply-To: <9f46b102-da4d-8312-54f0-1f3bc10b453c@enterprisedb.com> Date: Tue, 24 Aug 2021 20:26:40 +0200 Cc: Tom Lane , Fabien COELHO , pgsql-committers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <49FB9125-8FAC-4B2A-B440-0A2CF16642CF@yesql.se> References: <5F16EBAA-30D3-4C0D-840C-C2FF2739E370@yesql.se> <1957503.1629485278@sss.pgh.pa.us> <9f46b102-da4d-8312-54f0-1f3bc10b453c@enterprisedb.com> To: Peter Eisentraut X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 24 Aug 2021, at 18:43, Peter Eisentraut = wrote: >=20 > On 20.08.21 20:47, Tom Lane wrote: >> I think you should drop the overly-cute bit with a SIGALRM handler, >> and instead have a loop-with-delay around an attempt to read the >> psql.pid file, after launching the psql run without an immediate >> wait for termination. That gets rid of the first problem (though >> you still want the loop to timeout eventually, it could wait up >> to say 180 seconds, as we do elsewhere). Then the second problem >> is easy to solve by making the pg_sleep delay twice as much. >=20 > Here is a proposal. It waits separately for the pid file to appear = and also checks for the sleep query to be registered by the backend, so = it doesn't have any more dependencies on things happening "fast enough". = And it's also faster in the normal case now. Thoughts? =46rom reading the patch, that looks like a really good combination of = ideas for this test. +1. -- Daniel Gustafsson https://vmware.com/