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

Commit7524c78

Browse files
committed
pg_rewind: test new --write-recovery-conf functionality
Author: Alexey KondratovReviewed-by: Paul GuoDiscussion:https://postgr.es/m/2f726102-3f1e-bf16-061e-501919473ace@postgrespro.ru
1 parent927474c commit7524c78

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

‎src/bin/pg_rewind/t/001_basic.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::Moretests=>10;
4+
use Test::Moretests=>11;
55

66
use FindBin;
77
use lib$FindBin::RealBin;

‎src/bin/pg_rewind/t/002_databases.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use strict;
22
use warnings;
33
use TestLib;
4-
use Test::Moretests=>6;
4+
use Test::Moretests=>7;
55

66
use FindBin;
77
use lib$FindBin::RealBin;

‎src/bin/pg_rewind/t/003_extrafiles.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use strict;
44
use warnings;
55
use TestLib;
6-
use Test::Moretests=>4;
6+
use Test::Moretests=>5;
77

88
use File::Find;
99

‎src/bin/pg_rewind/t/004_pg_xlog_symlink.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
else
1616
{
17-
plantests=>4;
17+
plantests=>5;
1818
}
1919

2020
use FindBin;

‎src/bin/pg_rewind/t/RewindTest.pm

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ sub start_master
149149

150150
# Create custom role which is used to run pg_rewind, and adjust its
151151
# permissions to the minimum necessary.
152-
$node_master->psql(
152+
$node_master->safe_psql(
153153
'postgres',"
154154
CREATE ROLE rewind_user LOGIN;
155155
GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean)
@@ -266,9 +266,19 @@ sub run_pg_rewind
266266
[
267267
'pg_rewind',"--debug",
268268
"--source-server",$standby_connstr,
269-
"--target-pgdata=$master_pgdata","--no-sync"
269+
"--target-pgdata=$master_pgdata","-R",
270+
"--no-sync"
270271
],
271272
'pg_rewind remote');
273+
274+
# Check that standby.signal has been created.
275+
ok(-e"$master_pgdata/standby.signal");
276+
277+
# Now, when pg_rewind apparently succeeded with minimal permissions,
278+
# add REPLICATION privilege. So we could test that new standby
279+
# is able to connect to the new master with generated config.
280+
$node_standby->safe_psql('postgres',
281+
"ALTER ROLE rewind_user WITH REPLICATION;");
272282
}
273283
else
274284
{
@@ -289,13 +299,15 @@ sub run_pg_rewind
289299
"unable to set permissions for$master_pgdata/postgresql.conf");
290300

291301
# Plug-in rewound node to the now-promoted standby node
292-
my$port_standby =$node_standby->port;
293-
$node_master->append_conf(
294-
'postgresql.conf',qq(
295-
primary_conninfo='port=$port_standby'
296-
));
302+
if ($test_modene"remote")
303+
{
304+
my$port_standby =$node_standby->port;
305+
$node_master->append_conf(
306+
'postgresql.conf',qq(
307+
primary_conninfo='port=$port_standby'));
297308

298-
$node_master->set_standby_mode();
309+
$node_master->set_standby_mode();
310+
}
299311

300312
# Restart the master to check that rewind went correctly
301313
$node_master->start;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp