v6-0002-Add-test-for-CIC-with-prepared-xacts.patch
application/octet-stream
Filename: v6-0002-Add-test-for-CIC-with-prepared-xacts.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v6-0002
Subject: Add test for CIC with prepared xacts
| File | + | − |
|---|---|---|
| src/test/isolation/expected/prepared-transactions-cic.out | 18 | 0 |
| src/test/isolation/Makefile | 2 | 2 |
| src/test/isolation/specs/prepared-transactions-cic.spec | 34 | 0 |
From 249671aaaddee54670f48309a137bed3524dec8c Mon Sep 17 00:00:00 2001
From: Andrey Borodin <amborodin@acm.org>
Date: Sun, 20 Dec 2020 23:03:01 +0500
Subject: [PATCH v6 2/2] Add test for CIC with prepared xacts
---
src/test/isolation/Makefile | 4 +--
.../expected/prepared-transactions-cic.out | 18 ++++++++++
.../specs/prepared-transactions-cic.spec | 34 +++++++++++++++++++
3 files changed, 54 insertions(+), 2 deletions(-)
create mode 100644 src/test/isolation/expected/prepared-transactions-cic.out
create mode 100644 src/test/isolation/specs/prepared-transactions-cic.spec
diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile
index d23e2cec64..a1c3248eb4 100644
--- a/src/test/isolation/Makefile
+++ b/src/test/isolation/Makefile
@@ -67,7 +67,7 @@ check: all
# via TEMP_CONFIG for the check case, or via the postgresql.conf for the
# installcheck case.
installcheck-prepared-txns: all temp-install
- $(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule prepared-transactions
+ $(pg_isolation_regress_installcheck) --schedule=$(srcdir)/isolation_schedule prepared-transactions prepared-transactions-cic
check-prepared-txns: all temp-install
- $(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule prepared-transactions
+ $(pg_isolation_regress_check) --schedule=$(srcdir)/isolation_schedule prepared-transactions prepared-transactions-cic
diff --git a/src/test/isolation/expected/prepared-transactions-cic.out b/src/test/isolation/expected/prepared-transactions-cic.out
new file mode 100644
index 0000000000..043ec3c363
--- /dev/null
+++ b/src/test/isolation/expected/prepared-transactions-cic.out
@@ -0,0 +1,18 @@
+Parsed test spec with 2 sessions
+
+starting permutation: w1 p1 cic2 c1 r2
+step w1: BEGIN; INSERT INTO cic_test VALUES (1);
+step p1: PREPARE TRANSACTION 's1';
+step cic2:
+ CREATE INDEX CONCURRENTLY on cic_test(a);
+
+ERROR: canceling statement due to lock timeout
+step c1: COMMIT PREPARED 's1';
+step r2:
+ SET enable_seqscan to off;
+ SET enable_bitmapscan to off;
+ SELECT * FROM cic_test WHERE a = 1;
+
+a
+
+1
diff --git a/src/test/isolation/specs/prepared-transactions-cic.spec b/src/test/isolation/specs/prepared-transactions-cic.spec
new file mode 100644
index 0000000000..65e2c00b4c
--- /dev/null
+++ b/src/test/isolation/specs/prepared-transactions-cic.spec
@@ -0,0 +1,34 @@
+# This test verifies that CREATE INDEX CONCURRENTLY interact with
+# prepared transactions correctly.
+setup
+{
+ CREATE TABLE cic_test (a int);
+}
+
+teardown
+{
+ DROP TABLE cic_test;
+}
+
+
+# Sessions for CREATE INDEX CONCURRENTLY test
+session "s1"
+step "w1" { BEGIN; INSERT INTO cic_test VALUES (1); }
+step "p1" { PREPARE TRANSACTION 's1'; }
+step "c1" { COMMIT PREPARED 's1'; }
+
+session "s2"
+setup { SET lock_timeout = 10; }
+step "cic2"
+{
+ CREATE INDEX CONCURRENTLY on cic_test(a);
+}
+step "r2"
+{
+ SET enable_seqscan to off;
+ SET enable_bitmapscan to off;
+ SELECT * FROM cic_test WHERE a = 1;
+}
+
+
+permutation "w1" "p1" "cic2" "c1" "r2"
--
2.24.3 (Apple Git-128)