summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/reindex-concurrently.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/test/isolation/specs/reindex-concurrently.spec
parentInitial commit. (diff)
downloadpostgresql-14-46651ce6fe013220ed397add242004d764fc0153.tar.xz
postgresql-14-46651ce6fe013220ed397add242004d764fc0153.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/reindex-concurrently.spec')
-rw-r--r--src/test/isolation/specs/reindex-concurrently.spec40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/isolation/specs/reindex-concurrently.spec b/src/test/isolation/specs/reindex-concurrently.spec
new file mode 100644
index 0000000..31844bd
--- /dev/null
+++ b/src/test/isolation/specs/reindex-concurrently.spec
@@ -0,0 +1,40 @@
+# REINDEX CONCURRENTLY
+#
+# Ensure that concurrent operations work correctly when a REINDEX is performed
+# concurrently.
+
+setup
+{
+ CREATE TABLE reind_con_tab(id serial primary key, data text);
+ INSERT INTO reind_con_tab(data) VALUES ('aa');
+ INSERT INTO reind_con_tab(data) VALUES ('aaa');
+ INSERT INTO reind_con_tab(data) VALUES ('aaaa');
+ INSERT INTO reind_con_tab(data) VALUES ('aaaaa');
+}
+
+teardown
+{
+ DROP TABLE reind_con_tab;
+}
+
+session s1
+setup { BEGIN; }
+step sel1 { SELECT data FROM reind_con_tab WHERE id = 3; }
+step end1 { COMMIT; }
+
+session s2
+setup { BEGIN; }
+step upd2 { UPDATE reind_con_tab SET data = 'bbbb' WHERE id = 3; }
+step ins2 { INSERT INTO reind_con_tab(data) VALUES ('cccc'); }
+step del2 { DELETE FROM reind_con_tab WHERE data = 'cccc'; }
+step end2 { COMMIT; }
+
+session s3
+step reindex { REINDEX TABLE CONCURRENTLY reind_con_tab; }
+
+permutation reindex sel1 upd2 ins2 del2 end1 end2
+permutation sel1 reindex upd2 ins2 del2 end1 end2
+permutation sel1 upd2 reindex ins2 del2 end1 end2
+permutation sel1 upd2 ins2 reindex del2 end1 end2
+permutation sel1 upd2 ins2 del2 reindex end1 end2
+permutation sel1 upd2 ins2 del2 end1 reindex end2