wait_event.txt
text/plain
Filename: wait_event.txt
Type: text/plain
Part: 0
sub test_lagging_standbys
{
my ($mode, $label, $message) = @_;
$primary->adjust_conf('postgresql.conf',
'synchronized_standby_slots', "'$mode'");
$primary->reload;
$primary->safe_psql('postgres',
"SELECT pg_logical_emit_message(true, 'qtest', '$message');"
);
$primary->wait_for_replay_catchup($standby2);
my $bg = $primary->background_psql(
'postgres',
on_error_stop => 0,
timeout => $PostgreSQL::Test::Utils::timeout_default);
$bg->query_until(
qr/decode_start/, q(
\echo decode_start
SELECT pg_logical_slot_peek_changes('logical_failover', NULL, NULL); ));
ok( $primary->poll_query_until(
'postgres', q{
SELECT EXISTS (
SELECT 1
FROM pg_stat_activity
WHERE wait_event = 'WaitForStandbyConfirmation');
}),
$label);
$primary->adjust_conf('postgresql.conf',
'synchronized_standby_slots', "''");
$primary->reload;
$bg->quit;
}
# Hold back standby1 feedback
$standby1->adjust_conf(
'postgresql.conf',
'wal_receiver_status_interval',
"'0'"
);
$standby1->reload;
# FIRST 1 must wait
test_lagging_standbys(
"FIRST 1 (sb1_slot, sb2_slot)",
'FIRST 1 waits for lagging higher-priority slot',
'first_1_lagging_blocks'
);
# ANY 1 must wait
test_lagging_standbys(
"ANY 2 (sb1_slot, sb2_slot)",
'ANY 1 waits for lagging sb1_slot slot',
'any_2_lagging_blocks'
);