File tree Expand file tree Collapse file tree 2 files changed +26
-9
lines changed Expand file tree Collapse file tree 2 files changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -22,17 +22,26 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_p', 'test
2222 init
2323(1 row)
2424
25- -- reconnect to clean temp slots
26- \c
25+ -- here we want to start a new session and wait till old one is gone
26+ select pg_backend_pid() as oldpid \gset
27+ \c -
28+ do 'declare c int = 0;
29+ begin
30+ while (select count(*) from pg_stat_activity where pid = '
31+ :'oldpid'
32+ ') > 0 loop c := c + 1; perform pg_stat_clear_snapshot(); end loop;
33+ raise log ''slot test looped % times'', c;
34+ end';
35+ -- should fail because the temporary slot was dropped automatically
36+ SELECT pg_drop_replication_slot('regression_slot_t');
37+ ERROR: replication slot "regression_slot_t" does not exist
38+ -- permanent slot has survived
2739SELECT pg_drop_replication_slot('regression_slot_p');
2840 pg_drop_replication_slot
2941--------------------------
3042
3143(1 row)
3244
33- -- should fail because the temporary slot was dropped automatically
34- SELECT pg_drop_replication_slot('regression_slot_t');
35- ERROR: replication slot "regression_slot_t" does not exist
3645-- test switching between slots in a session
3746SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot1', 'test_decoding', true);
3847 ?column?
Original file line number Diff line number Diff line change @@ -4,14 +4,22 @@ SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot_t', 'test
44SELECT pg_drop_replication_slot(' regression_slot_p' );
55SELECT ' init' FROM pg_create_logical_replication_slot(' regression_slot_p' , ' test_decoding' , false);
66
7- -- reconnect to clean temp slots
8- \c
9-
10- SELECT pg_drop_replication_slot(' regression_slot_p' );
7+ -- here we want to start a new session and wait till old one is gone
8+ select pg_backend_pid() as oldpid \gset
9+ \c -
10+ do ' declare c int = 0;
11+ begin
12+ while (select count(*) from pg_stat_activity where pid = '
13+ :' oldpid'
14+ ' ) > 0 loop c := c + 1; perform pg_stat_clear_snapshot(); end loop;
15+ raise log ' ' slot test looped % times' ' , c;
16+ end' ;
1117
1218-- should fail because the temporary slot was dropped automatically
1319SELECT pg_drop_replication_slot(' regression_slot_t' );
1420
21+ -- permanent slot has survived
22+ SELECT pg_drop_replication_slot(' regression_slot_p' );
1523
1624-- test switching between slots in a session
1725SELECT ' init' FROM pg_create_logical_replication_slot(' regression_slot1' , ' test_decoding' , true);
You can’t perform that action at this time.
0 commit comments