Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4576a69

Browse files
committed
Fix yet another race condition in recovery/t/001_stream_rep.pl.
In commit 5c77690, we added polling in front of most of the get_slot_xmins calls in 001_stream_rep.pl, but today's results from buildfarm member nightjar show that at least one more poll loop is needed. Proactively add a poll loop before the next-to-last get_slot_xmins call as well. It may be that there is no race condition there because the standby_2 server is shut down at that point, but I'm quite tired of fighting with this test script. The empirical evidence that it's safe, from the buildfarm, is no stronger than the evidence for the other call that nightjar just proved unsafe. The only remaining get_slot_xmins calls without wait_slot_xmins protection are the first two, which should be OK since nothing has happened at that point. It's tempting to ignore that special case and merge get_slot_xmins and wait_slot_xmins into a single function. I didn't go that far though. Discussion: https://postgr.es/m/18436.1502228036@sss.pgh.pa.us
1 parent b2c95a3 commit 4576a69

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/test/recovery/t/001_stream_rep.pl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,13 @@ sub replay_check
220220
is($catalog_xmin, '',
221221
'catalog xmin of non-cascaded slot still null with hs_feedback');
222222

223+
wait_slot_xmins($node_standby_1, $slotname_2,
224+
"xmin IS NOT NULL AND catalog_xmin IS NULL");
225+
223226
my ($xmin1, $catalog_xmin1) = get_slot_xmins($node_standby_1, $slotname_2);
224227
isnt($xmin1, '', 'xmin of cascaded slot non-null with hs feedback');
225-
is($catalog_xmin1, '', 'catalog xmin of cascaded slot still null with hs_feedback');
228+
is($catalog_xmin1, '',
229+
'catalog xmin of cascaded slot still null with hs_feedback');
226230

227231
note "doing some work to advance xmin";
228232
$node_master->safe_psql('postgres', q{
@@ -297,6 +301,8 @@ sub replay_check
297301
'ALTER SYSTEM SET hot_standby_feedback = off;');
298302
$node_standby_2->stop;
299303

304+
wait_slot_xmins($node_standby_1, $slotname_2, "xmin IS NOT NULL");
305+
300306
($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2);
301307
isnt($xmin, '', 'xmin of cascaded slot non-null with postgres shut down');
302308

0 commit comments

Comments
 (0)