summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/multixact-no-deadlock.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-16 19:46:48 +0000
commit311bcfc6b3acdd6fd152798c7f287ddf74fa2a98 (patch)
tree0ec307299b1dada3701e42f4ca6eda57d708261e /src/test/isolation/specs/multixact-no-deadlock.spec
parentInitial commit. (diff)
downloadpostgresql-15-upstream.tar.xz
postgresql-15-upstream.zip
Adding upstream version 15.4.upstream/15.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/multixact-no-deadlock.spec')
-rw-r--r--src/test/isolation/specs/multixact-no-deadlock.spec35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/isolation/specs/multixact-no-deadlock.spec b/src/test/isolation/specs/multixact-no-deadlock.spec
new file mode 100644
index 0000000..a8af724
--- /dev/null
+++ b/src/test/isolation/specs/multixact-no-deadlock.spec
@@ -0,0 +1,35 @@
+# If we already hold a lock of a given strength, do not deadlock when
+# some other transaction is waiting for a conflicting lock and we try
+# to acquire the same lock we already held.
+setup
+{
+ CREATE TABLE justthis (
+ value int
+ );
+
+ INSERT INTO justthis VALUES (1);
+}
+
+teardown
+{
+ DROP TABLE justthis;
+}
+
+session s1
+setup { BEGIN; }
+step s1lock { SELECT * FROM justthis FOR SHARE; }
+step s1svpt { SAVEPOINT foo; }
+step s1lock2 { SELECT * FROM justthis FOR SHARE; }
+step s1c { COMMIT; }
+
+session s2
+setup { BEGIN; }
+step s2lock { SELECT * FROM justthis FOR SHARE; } # ensure it's a multi
+step s2c { COMMIT; }
+
+session s3
+setup { BEGIN; }
+step s3lock { SELECT * FROM justthis FOR UPDATE; }
+step s3c { COMMIT; }
+
+permutation s1lock s2lock s1svpt s3lock s1lock2 s2c s1c s3c