mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-23 16:17:17 +02:00
Fix test instability
On FreeBSD, the new test fails due to a WAL file being removed before the standby has had the chance to copy it. Fix by adding a replication slot to prevent the removal until after the standby has connected. Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reported-by: Matthias van de Meent <boekewurm+postgres@gmail.com> Discussion: https://postgr.es/m/CAEze2Wj5nau_qpjbwihvmXLfkAWOZ5TKdbnqOc6nKSiRJEoPyQ@mail.gmail.com
This commit is contained in:
parent
5a10c262fc
commit
fcd72cf295
@ -24,6 +24,7 @@ sub test_tablespace
|
|||||||
CREATE TABLESPACE source_ts LOCATION '';
|
CREATE TABLESPACE source_ts LOCATION '';
|
||||||
CREATE TABLESPACE target_ts LOCATION '';
|
CREATE TABLESPACE target_ts LOCATION '';
|
||||||
CREATE DATABASE template_db IS_TEMPLATE = true;
|
CREATE DATABASE template_db IS_TEMPLATE = true;
|
||||||
|
SELECT pg_create_physical_replication_slot('slot', true);
|
||||||
]);
|
]);
|
||||||
my $backup_name = 'my_backup';
|
my $backup_name = 'my_backup';
|
||||||
$node_primary->backup($backup_name);
|
$node_primary->backup($backup_name);
|
||||||
@ -38,10 +39,11 @@ sub test_tablespace
|
|||||||
# Make sure connection is made
|
# Make sure connection is made
|
||||||
$node_primary->poll_query_until('postgres',
|
$node_primary->poll_query_until('postgres',
|
||||||
'SELECT count(*) = 1 FROM pg_stat_replication');
|
'SELECT count(*) = 1 FROM pg_stat_replication');
|
||||||
|
$node_primary->safe_psql('postgres', "SELECT pg_drop_replication_slot('slot')");
|
||||||
|
|
||||||
$node_standby->safe_psql('postgres', 'CHECKPOINT');
|
$node_standby->safe_psql('postgres', 'CHECKPOINT');
|
||||||
|
|
||||||
# Do immediate shutdown just after a sequence of CREAT DATABASE / DROP
|
# Do immediate shutdown just after a sequence of CREATE DATABASE / DROP
|
||||||
# DATABASE / DROP TABLESPACE. This causes CREATE DATABASE WAL records
|
# DATABASE / DROP TABLESPACE. This causes CREATE DATABASE WAL records
|
||||||
# to be applied to already-removed directories.
|
# to be applied to already-removed directories.
|
||||||
my $query = q[
|
my $query = q[
|
||||||
|
Loading…
Reference in New Issue
Block a user