diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
commit | 6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch) | |
tree | 657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/test/isolation/specs/deadlock-soft.spec | |
parent | Initial commit. (diff) | |
download | postgresql-13-upstream.tar.xz postgresql-13-upstream.zip |
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/deadlock-soft.spec')
-rw-r--r-- | src/test/isolation/specs/deadlock-soft.spec | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/isolation/specs/deadlock-soft.spec b/src/test/isolation/specs/deadlock-soft.spec new file mode 100644 index 0000000..bc9c6a7 --- /dev/null +++ b/src/test/isolation/specs/deadlock-soft.spec @@ -0,0 +1,40 @@ +# Four-process deadlock with two hard edges and two soft edges. +# d2 waits for e1 (soft edge), e1 waits for d1 (hard edge), +# d1 waits for e2 (soft edge), e2 waits for d2 (hard edge). +# The deadlock detector resolves the deadlock by reversing the d1-e2 edge, +# unblocking d1. + +setup +{ + CREATE TABLE a1 (); + CREATE TABLE a2 (); +} + +teardown +{ + DROP TABLE a1, a2; +} + +session d1 +setup { BEGIN; SET deadlock_timeout = '10s'; } +step d1a1 { LOCK TABLE a1 IN ACCESS SHARE MODE; } +step d1a2 { LOCK TABLE a2 IN ACCESS SHARE MODE; } +step d1c { COMMIT; } + +session d2 +setup { BEGIN; SET deadlock_timeout = '10ms'; } +step d2a2 { LOCK TABLE a2 IN ACCESS SHARE MODE; } +step d2a1 { LOCK TABLE a1 IN ACCESS SHARE MODE; } +step d2c { COMMIT; } + +session e1 +setup { BEGIN; SET deadlock_timeout = '10s'; } +step e1l { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; } +step e1c { COMMIT; } + +session e2 +setup { BEGIN; SET deadlock_timeout = '10s'; } +step e2l { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; } +step e2c { COMMIT; } + +permutation d1a1 d2a2 e1l e2l d1a2 d2a1 d1c e1c d2c e2c |