mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add pg_promote function
This function is able to promote a standby with this new SQL-callable function. Execution access can be granted to non-superusers so that failover tools can observe the principle of least privilege. Catalog version is bumped. Author: Laurenz Albe Reviewed-by: Michael Paquier, Masahiko Sawada Discussion: https://postgr.es/m/6e7c79b3ec916cf49742fb8849ed17cd87aed620.camel@cybertec.at
This commit is contained in:
@ -6,7 +6,7 @@ use warnings;
|
||||
use File::Path qw(rmtree);
|
||||
use PostgresNode;
|
||||
use TestLib;
|
||||
use Test::More tests => 1;
|
||||
use Test::More tests => 2;
|
||||
|
||||
$ENV{PGDATABASE} = 'postgres';
|
||||
|
||||
@ -37,9 +37,14 @@ $node_master->safe_psql('postgres',
|
||||
$node_master->wait_for_catchup($node_standby_1, 'replay',
|
||||
$node_master->lsn('write'));
|
||||
|
||||
# Stop and remove master, and promote standby 1, switching it to a new timeline
|
||||
# Stop and remove master
|
||||
$node_master->teardown_node;
|
||||
$node_standby_1->promote;
|
||||
|
||||
# promote standby 1 using "pg_promote", switching it to a new timeline
|
||||
my $psql_out = '';
|
||||
$node_standby_1->psql('postgres', "SELECT pg_promote(wait_seconds => 300)",
|
||||
stdout => \$psql_out);
|
||||
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');
|
||||
|
Reference in New Issue
Block a user