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-2.spec | |
parent | Initial commit. (diff) | |
download | postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.tar.xz postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.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-2.spec')
-rw-r--r-- | src/test/isolation/specs/deadlock-soft-2.spec | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/isolation/specs/deadlock-soft-2.spec b/src/test/isolation/specs/deadlock-soft-2.spec new file mode 100644 index 0000000..5b7d3db --- /dev/null +++ b/src/test/isolation/specs/deadlock-soft-2.spec @@ -0,0 +1,43 @@ +# Soft deadlock requiring reversal of multiple wait-edges. s1 must +# jump over both s3 and s4 and acquire the lock on a2 immediately, +# since s3 and s4 are hard-blocked on a1. + +setup +{ + CREATE TABLE a1 (); + CREATE TABLE a2 (); +} + +teardown +{ + DROP TABLE a1, a2; +} + +session s1 +setup { BEGIN; SET deadlock_timeout = '10ms'; } +step s1a { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; } +step s1b { LOCK TABLE a2 IN SHARE UPDATE EXCLUSIVE MODE; } +step s1c { COMMIT; } + +session s2 +setup { BEGIN; SET deadlock_timeout = '100s'; } +step s2a { LOCK TABLE a2 IN ACCESS SHARE MODE; } +step s2b { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; } +step s2c { COMMIT; } + +session s3 +setup { BEGIN; SET deadlock_timeout = '100s'; } +step s3a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; } +step s3c { COMMIT; } + +session s4 +setup { BEGIN; SET deadlock_timeout = '100s'; } +step s4a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; } +step s4c { COMMIT; } + +# The expected output for this test assumes that isolationtester will +# detect step s1b as waiting before the deadlock detector runs and +# releases s1 from its blocked state. To ensure that happens even in +# very slow (CLOBBER_CACHE_ALWAYS) cases, apply a (*) annotation. + +permutation s1a s2a s2b s3a s4a s1b(*) s1c s2c s3c s4c |