mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Integrate recovery.conf into postgresql.conf
recovery.conf settings are now set in postgresql.conf (or other GUC sources). Currently, all the affected settings are PGC_POSTMASTER; this could be refined in the future case by case. Recovery is now initiated by a file recovery.signal. Standby mode is initiated by a file standby.signal. The standby_mode setting is gone. If a recovery.conf file is found, an error is issued. The trigger_file setting has been renamed to promote_trigger_file as part of the move. The documentation chapter "Recovery Configuration" has been integrated into "Server Configuration". pg_basebackup -R now appends settings to postgresql.auto.conf and creates a standby.signal file. Author: Fujii Masao <masao.fujii@gmail.com> Author: Simon Riggs <simon@2ndquadrant.com> Author: Abhijit Menon-Sen <ams@2ndquadrant.com> Author: Sergei Kornilov <sk@zsrv.org> Discussion: https://www.postgresql.org/message-id/flat/607741529606767@web3g.yandex.ru/
This commit is contained in:
@ -635,8 +635,6 @@ of a backup previously created on that node with $node->backup.
|
||||
|
||||
Does not start the node after initializing it.
|
||||
|
||||
A recovery.conf is not created.
|
||||
|
||||
Streaming replication can be enabled on this node by passing the keyword
|
||||
parameter has_streaming => 1. This is disabled by default.
|
||||
|
||||
@ -834,10 +832,10 @@ sub enable_streaming
|
||||
|
||||
print "### Enabling streaming replication for node \"$name\"\n";
|
||||
$self->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
primary_conninfo='$root_connstr application_name=$name'
|
||||
standby_mode=on
|
||||
));
|
||||
$self->set_standby_mode();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -863,10 +861,26 @@ sub enable_restoring
|
||||
: qq{cp "$path/%f" "%p"};
|
||||
|
||||
$self->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
restore_command = '$copy_command'
|
||||
standby_mode = on
|
||||
));
|
||||
$self->set_standby_mode();
|
||||
return;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item $node->set_standby_mode()
|
||||
|
||||
Place standby.signal file.
|
||||
|
||||
=cut
|
||||
|
||||
sub set_standby_mode
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
$self->append_conf('standby.signal', '');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ is( $node_master->psql(
|
||||
qq[SELECT pg_create_physical_replication_slot('$slotname_1');]),
|
||||
0,
|
||||
'physical slot created on master');
|
||||
$node_standby_1->append_conf('recovery.conf',
|
||||
$node_standby_1->append_conf('postgresql.conf',
|
||||
"primary_slot_name = $slotname_1");
|
||||
$node_standby_1->append_conf('postgresql.conf',
|
||||
"wal_receiver_status_interval = 1");
|
||||
@ -142,7 +142,7 @@ is( $node_standby_1->psql(
|
||||
qq[SELECT pg_create_physical_replication_slot('$slotname_2');]),
|
||||
0,
|
||||
'physical slot created on intermediate replica');
|
||||
$node_standby_2->append_conf('recovery.conf',
|
||||
$node_standby_2->append_conf('postgresql.conf',
|
||||
"primary_slot_name = $slotname_2");
|
||||
$node_standby_2->append_conf('postgresql.conf',
|
||||
"wal_receiver_status_interval = 1");
|
||||
|
@ -23,7 +23,7 @@ sub test_recovery_standby
|
||||
|
||||
foreach my $param_item (@$recovery_params)
|
||||
{
|
||||
$node_standby->append_conf('recovery.conf', qq($param_item));
|
||||
$node_standby->append_conf('postgresql.conf', qq($param_item));
|
||||
}
|
||||
|
||||
$node_standby->start;
|
||||
|
@ -47,12 +47,10 @@ $node_standby_1->psql('postgres', "SELECT pg_promote(wait_seconds => 300)",
|
||||
is($psql_out, 't', "promotion of standby with pg_promote");
|
||||
|
||||
# Switch standby 2 to replay from standby 1
|
||||
rmtree($node_standby_2->data_dir . '/recovery.conf');
|
||||
my $connstr_1 = $node_standby_1->connstr;
|
||||
$node_standby_2->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
primary_conninfo='$connstr_1 application_name=@{[$node_standby_2->name]}'
|
||||
standby_mode=on
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_standby_2->restart;
|
||||
|
@ -25,7 +25,7 @@ my $delay = 3;
|
||||
$node_standby->init_from_backup($node_master, $backup_name,
|
||||
has_streaming => 1);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_min_apply_delay = '${delay}s'
|
||||
));
|
||||
$node_standby->start;
|
||||
|
@ -230,7 +230,7 @@ is($psql_rc, '0', "Restore of prepared transaction on promoted standby");
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_standby->start;
|
||||
@ -268,7 +268,7 @@ is($psql_out, '1',
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_standby->start;
|
||||
@ -308,7 +308,7 @@ is($psql_out, '1',
|
||||
# restart old master as new standby
|
||||
$cur_standby->enable_streaming($cur_master);
|
||||
$cur_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$cur_standby->start;
|
||||
|
@ -76,7 +76,7 @@ $node_replica->init_from_backup(
|
||||
$node_master, $backup_name,
|
||||
has_streaming => 1,
|
||||
has_restoring => 1);
|
||||
$node_replica->append_conf('recovery.conf',
|
||||
$node_replica->append_conf('postgresql.conf',
|
||||
q[primary_slot_name = 'phys_slot']);
|
||||
|
||||
$node_replica->start;
|
||||
|
@ -120,7 +120,7 @@ is($psql_out, '8128', "Visible");
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_standby->start;
|
||||
@ -171,7 +171,7 @@ is($psql_out, '-1', "Not visible");
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_standby->start;
|
||||
@ -212,7 +212,7 @@ is($psql_out, '-1', "Not visible");
|
||||
($node_master, $node_standby) = ($node_standby, $node_master);
|
||||
$node_standby->enable_streaming($node_master);
|
||||
$node_standby->append_conf(
|
||||
'recovery.conf', qq(
|
||||
'postgresql.conf', qq(
|
||||
recovery_target_timeline='latest'
|
||||
));
|
||||
$node_standby->start;
|
||||
|
Reference in New Issue
Block a user