Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec86af9

Browse files
committed
Fix another race-condition-ish issue in recovery/t/001_stream_rep.pl.
Buildfarm members hornet and sungazer have shown multiple instances of"Failed test 'xmin of non-cascaded slot with hs feedback has changed'".The reason seems to be that the test is checking the current xmin of themaster server's replication slot against a past xmin of the first slaveserver's replication slot. Even though the latter slot is downstream ofthe former, it's possible for its reported xmin to be ahead of the former'sreported xmin, because those numbers are updated whenever the respectivedownstream walreceiver feels like it (see logic in WalReceiverMain).Instrumenting this test shows that indeed the slave slot's xmin does oftenadvance before the master's does, especially if an autovacuum transactionmanages to occur during the relevant window. If we happen to capture suchan advanced xmin as $xmin, then the subsequent wait_slot_xmins call canfall through before the master's xmin has advanced at all, and then if itadvances before the get_slot_xmins call, we can get the observed failure.Yeah, that's a bit of a long chain of deduction, but it's hard to explainany other way how the test can get past an "xmin <> '$xmin'" check onlyto have the next query find that xmin does equal $xmin.Fix by keeping separate images of the master and slave slots' xminsand testing their has-xmin-advanced conditions independently.
1 parentff68e90 commitec86af9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

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

223-
($xmin,$catalog_xmin) = get_slot_xmins($node_standby_1,$slotname_2);
224-
isnt($xmin,'','xmin of cascaded slot non-null with hs feedback');
225-
is($catalog_xmin,'','catalog xmin of cascaded slot still null with hs_feedback');
223+
my ($xmin1,$catalog_xmin1) = get_slot_xmins($node_standby_1,$slotname_2);
224+
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');
226226

227227
note"doing some work to advance xmin";
228228
$node_master->safe_psql('postgres',q{
@@ -245,16 +245,16 @@ sub replay_check
245245
wait_slot_xmins($node_master,$slotname_1,"xmin <> '$xmin'");
246246

247247
my ($xmin2,$catalog_xmin2) = get_slot_xmins($node_master,$slotname_1);
248-
note"new xmin$xmin2, old xmin$xmin";
248+
note"master slot'snew xmin$xmin2, old xmin$xmin";
249249
isnt($xmin2,$xmin,'xmin of non-cascaded slot with hs feedback has changed');
250250
is($catalog_xmin2,'',
251251
'catalog xmin of non-cascaded slot still null with hs_feedback unchanged');
252252

253-
wait_slot_xmins($node_standby_1,$slotname_2,"xmin <> '$xmin'");
253+
wait_slot_xmins($node_standby_1,$slotname_2,"xmin <> '$xmin1'");
254254

255255
($xmin2,$catalog_xmin2) = get_slot_xmins($node_standby_1,$slotname_2);
256-
note"new xmin$xmin2, old xmin$xmin";
257-
isnt($xmin2,$xmin,'xmin of cascaded slot with hs feedback has changed');
256+
note"standby_1 slot'snew xmin$xmin2, old xmin$xmin1";
257+
isnt($xmin2,$xmin1,'xmin of cascaded slot with hs feedback has changed');
258258
is($catalog_xmin2,'',
259259
'catalog xmin of cascaded slot still null with hs_feedback unchanged');
260260

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp