aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2022-03-18 18:18:00 -0700
committerNoah Misch <noah@leadboat.com>2022-03-18 18:18:00 -0700
commite186f56f9c6ead4ef65848ae6c499f9949b12625 (patch)
treeab0c719f624d1b9665a1cab9dd4dfd32664e8bdc
parent4a288a37f9b7bfd13c4f5cd8b545ac856f975813 (diff)
downloadpostgresql-e186f56f9c6ead4ef65848ae6c499f9949b12625.tar.gz
postgresql-e186f56f9c6ead4ef65848ae6c499f9949b12625.zip
Close race condition in slot_creation_error.spec.
Use the pattern from detach-partition-concurrently-3.spec. Per buildfarm member wrasse. Reviewed by Kyotaro Horiguchi and Andres Freund. Discussion: https://postgr.es/m/20220318072837.GC2739027@rfd.leadboat.com
-rw-r--r--contrib/test_decoding/expected/slot_creation_error.out20
-rw-r--r--contrib/test_decoding/specs/slot_creation_error.spec4
2 files changed, 13 insertions, 11 deletions
diff --git a/contrib/test_decoding/expected/slot_creation_error.out b/contrib/test_decoding/expected/slot_creation_error.out
index 043bdae0a28..25883b508fb 100644
--- a/contrib/test_decoding/expected/slot_creation_error.out
+++ b/contrib/test_decoding/expected/slot_creation_error.out
@@ -23,14 +23,15 @@ step s1_cancel_s2:
SELECT pg_cancel_backend(pid)
FROM pg_stat_activity
WHERE application_name = 'isolation/slot_creation_error/s2';
-
+ <waiting ...>
+step s2_init: <... completed>
+ERROR: canceling statement due to user request
+step s1_cancel_s2: <... completed>
pg_cancel_backend
-----------------
t
(1 row)
-step s2_init: <... completed>
-ERROR: canceling statement due to user request
step s1_view_slot:
SELECT slot_name, slot_type, active FROM pg_replication_slots WHERE slot_name = 'slot_creation_error'
@@ -90,18 +91,19 @@ step s1_terminate_s2:
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE application_name = 'isolation/slot_creation_error/s2';
-
-pg_terminate_backend
---------------------
-t
-(1 row)
-
+ <waiting ...>
step s2_init: <... completed>
FATAL: terminating connection due to administrator command
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
+step s1_terminate_s2: <... completed>
+pg_terminate_backend
+--------------------
+t
+(1 row)
+
step s1_c: COMMIT;
step s1_view_slot:
SELECT slot_name, slot_type, active FROM pg_replication_slots WHERE slot_name = 'slot_creation_error'
diff --git a/contrib/test_decoding/specs/slot_creation_error.spec b/contrib/test_decoding/specs/slot_creation_error.spec
index 6816696b9d1..d1e35bf58b5 100644
--- a/contrib/test_decoding/specs/slot_creation_error.spec
+++ b/contrib/test_decoding/specs/slot_creation_error.spec
@@ -35,7 +35,7 @@ step s2_init {
# The tests first start a transaction with an xid assigned in s1, then create
# a slot in s2. The slot creation waits for s1's transaction to end. Instead
# we cancel / terminate s2.
-permutation s1_b s1_xid s2_init s1_view_slot s1_cancel_s2 s1_view_slot s1_c
+permutation s1_b s1_xid s2_init s1_view_slot s1_cancel_s2(s2_init) s1_view_slot s1_c
permutation s1_b s1_xid s2_init s1_c s1_view_slot s1_drop_slot # check slot creation still works
-permutation s1_b s1_xid s2_init s1_terminate_s2 s1_c s1_view_slot
+permutation s1_b s1_xid s2_init s1_terminate_s2(s2_init) s1_c s1_view_slot
# can't run tests after this, due to s2's connection failure