summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/deadlock-simple.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
commit293913568e6a7a86fd1479e1cff8e2ecb58d6568 (patch)
treefc3b469a3ec5ab71b36ea97cc7aaddb838423a0c /src/test/isolation/specs/deadlock-simple.spec
parentInitial commit. (diff)
downloadpostgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.tar.xz
postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.zip
Adding upstream version 16.2.upstream/16.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/deadlock-simple.spec')
-rw-r--r--src/test/isolation/specs/deadlock-simple.spec29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/isolation/specs/deadlock-simple.spec b/src/test/isolation/specs/deadlock-simple.spec
new file mode 100644
index 0000000..3086dc7
--- /dev/null
+++ b/src/test/isolation/specs/deadlock-simple.spec
@@ -0,0 +1,29 @@
+# The deadlock detector has a special case for "simple" deadlocks. A simple
+# deadlock occurs when we attempt a lock upgrade while another process waits
+# for a lock upgrade on the same object; and the sought locks conflict with
+# those already held, so that neither process can complete its upgrade until
+# the other releases locks. Test this scenario.
+
+setup
+{
+ CREATE TABLE a1 ();
+}
+
+teardown
+{
+ DROP TABLE a1;
+}
+
+session s1
+setup { BEGIN; }
+step s1as { LOCK TABLE a1 IN ACCESS SHARE MODE; }
+step s1ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
+step s1c { COMMIT; }
+
+session s2
+setup { BEGIN; }
+step s2as { LOCK TABLE a1 IN ACCESS SHARE MODE; }
+step s2ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
+step s2c { COMMIT; }
+
+permutation s1as s2as s1ae s2ae s1c s2c