Skip to content

Commit e186f56

Browse files
committed
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
1 parent 4a288a3 commit e186f56

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

contrib/test_decoding/expected/slot_creation_error.out

+11-9
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ step s1_cancel_s2:
2323
SELECT pg_cancel_backend(pid)
2424
FROM pg_stat_activity
2525
WHERE application_name = 'isolation/slot_creation_error/s2';
26-
26+
<waiting ...>
27+
step s2_init: <... completed>
28+
ERROR: canceling statement due to user request
29+
step s1_cancel_s2: <... completed>
2730
pg_cancel_backend
2831
-----------------
2932
t
3033
(1 row)
3134

32-
step s2_init: <... completed>
33-
ERROR: canceling statement due to user request
3435
step s1_view_slot:
3536
SELECT slot_name, slot_type, active FROM pg_replication_slots WHERE slot_name = 'slot_creation_error'
3637

@@ -90,18 +91,19 @@ step s1_terminate_s2:
9091
SELECT pg_terminate_backend(pid)
9192
FROM pg_stat_activity
9293
WHERE application_name = 'isolation/slot_creation_error/s2';
93-
94-
pg_terminate_backend
95-
--------------------
96-
t
97-
(1 row)
98-
94+
<waiting ...>
9995
step s2_init: <... completed>
10096
FATAL: terminating connection due to administrator command
10197
server closed the connection unexpectedly
10298
This probably means the server terminated abnormally
10399
before or while processing the request.
104100

101+
step s1_terminate_s2: <... completed>
102+
pg_terminate_backend
103+
--------------------
104+
t
105+
(1 row)
106+
105107
step s1_c: COMMIT;
106108
step s1_view_slot:
107109
SELECT slot_name, slot_type, active FROM pg_replication_slots WHERE slot_name = 'slot_creation_error'

contrib/test_decoding/specs/slot_creation_error.spec

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ step s2_init {
3535
# The tests first start a transaction with an xid assigned in s1, then create
3636
# a slot in s2. The slot creation waits for s1's transaction to end. Instead
3737
# we cancel / terminate s2.
38-
permutation s1_b s1_xid s2_init s1_view_slot s1_cancel_s2 s1_view_slot s1_c
38+
permutation s1_b s1_xid s2_init s1_view_slot s1_cancel_s2(s2_init) s1_view_slot s1_c
3939
permutation s1_b s1_xid s2_init s1_c s1_view_slot s1_drop_slot # check slot creation still works
40-
permutation s1_b s1_xid s2_init s1_terminate_s2 s1_c s1_view_slot
40+
permutation s1_b s1_xid s2_init s1_terminate_s2(s2_init) s1_c s1_view_slot
4141
# can't run tests after this, due to s2's connection failure

0 commit comments

Comments
 (0)