Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jCl39-0003gB-Tr for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2020 14:12:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jCl38-0004yi-Qm for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2020 14:12:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jCl38-0004x2-Hj for pgsql-hackers@lists.postgresql.org; Fri, 13 Mar 2020 14:12:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCl35-00020y-Oq for pgsql-hackers@postgresql.org; Fri, 13 Mar 2020 14:12:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 02DECKIF032141; Fri, 13 Mar 2020 10:12:20 -0400 From: Tom Lane To: Julien Rouhaud cc: Alvaro Herrera , Michael Paquier , Andres Freund , pgsql-hackers Subject: Re: Add an optional timeout clause to isolationtester step. In-reply-to: <20200313090450.6crpgoula5nrgadl@nol> References: <24078.1583958800@sss.pgh.pa.us> <20200311205254.GA2648@alvherre.pgsql> <20200313090450.6crpgoula5nrgadl@nol> Comments: In-reply-to Julien Rouhaud message dated "Fri, 13 Mar 2020 10:04:50 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32139.1584108740.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 13 Mar 2020 10:12:20 -0400 Message-ID: <32140.1584108740@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Julien Rouhaud writes: > On Wed, Mar 11, 2020 at 05:52:54PM -0300, Alvaro Herrera wrote: >> On 2020-Mar-11, Tom Lane wrote: >>> I'd like to see an attempt to rewrite some of the existing >>> timeout-dependent test cases to use this facility instead of >>> long timeouts. >> +1. Those long timeouts are annoying enough that infrastructure to mak= e >> a run shorter in normal circumstances might be sufficient justification >> for this patch ... > I'm not familiar with those test so I'm probably missing something, but = looks > like all isolation tests that setup a timeout are doing so to test serve= r side > features (deadlock detection, statement and lock timeout). I'm not sure= how > adding a client-side facility to detect locks earlier is going to help r= educing > the server side timeouts? The point is that those timeouts have to be set long enough for even a very slow machine to reach a desired state before the timeout happens; on faster machines the test is just uselessly sleeping for a long time, because of the fixed timeout. My thought was that maybe the tests could be recast as "watch for session to reach $expected_state and then do the next thing", allowing them to be automatically adaptive to the machine's speed. This might require some rather subtle test redesign and/or addition of more infrastructure (to allow recognition of the desired state and/or taking an appropriate next action). I'm prepared to believe that not much can be done about timeouts.spec in particular, but it seems to me that the long delays in the deadlock tests are not inherent in what we need to test. > For the REINDEX CONCURRENTLY failure test, the problem that needs to be = solved > isn't detecting that the command is blocked as it's already getting bloc= ked on > a heavyweight lock, but being able to reliably cancel a specific query a= s early > as possible, which AFAICS isn't possible with current isolation tester: Right, it's the same thing of needing to wait till the backend has reached a particular state before you do the next thing. > So we would actually only need something like this to make it work: > step "" [ CANCEL IF BLOCKED ] {