summaryrefslogtreecommitdiffstats
path: root/contrib/pgrowlocks/specs/pgrowlocks.spec
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pgrowlocks/specs/pgrowlocks.spec')
-rw-r--r--contrib/pgrowlocks/specs/pgrowlocks.spec39
1 files changed, 39 insertions, 0 deletions
diff --git a/contrib/pgrowlocks/specs/pgrowlocks.spec b/contrib/pgrowlocks/specs/pgrowlocks.spec
new file mode 100644
index 0000000..4f4013c
--- /dev/null
+++ b/contrib/pgrowlocks/specs/pgrowlocks.spec
@@ -0,0 +1,39 @@
+# Tests for contrib/pgrowlocks
+
+setup {
+ CREATE TABLE multixact_conflict (a int PRIMARY KEY, b int);
+ INSERT INTO multixact_conflict VALUES (1, 2), (3, 4);
+}
+
+teardown {
+ DROP TABLE multixact_conflict;
+}
+
+session s1
+step s1_begin { BEGIN; }
+step s1_tuplock1 { SELECT * FROM multixact_conflict FOR KEY SHARE; }
+step s1_tuplock2 { SELECT * FROM multixact_conflict FOR SHARE; }
+step s1_tuplock3 { SELECT * FROM multixact_conflict FOR NO KEY UPDATE; }
+step s1_tuplock4 { SELECT * FROM multixact_conflict FOR UPDATE; }
+step s1_updatea { UPDATE multixact_conflict SET a = 10 WHERE a = 1; }
+step s1_updateb { UPDATE multixact_conflict SET b = 11 WHERE b = 4; }
+step s1_lcksvpt { SELECT * FROM multixact_conflict FOR KEY SHARE; SAVEPOINT s; }
+step s1_commit { COMMIT; }
+
+session s2
+step s2_rowlocks { SELECT locked_row, multi, modes FROM pgrowlocks('multixact_conflict'); }
+
+permutation s1_begin s1_tuplock1 s2_rowlocks s1_commit
+permutation s1_begin s1_tuplock2 s2_rowlocks s1_commit
+permutation s1_begin s1_tuplock3 s2_rowlocks s1_commit
+permutation s1_begin s1_tuplock4 s2_rowlocks s1_commit
+permutation s1_begin s1_updatea s2_rowlocks s1_commit
+permutation s1_begin s1_updateb s2_rowlocks s1_commit
+
+# test multixact cases using savepoints
+permutation s1_begin s1_lcksvpt s1_tuplock1 s2_rowlocks s1_commit
+permutation s1_begin s1_lcksvpt s1_tuplock2 s2_rowlocks s1_commit
+permutation s1_begin s1_lcksvpt s1_tuplock3 s2_rowlocks s1_commit
+permutation s1_begin s1_lcksvpt s1_tuplock4 s2_rowlocks s1_commit
+permutation s1_begin s1_lcksvpt s1_updatea s2_rowlocks s1_commit
+permutation s1_begin s1_lcksvpt s1_updateb s2_rowlocks s1_commit