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 1t1ZEW-00GrJ8-JT for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Oct 2024 22:44:40 +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 1t1ZET-00BI6g-TH for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Oct 2024 22:44:38 +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 1t1ZET-00BI6X-FD for pgsql-hackers@lists.postgresql.org; Thu, 17 Oct 2024 22:44:37 +0000 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t1ZEM-001RIJ-S9 for pgsql-hackers@lists.postgresql.org; Thu, 17 Oct 2024 22:44:36 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 2564313801D9 for ; Thu, 17 Oct 2024 18:44:29 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Thu, 17 Oct 2024 18:44:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1729205069; x=1729291469; bh=9vOceO0Cp6ULSYcGpdwPVIhlrNj5FoPJ XdnsVJnTrx8=; b=B5ZmKxdm5fjIWuymwc7OTzPj335ZQYcaL4+uAU48QL5BljLV WJXGTnEaKE1Op94njZIoixIszibm8wiPa6aQpzhb54IiCLDq9syZJD1VLRKOg2u4 ipOeywLKrFJ7iseQYmhjcmTUGILONmdgT5kkAkg3AsSqAt8NAuG5L61lCCmoA9Cy ANy4lx3oZYhMppRFz3cjItzHhQ/sXywRtfCimzyUbzEsQU1/kvNSmlpn3m0t8byk 4JNabhPhm3iOFlxjlDtGvgvgDTlpnhxwyAiWI84JWFzkec8ldVRTBukW82INHaJF kG/FCA5SD+OO1oWG8BfPgirtdTajnAQ3/3ZG0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1729205069; x=1729291469; bh=9vOceO0Cp6ULSYcGpdwPVIhlrNj5FoPJXdn sVJnTrx8=; b=I8k06iYYtOCMT5ptyVM62O6JiwkNpCYtPzmh4mktI0PHvIPp7p3 b4fx7vtAepfMiQjtG+ApcB5sM3CX1hkeBHcwoIeJBDLTo/cVd2FPuiM8ZxVqIntB 3/cIFILZMXofYlXPKn8Qu9Gvi6KuvPl9OpL7AYm7INlSzfhwiFxowks2JYTuPOta AStCpOnFFA0SNk8MLByhDFAI5uwUp64sc2Rwzm4F6cuMQHp8IdyvOiQbyzSCh9nZ KaXmqg32YEh8D7W1R8Qy/GC2I7rbwy+e6dxGPesznDiMvCwJwU4wnaE/l7L5K7Ce vDxhnuIOpQWdBFn1qU0Jwnbd6EyAD8WCABQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdehvddgudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnegfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkgggt ugesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmih gthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpedvtdffteeg tdfhuefgvedvtdejgfeugfeggfejgfdvhefgfeevieektdelkefhgfenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghq uhhivghrrdighiiipdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprh gtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhq lhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 17 Oct 2024 18:44:27 -0400 (EDT) Date: Fri, 18 Oct 2024 07:44:08 +0900 From: Michael Paquier To: Postgres hackers Subject: Add isolation test template in injection_points for wait/wakeup/detach Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="T1yrj6TSUyLQZd3g" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --T1yrj6TSUyLQZd3g Content-Type: multipart/mixed; boundary="xdpr5I/IWEPOVJOl" Content-Disposition: inline --xdpr5I/IWEPOVJOl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, This was on my TODO bucket for some time. The isolation test "inplace" in the isolation test suite for injection_points relies on a couple of behaviors implemented in the backend. One of them is that a point detach should not affect a wait. Rather than having to guess this stuff from the sole isolation test we have in this module, I would like to add a simple test to document all these assumptions. This also works as a simple template for a newcomer willing to implement an isolation test with injection points. That's less intimidating than the inplace test with its VACUUM and GRANT interactions, based on an injection point run when updating the stats of a relation in VACUUM. Thoughts? -- Michael --xdpr5I/IWEPOVJOl Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-injection_points-Add-basic-isolation-test.patch" Content-Transfer-Encoding: quoted-printable =46rom 4a0ffa49c7a7b1d3d3b878780aee6f536f38a68f Mon Sep 17 00:00:00 2001 =46rom: Michael Paquier Date: Fri, 18 Oct 2024 07:40:46 +0900 Subject: [PATCH] injection_points: Add basic isolation test This can act as a template when implementing an isolation test with injection points, and tracks in a much simpler way some of the behaviors implied in the existing isolation test "inplace". Particularly, a detach should not affect a backend wait; a wait can should only be stopped by a wakeup. --- src/test/modules/injection_points/Makefile | 2 +- .../injection_points/expected/basic.out | 74 +++++++++++++++++++ src/test/modules/injection_points/meson.build | 1 + .../modules/injection_points/specs/basic.spec | 35 +++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 src/test/modules/injection_points/expected/basic.out create mode 100644 src/test/modules/injection_points/specs/basic.spec diff --git a/src/test/modules/injection_points/Makefile b/src/test/modules/= injection_points/Makefile index 8cb8c498e2..0753a9df58 100644 --- a/src/test/modules/injection_points/Makefile +++ b/src/test/modules/injection_points/Makefile @@ -13,7 +13,7 @@ PGFILEDESC =3D "injection_points - facility for injection= points" REGRESS =3D injection_points reindex_conc REGRESS_OPTS =3D --dlpath=3D$(top_builddir)/src/test/regress =20 -ISOLATION =3D inplace +ISOLATION =3D basic inplace =20 TAP_TESTS =3D 1 =20 diff --git a/src/test/modules/injection_points/expected/basic.out b/src/tes= t/modules/injection_points/expected/basic.out new file mode 100644 index 0000000000..840ce2dac9 --- /dev/null +++ b/src/test/modules/injection_points/expected/basic.out @@ -0,0 +1,74 @@ +Parsed test spec with 2 sessions + +starting permutation: wait1 wakeup2 detach2 +injection_points_attach +----------------------- + =20 +(1 row) + +step wait1: SELECT injection_points_run('injection-points-wait'); +step wakeup2: SELECT injection_points_wakeup('injection-points-wait'); +injection_points_wakeup +----------------------- + =20 +(1 row) + +step wait1: <... completed> +injection_points_run +-------------------- + =20 +(1 row) + +step detach2: SELECT injection_points_detach('injection-points-wait'); +injection_points_detach +----------------------- + =20 +(1 row) + + +starting permutation: wait1 detach2 wakeup2 +injection_points_attach +----------------------- + =20 +(1 row) + +step wait1: SELECT injection_points_run('injection-points-wait'); +step detach2: SELECT injection_points_detach('injection-points-wait'); +injection_points_detach +----------------------- + =20 +(1 row) + +step wakeup2: SELECT injection_points_wakeup('injection-points-wait'); +injection_points_wakeup +----------------------- + =20 +(1 row) + +step wait1: <... completed> +injection_points_run +-------------------- + =20 +(1 row) + + +starting permutation: detach2 wait1 wakeup2 +injection_points_attach +----------------------- + =20 +(1 row) + +step detach2: SELECT injection_points_detach('injection-points-wait'); +injection_points_detach +----------------------- + =20 +(1 row) + +step wait1: SELECT injection_points_run('injection-points-wait'); +injection_points_run +-------------------- + =20 +(1 row) + +step wakeup2: SELECT injection_points_wakeup('injection-points-wait'); +ERROR: could not find injection point injection-points-wait to wake up diff --git a/src/test/modules/injection_points/meson.build b/src/test/modul= es/injection_points/meson.build index fdb5a25d7b..58f1900115 100644 --- a/src/test/modules/injection_points/meson.build +++ b/src/test/modules/injection_points/meson.build @@ -42,6 +42,7 @@ tests +=3D { }, 'isolation': { 'specs': [ + 'basic', 'inplace', ], }, diff --git a/src/test/modules/injection_points/specs/basic.spec b/src/test/= modules/injection_points/specs/basic.spec new file mode 100644 index 0000000000..ccd49e31ed --- /dev/null +++ b/src/test/modules/injection_points/specs/basic.spec @@ -0,0 +1,35 @@ +# Basic isolation test for injection points. +# +# This checks the interactions between wakeup, wait and detach. +# Feel free to use it as a template when implementing an isolation +# test with injection points. + +setup +{ + CREATE EXTENSION injection_points; +} +teardown +{ + DROP EXTENSION injection_points; +} + +# Wait happens in the first session, wakeup in the second session. +session s1 +setup { + SELECT injection_points_set_local(); + SELECT injection_points_attach('injection-points-wait', 'wait'); +} +step wait1 { SELECT injection_points_run('injection-points-wait'); } + +session s2 +step wakeup2 { SELECT injection_points_wakeup('injection-points-wait'); } +step detach2 { SELECT injection_points_detach('injection-points-wait'); } + +# Detach after wait and wakeup. +permutation wait1 wakeup2 detach2 + +# Detach before wake. s1 waits until wakeup, ignores the detach. +permutation wait1 detach2 wakeup2 + +# Detach before wait does not cause a wait. +permutation detach2 wait1 wakeup2 --=20 2.45.2 --xdpr5I/IWEPOVJOl-- --T1yrj6TSUyLQZd3g Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmcRkzgACgkQnvQgOdby QH0Dzw/8C2UGkj7LEhjVgDnnzrThXatHVA4kyTZa+V3MkkBgu38J4npCZb778eVn xLeXRRb5sy/xWW2Q6/qzg+WpR3Ahh7hwxmX4zOsT+JjpJI4Q/5TVUu00muRnYZiO /ZXSYHP2NO3kdU1soGax2mz4CQHF8MuvIl5H2HHHR4Dxp/HaRv8jV94TJq6sqKBI KanbH3WoluGCrlwcr/nmG6NLiXY9nILNAEsloDmhqQ4zbIcafEZFDEFApDKI7v/a KGTRwtDGjbMdSUcsratbaadyUX5ta38+n0OsPsXJKr+F7PQRjcuwa/7jMg/Zg+wT nMNJLpmBZwQt3ekWvXirCfJ08NOsjr3agnesYCcMt+c/ttu51Vsw4daIja3/JPM7 CmZwzg5GCa1gccwMD+MNDk/hI0tYWbuahyBIXljPrGxi8p2rNvxQO5ztzlkby53h je+1TjAW4rSdxeQ395Vl0k9aaWz1nOj0t7QFPecMyF+jixe0ZxMhgU3/DZJHswf2 zMTVTYW3oM8VAo+ItoO4e3//D/bphDFng1J6l8YXatM4BmV9z0nG3r3l+mImhxnI KOpcO+saXcqVl3nPQRTpu69N45gVthYskYkCpMc3jl9e5Z5MmWNiv/Zy9vu6fmIK n7RLwcxryhaAQ55NHE3AivkGJdY22v0KsyRaT7T7qbsadpozjWA= =onZk -----END PGP SIGNATURE----- --T1yrj6TSUyLQZd3g--