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 1jBWCn-0001kl-CR for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 04:09:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jBWCl-0007rY-Ur for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 04:09:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jBWCl-0007rR-BR for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2020 04:09:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBWCi-0003eJ-Sm for pgsql-hackers@postgresql.org; Tue, 10 Mar 2020 04:09:18 +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 02A49Ct3032582; Tue, 10 Mar 2020 00:09:12 -0400 From: Tom Lane To: Michael Paquier cc: Andres Freund , Julien Rouhaud , pgsql-hackers Subject: Re: Add an optional timeout clause to isolationtester step. In-reply-to: <20200310025536.GC4369@paquier.xyz> References: <20200306131547.GA2904@nol> <20200307014142.GC1531@paquier.xyz> <20200307061615.c47sju2bytuiaazv@nol> <8441.1583595994@sss.pgh.pa.us> <20200307205328.ffidfyo3me46qscn@nol> <15903.1583615371@sss.pgh.pa.us> <20200307211709.6kfpiddif4uxafg5@nol> <20200309221558.7kd5fuks2alvtsex@alap3.anarazel.de> <20200310021459.GA4369@paquier.xyz> <28752.1583807547@sss.pgh.pa.us> <20200310025536.GC4369@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Tue, 10 Mar 2020 11:55:36 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32580.1583813352.1@sss.pgh.pa.us> Date: Tue, 10 Mar 2020 00:09:12 -0400 Message-ID: <32581.1583813352@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Mon, Mar 09, 2020 at 10:32:27PM -0400, Tom Lane wrote: >> It strikes me to wonder whether we could improve matters by teaching >> isolationtester to watch for particular values in a connected backend's >> pg_stat_activity.wait_event_type/wait_event columns. Those columns >> didn't exist when isolationtester was designed, IIRC, so it's not >> surprising that they're not used in the current design. But we could >> use them perhaps to detect that a backend has arrived at some state >> that's not a heavyweight-lock-wait state. > Interesting idea. So that would be basically an equivalent of > PostgresNode::poll_query_until but for the isolation tester? No, more like the existing isolationtester wait query, which watches for something being blocked on a heavyweight lock. Right now, that one depends on a bespoke function pg_isolation_test_session_is_blocked(), but it used to be a query on pg_stat_activity/pg_locks. > In short > we gain a meta-command that runs a SELECT query that waits until the > query defined in the command returns true. The polling interval may > be tricky to set though. I think it'd be just the same as the polling interval for the existing wait query. We'd have to have some way to mark a script step to say what to check to decide that it's blocked ... regards, tom lane