public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Andres Freund <[email protected]>
Cc: Bertrand Drouvot <[email protected]>
Cc: Jeff Davis <[email protected]>
Cc: Greg Sabino Mullane <[email protected]>
Cc: [email protected]
Subject: Re: Adding locks statistics
Date: Mon, 6 Apr 2026 15:34:44 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<acSwlC46/[email protected]>
	<[email protected]>
	<[email protected]>
	<rp6wz4lnz5qn4zlh7uxtavzfrmqvycy2g42z4zasfss2gxi54f@zzcsjdvdflwp>
	<[email protected]>

On Mon, Apr 06, 2026 at 03:19:57PM +0900, Michael Paquier wrote:
> Now looking at it, and for the reason why 010 for concurrent indexes
> does not complain..

This one was a simple puzzle: there was a race condition between the
detach done by a local point and the wait/detach sequence.  As we want
a detach, dropping the local point is proving to work here.

I am going to do a few more runs to gain some more confidence.
Bertrand, could you confirm please?
--
Michael

From 684a26ad148a6d3d4261a633978702f76d7ee537 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Mon, 6 Apr 2026 15:34:03 +0900
Subject: [PATCH] Fix detach timing problem in lock stats test

---
 src/test/modules/test_misc/t/011_lock_stats.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/test/modules/test_misc/t/011_lock_stats.pl b/src/test/modules/test_misc/t/011_lock_stats.pl
index 58a0046a52c3..908ade55a05f 100644
--- a/src/test/modules/test_misc/t/011_lock_stats.pl
+++ b/src/test/modules/test_misc/t/011_lock_stats.pl
@@ -31,9 +31,8 @@ sub setup_sessions
 	$s2 = $node->background_psql('postgres');
 
 	# Setup injection points for the waiting session
-	$s2->query_safe(
-		q[
-			SELECT injection_points_set_local();
+	$s2->query_until(qr/attaching_injection_point/, q[
+			\echo attaching_injection_point
 			SELECT injection_points_attach('deadlock-timeout-fired', 'wait');
 		]);
 }
@@ -59,10 +58,11 @@ sub wait_and_detach
 	my ($node, $point_name) = @_;
 
 	$node->wait_for_event('client backend', $point_name);
-	$node->safe_psql('postgres',
-		"SELECT injection_points_detach('$point_name');");
-	$node->safe_psql('postgres',
-		"SELECT injection_points_wakeup('$point_name');");
+	$node->safe_psql(
+		'postgres', qq[
+SELECT injection_points_detach('$point_name');
+SELECT injection_points_wakeup('$point_name');
+]);
 }
 
 # Node initialization
-- 
2.53.0



Attachments:

  [text/plain] 0001-Fix-detach-timing-problem-in-lock-stats-test.patch (1.4K, 2-0001-Fix-detach-timing-problem-in-lock-stats-test.patch)
  download | inline diff:
From 684a26ad148a6d3d4261a633978702f76d7ee537 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Mon, 6 Apr 2026 15:34:03 +0900
Subject: [PATCH] Fix detach timing problem in lock stats test

---
 src/test/modules/test_misc/t/011_lock_stats.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/test/modules/test_misc/t/011_lock_stats.pl b/src/test/modules/test_misc/t/011_lock_stats.pl
index 58a0046a52c3..908ade55a05f 100644
--- a/src/test/modules/test_misc/t/011_lock_stats.pl
+++ b/src/test/modules/test_misc/t/011_lock_stats.pl
@@ -31,9 +31,8 @@ sub setup_sessions
 	$s2 = $node->background_psql('postgres');
 
 	# Setup injection points for the waiting session
-	$s2->query_safe(
-		q[
-			SELECT injection_points_set_local();
+	$s2->query_until(qr/attaching_injection_point/, q[
+			\echo attaching_injection_point
 			SELECT injection_points_attach('deadlock-timeout-fired', 'wait');
 		]);
 }
@@ -59,10 +58,11 @@ sub wait_and_detach
 	my ($node, $point_name) = @_;
 
 	$node->wait_for_event('client backend', $point_name);
-	$node->safe_psql('postgres',
-		"SELECT injection_points_detach('$point_name');");
-	$node->safe_psql('postgres',
-		"SELECT injection_points_wakeup('$point_name');");
+	$node->safe_psql(
+		'postgres', qq[
+SELECT injection_points_detach('$point_name');
+SELECT injection_points_wakeup('$point_name');
+]);
 }
 
 # Node initialization
-- 
2.53.0



  [application/pgp-signature] signature.asc (833B, 3-signature.asc)
  download

view thread (43+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Adding locks statistics
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox