aboutsummaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_rewind/t/001_basic.pl76
-rw-r--r--src/bin/pg_rewind/t/002_databases.pl24
-rw-r--r--src/bin/pg_rewind/t/003_extrafiles.pl54
-rw-r--r--src/bin/pg_rewind/t/004_pg_xlog_symlink.pl40
-rw-r--r--src/bin/pg_rewind/t/005_same_timeline.pl2
-rw-r--r--src/bin/pg_rewind/t/RewindTest.pm134
-rw-r--r--src/bin/pg_verifybackup/t/002_algorithm.pl14
-rw-r--r--src/bin/pg_verifybackup/t/003_corruption.pl12
-rw-r--r--src/bin/pg_verifybackup/t/004_options.pl10
-rw-r--r--src/bin/pg_verifybackup/t/006_encoding.pl10
-rw-r--r--src/bin/pg_verifybackup/t/007_wal.pl12
11 files changed, 194 insertions, 194 deletions
diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl
index d97e4377419..fb4a0acd965 100644
--- a/src/bin/pg_rewind/t/001_basic.pl
+++ b/src/bin/pg_rewind/t/001_basic.pl
@@ -13,58 +13,58 @@ sub run_test
my $test_mode = shift;
RewindTest::setup_cluster($test_mode);
- RewindTest::start_master();
+ RewindTest::start_primary();
- # Create a test table and insert a row in master.
- master_psql("CREATE TABLE tbl1 (d text)");
- master_psql("INSERT INTO tbl1 VALUES ('in master')");
+ # Create a test table and insert a row in primary.
+ primary_psql("CREATE TABLE tbl1 (d text)");
+ primary_psql("INSERT INTO tbl1 VALUES ('in primary')");
# This test table will be used to test truncation, i.e. the table
- # is extended in the old master after promotion
- master_psql("CREATE TABLE trunc_tbl (d text)");
- master_psql("INSERT INTO trunc_tbl VALUES ('in master')");
+ # is extended in the old primary after promotion
+ primary_psql("CREATE TABLE trunc_tbl (d text)");
+ primary_psql("INSERT INTO trunc_tbl VALUES ('in primary')");
# This test table will be used to test the "copy-tail" case, i.e. the
- # table is truncated in the old master after promotion
- master_psql("CREATE TABLE tail_tbl (id integer, d text)");
- master_psql("INSERT INTO tail_tbl VALUES (0, 'in master')");
+ # table is truncated in the old primary after promotion
+ primary_psql("CREATE TABLE tail_tbl (id integer, d text)");
+ primary_psql("INSERT INTO tail_tbl VALUES (0, 'in primary')");
- master_psql("CHECKPOINT");
+ primary_psql("CHECKPOINT");
RewindTest::create_standby($test_mode);
- # Insert additional data on master that will be replicated to standby
- master_psql("INSERT INTO tbl1 values ('in master, before promotion')");
- master_psql(
- "INSERT INTO trunc_tbl values ('in master, before promotion')");
- master_psql(
- "INSERT INTO tail_tbl SELECT g, 'in master, before promotion: ' || g FROM generate_series(1, 10000) g"
+ # Insert additional data on primary that will be replicated to standby
+ primary_psql("INSERT INTO tbl1 values ('in primary, before promotion')");
+ primary_psql(
+ "INSERT INTO trunc_tbl values ('in primary, before promotion')");
+ primary_psql(
+ "INSERT INTO tail_tbl SELECT g, 'in primary, before promotion: ' || g FROM generate_series(1, 10000) g"
);
- master_psql('CHECKPOINT');
+ primary_psql('CHECKPOINT');
RewindTest::promote_standby();
- # Insert a row in the old master. This causes the master and standby
+ # Insert a row in the old primary. This causes the primary and standby
# to have "diverged", it's no longer possible to just apply the
- # standy's logs over master directory - you need to rewind.
- master_psql("INSERT INTO tbl1 VALUES ('in master, after promotion')");
+ # standy's logs over primary directory - you need to rewind.
+ primary_psql("INSERT INTO tbl1 VALUES ('in primary, after promotion')");
# Also insert a new row in the standby, which won't be present in the
- # old master.
+ # old primary.
standby_psql("INSERT INTO tbl1 VALUES ('in standby, after promotion')");
# Insert enough rows to trunc_tbl to extend the file. pg_rewind should
# truncate it back to the old size.
- master_psql(
- "INSERT INTO trunc_tbl SELECT 'in master, after promotion: ' || g FROM generate_series(1, 10000) g"
+ primary_psql(
+ "INSERT INTO trunc_tbl SELECT 'in primary, after promotion: ' || g FROM generate_series(1, 10000) g"
);
# Truncate tail_tbl. pg_rewind should copy back the truncated part
# (We cannot use an actual TRUNCATE command here, as that creates a
# whole new relfilenode)
- master_psql("DELETE FROM tail_tbl WHERE id > 10");
- master_psql("VACUUM tail_tbl");
+ primary_psql("DELETE FROM tail_tbl WHERE id > 10");
+ primary_psql("VACUUM tail_tbl");
# Before running pg_rewind, do a couple of extra tests with several
# option combinations. As the code paths taken by those tests
@@ -72,7 +72,7 @@ sub run_test
# in "local" mode for simplicity's sake.
if ($test_mode eq 'local')
{
- my $master_pgdata = $node_master->data_dir;
+ my $primary_pgdata = $node_primary->data_dir;
my $standby_pgdata = $node_standby->data_dir;
# First check that pg_rewind fails if the target cluster is
@@ -82,7 +82,7 @@ sub run_test
[
'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata,
- '--target-pgdata', $master_pgdata,
+ '--target-pgdata', $primary_pgdata,
'--no-sync'
],
'pg_rewind with running target');
@@ -94,7 +94,7 @@ sub run_test
[
'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata,
- '--target-pgdata', $master_pgdata,
+ '--target-pgdata', $primary_pgdata,
'--no-sync', '--no-ensure-shutdown'
],
'pg_rewind --no-ensure-shutdown with running target');
@@ -102,12 +102,12 @@ sub run_test
# Stop the target, and attempt to run with a local source
# still running. This fails as pg_rewind requires to have
# a source cleanly stopped.
- $node_master->stop;
+ $node_primary->stop;
command_fails(
[
'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata,
- '--target-pgdata', $master_pgdata,
+ '--target-pgdata', $primary_pgdata,
'--no-sync', '--no-ensure-shutdown'
],
'pg_rewind with unexpected running source');
@@ -121,30 +121,30 @@ sub run_test
[
'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata,
- '--target-pgdata', $master_pgdata,
+ '--target-pgdata', $primary_pgdata,
'--no-sync', '--dry-run'
],
'pg_rewind --dry-run');
# Both clusters need to be alive moving forward.
$node_standby->start;
- $node_master->start;
+ $node_primary->start;
}
RewindTest::run_pg_rewind($test_mode);
check_query(
'SELECT * FROM tbl1',
- qq(in master
-in master, before promotion
+ qq(in primary
+in primary, before promotion
in standby, after promotion
),
'table content');
check_query(
'SELECT * FROM trunc_tbl',
- qq(in master
-in master, before promotion
+ qq(in primary
+in primary, before promotion
),
'truncation');
@@ -160,7 +160,7 @@ in master, before promotion
skip "unix-style permissions not supported on Windows", 1
if ($windows_os);
- ok(check_mode_recursive($node_master->data_dir(), 0700, 0600),
+ ok(check_mode_recursive($node_primary->data_dir(), 0700, 0600),
'check PGDATA permissions');
}
diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl
index 1db534c0dc0..5506fe425bc 100644
--- a/src/bin/pg_rewind/t/002_databases.pl
+++ b/src/bin/pg_rewind/t/002_databases.pl
@@ -13,26 +13,26 @@ sub run_test
my $test_mode = shift;
RewindTest::setup_cluster($test_mode, ['-g']);
- RewindTest::start_master();
+ RewindTest::start_primary();
- # Create a database in master with a table.
- master_psql('CREATE DATABASE inmaster');
- master_psql('CREATE TABLE inmaster_tab (a int)', 'inmaster');
+ # Create a database in primary with a table.
+ primary_psql('CREATE DATABASE inprimary');
+ primary_psql('CREATE TABLE inprimary_tab (a int)', 'inprimary');
RewindTest::create_standby($test_mode);
# Create another database with another table, the creation is
# replicated to the standby.
- master_psql('CREATE DATABASE beforepromotion');
- master_psql('CREATE TABLE beforepromotion_tab (a int)',
+ primary_psql('CREATE DATABASE beforepromotion');
+ primary_psql('CREATE TABLE beforepromotion_tab (a int)',
'beforepromotion');
RewindTest::promote_standby();
- # Create databases in the old master and the new promoted standby.
- master_psql('CREATE DATABASE master_afterpromotion');
- master_psql('CREATE TABLE master_promotion_tab (a int)',
- 'master_afterpromotion');
+ # Create databases in the old primary and the new promoted standby.
+ primary_psql('CREATE DATABASE primary_afterpromotion');
+ primary_psql('CREATE TABLE primary_promotion_tab (a int)',
+ 'primary_afterpromotion');
standby_psql('CREATE DATABASE standby_afterpromotion');
standby_psql('CREATE TABLE standby_promotion_tab (a int)',
'standby_afterpromotion');
@@ -45,7 +45,7 @@ sub run_test
check_query(
'SELECT datname FROM pg_database ORDER BY 1',
qq(beforepromotion
-inmaster
+inprimary
postgres
standby_afterpromotion
template0
@@ -59,7 +59,7 @@ template1
skip "unix-style permissions not supported on Windows", 1
if ($windows_os);
- ok(check_mode_recursive($node_master->data_dir(), 0750, 0640),
+ ok(check_mode_recursive($node_primary->data_dir(), 0750, 0640),
'check PGDATA permissions');
}
diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl
index f4710440fc3..48849fb49aa 100644
--- a/src/bin/pg_rewind/t/003_extrafiles.pl
+++ b/src/bin/pg_rewind/t/003_extrafiles.pl
@@ -18,21 +18,21 @@ sub run_test
my $test_mode = shift;
RewindTest::setup_cluster($test_mode);
- RewindTest::start_master();
+ RewindTest::start_primary();
- my $test_master_datadir = $node_master->data_dir;
+ my $test_primary_datadir = $node_primary->data_dir;
# Create a subdir and files that will be present in both
- mkdir "$test_master_datadir/tst_both_dir";
- append_to_file "$test_master_datadir/tst_both_dir/both_file1", "in both1";
- append_to_file "$test_master_datadir/tst_both_dir/both_file2", "in both2";
- mkdir "$test_master_datadir/tst_both_dir/both_subdir/";
- append_to_file "$test_master_datadir/tst_both_dir/both_subdir/both_file3",
+ mkdir "$test_primary_datadir/tst_both_dir";
+ append_to_file "$test_primary_datadir/tst_both_dir/both_file1", "in both1";
+ append_to_file "$test_primary_datadir/tst_both_dir/both_file2", "in both2";
+ mkdir "$test_primary_datadir/tst_both_dir/both_subdir/";
+ append_to_file "$test_primary_datadir/tst_both_dir/both_subdir/both_file3",
"in both3";
RewindTest::create_standby($test_mode);
- # Create different subdirs and files in master and standby
+ # Create different subdirs and files in primary and standby
my $test_standby_datadir = $node_standby->data_dir;
mkdir "$test_standby_datadir/tst_standby_dir";
@@ -45,15 +45,15 @@ sub run_test
"$test_standby_datadir/tst_standby_dir/standby_subdir/standby_file3",
"in standby3";
- mkdir "$test_master_datadir/tst_master_dir";
- append_to_file "$test_master_datadir/tst_master_dir/master_file1",
- "in master1";
- append_to_file "$test_master_datadir/tst_master_dir/master_file2",
- "in master2";
- mkdir "$test_master_datadir/tst_master_dir/master_subdir/";
+ mkdir "$test_primary_datadir/tst_primary_dir";
+ append_to_file "$test_primary_datadir/tst_primary_dir/primary_file1",
+ "in primary1";
+ append_to_file "$test_primary_datadir/tst_primary_dir/primary_file2",
+ "in primary2";
+ mkdir "$test_primary_datadir/tst_primary_dir/primary_subdir/";
append_to_file
- "$test_master_datadir/tst_master_dir/master_subdir/master_file3",
- "in master3";
+ "$test_primary_datadir/tst_primary_dir/primary_subdir/primary_file3",
+ "in primary3";
RewindTest::promote_standby();
RewindTest::run_pg_rewind($test_mode);
@@ -65,21 +65,21 @@ sub run_test
push @paths, $File::Find::name
if $File::Find::name =~ m/.*tst_.*/;
},
- $test_master_datadir);
+ $test_primary_datadir);
@paths = sort @paths;
is_deeply(
\@paths,
[
- "$test_master_datadir/tst_both_dir",
- "$test_master_datadir/tst_both_dir/both_file1",
- "$test_master_datadir/tst_both_dir/both_file2",
- "$test_master_datadir/tst_both_dir/both_subdir",
- "$test_master_datadir/tst_both_dir/both_subdir/both_file3",
- "$test_master_datadir/tst_standby_dir",
- "$test_master_datadir/tst_standby_dir/standby_file1",
- "$test_master_datadir/tst_standby_dir/standby_file2",
- "$test_master_datadir/tst_standby_dir/standby_subdir",
- "$test_master_datadir/tst_standby_dir/standby_subdir/standby_file3"
+ "$test_primary_datadir/tst_both_dir",
+ "$test_primary_datadir/tst_both_dir/both_file1",
+ "$test_primary_datadir/tst_both_dir/both_file2",
+ "$test_primary_datadir/tst_both_dir/both_subdir",
+ "$test_primary_datadir/tst_both_dir/both_subdir/both_file3",
+ "$test_primary_datadir/tst_standby_dir",
+ "$test_primary_datadir/tst_standby_dir/standby_file1",
+ "$test_primary_datadir/tst_standby_dir/standby_file2",
+ "$test_primary_datadir/tst_standby_dir/standby_subdir",
+ "$test_primary_datadir/tst_standby_dir/standby_subdir/standby_file3"
],
"file lists match");
diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
index 639eeb9c910..3813543ee1c 100644
--- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
+++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
@@ -26,50 +26,50 @@ sub run_test
{
my $test_mode = shift;
- my $master_xlogdir = "${TestLib::tmp_check}/xlog_master";
+ my $primary_xlogdir = "${TestLib::tmp_check}/xlog_primary";
- rmtree($master_xlogdir);
+ rmtree($primary_xlogdir);
RewindTest::setup_cluster($test_mode);
- my $test_master_datadir = $node_master->data_dir;
+ my $test_primary_datadir = $node_primary->data_dir;
# turn pg_wal into a symlink
- print("moving $test_master_datadir/pg_wal to $master_xlogdir\n");
- move("$test_master_datadir/pg_wal", $master_xlogdir) or die;
- symlink($master_xlogdir, "$test_master_datadir/pg_wal") or die;
+ print("moving $test_primary_datadir/pg_wal to $primary_xlogdir\n");
+ move("$test_primary_datadir/pg_wal", $primary_xlogdir) or die;
+ symlink($primary_xlogdir, "$test_primary_datadir/pg_wal") or die;
- RewindTest::start_master();
+ RewindTest::start_primary();
- # Create a test table and insert a row in master.
- master_psql("CREATE TABLE tbl1 (d text)");
- master_psql("INSERT INTO tbl1 VALUES ('in master')");
+ # Create a test table and insert a row in primary.
+ primary_psql("CREATE TABLE tbl1 (d text)");
+ primary_psql("INSERT INTO tbl1 VALUES ('in primary')");
- master_psql("CHECKPOINT");
+ primary_psql("CHECKPOINT");
RewindTest::create_standby($test_mode);
- # Insert additional data on master that will be replicated to standby
- master_psql("INSERT INTO tbl1 values ('in master, before promotion')");
+ # Insert additional data on primary that will be replicated to standby
+ primary_psql("INSERT INTO tbl1 values ('in primary, before promotion')");
- master_psql('CHECKPOINT');
+ primary_psql('CHECKPOINT');
RewindTest::promote_standby();
- # Insert a row in the old master. This causes the master and standby
+ # Insert a row in the old primary. This causes the primary and standby
# to have "diverged", it's no longer possible to just apply the
- # standy's logs over master directory - you need to rewind.
- master_psql("INSERT INTO tbl1 VALUES ('in master, after promotion')");
+ # standy's logs over primary directory - you need to rewind.
+ primary_psql("INSERT INTO tbl1 VALUES ('in primary, after promotion')");
# Also insert a new row in the standby, which won't be present in the
- # old master.
+ # old primary.
standby_psql("INSERT INTO tbl1 VALUES ('in standby, after promotion')");
RewindTest::run_pg_rewind($test_mode);
check_query(
'SELECT * FROM tbl1',
- qq(in master
-in master, before promotion
+ qq(in primary
+in primary, before promotion
in standby, after promotion
),
'table content');
diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl
index 5464f4203a7..8706d5aed5c 100644
--- a/src/bin/pg_rewind/t/005_same_timeline.pl
+++ b/src/bin/pg_rewind/t/005_same_timeline.pl
@@ -13,7 +13,7 @@ use lib $FindBin::RealBin;
use RewindTest;
RewindTest::setup_cluster();
-RewindTest::start_master();
+RewindTest::start_primary();
RewindTest::create_standby();
RewindTest::run_pg_rewind('local');
RewindTest::clean_rewind_test();
diff --git a/src/bin/pg_rewind/t/RewindTest.pm b/src/bin/pg_rewind/t/RewindTest.pm
index 7dabf395e10..149b99159d0 100644
--- a/src/bin/pg_rewind/t/RewindTest.pm
+++ b/src/bin/pg_rewind/t/RewindTest.pm
@@ -2,31 +2,31 @@ package RewindTest;
# Test driver for pg_rewind. Each test consists of a cycle where a new cluster
# is first created with initdb, and a streaming replication standby is set up
-# to follow the master. Then the master is shut down and the standby is
-# promoted, and finally pg_rewind is used to rewind the old master, using the
+# to follow the primary. Then the primary is shut down and the standby is
+# promoted, and finally pg_rewind is used to rewind the old primary, using the
# standby as the source.
#
# To run a test, the test script (in t/ subdirectory) calls the functions
# in this module. These functions should be called in this sequence:
#
-# 1. setup_cluster - creates a PostgreSQL cluster that runs as the master
+# 1. setup_cluster - creates a PostgreSQL cluster that runs as the primary
#
-# 2. start_master - starts the master server
+# 2. start_primary - starts the primary server
#
# 3. create_standby - runs pg_basebackup to initialize a standby server, and
-# sets it up to follow the master.
+# sets it up to follow the primary.
#
# 4. promote_standby - runs "pg_ctl promote" to promote the standby server.
-# The old master keeps running.
+# The old primary keeps running.
#
-# 5. run_pg_rewind - stops the old master (if it's still running) and runs
+# 5. run_pg_rewind - stops the old primary (if it's still running) and runs
# pg_rewind to synchronize it with the now-promoted standby server.
#
# 6. clean_rewind_test - stops both servers used in the test, if they're
# still running.
#
-# The test script can use the helper functions master_psql and standby_psql
-# to run psql against the master and standby servers, respectively.
+# The test script can use the helper functions primary_psql and standby_psql
+# to run psql against the primary and standby servers, respectively.
use strict;
use warnings;
@@ -43,15 +43,15 @@ use TestLib;
use Test::More;
our @EXPORT = qw(
- $node_master
+ $node_primary
$node_standby
- master_psql
+ primary_psql
standby_psql
check_query
setup_cluster
- start_master
+ start_primary
create_standby
promote_standby
run_pg_rewind
@@ -59,16 +59,16 @@ our @EXPORT = qw(
);
# Our nodes.
-our $node_master;
+our $node_primary;
our $node_standby;
-sub master_psql
+sub primary_psql
{
my $cmd = shift;
my $dbname = shift || 'postgres';
system_or_bail 'psql', '-q', '--no-psqlrc', '-d',
- $node_master->connstr($dbname), '-c', "$cmd";
+ $node_primary->connstr($dbname), '-c', "$cmd";
return;
}
@@ -82,7 +82,7 @@ sub standby_psql
return;
}
-# Run a query against the master, and check that the output matches what's
+# Run a query against the primary, and check that the output matches what's
# expected
sub check_query
{
@@ -94,7 +94,7 @@ sub check_query
# we want just the output, no formatting
my $result = run [
'psql', '-q', '-A', '-t', '--no-psqlrc', '-d',
- $node_master->connstr('postgres'),
+ $node_primary->connstr('postgres'),
'-c', $query
],
'>', \$stdout, '2>', \$stderr;
@@ -123,34 +123,34 @@ sub setup_cluster
my $extra_name = shift; # Used to differentiate clusters
my $extra = shift; # Extra params for initdb
- # Initialize master, data checksums are mandatory
- $node_master =
- get_new_node('master' . ($extra_name ? "_${extra_name}" : ''));
+ # Initialize primary, data checksums are mandatory
+ $node_primary =
+ get_new_node('primary' . ($extra_name ? "_${extra_name}" : ''));
# Set up pg_hba.conf and pg_ident.conf for the role running
# pg_rewind. This role is used for all the tests, and has
# minimal permissions enough to rewind from an online source.
- $node_master->init(
+ $node_primary->init(
allows_streaming => 1,
extra => $extra,
auth_extra => [ '--create-role', 'rewind_user' ]);
# Set wal_keep_segments to prevent WAL segment recycling after enforced
# checkpoints in the tests.
- $node_master->append_conf(
+ $node_primary->append_conf(
'postgresql.conf', qq(
wal_keep_segments = 20
));
return;
}
-sub start_master
+sub start_primary
{
- $node_master->start;
+ $node_primary->start;
# Create custom role which is used to run pg_rewind, and adjust its
# permissions to the minimum necessary.
- $node_master->safe_psql(
+ $node_primary->safe_psql(
'postgres', "
CREATE ROLE rewind_user LOGIN;
GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean)
@@ -162,7 +162,7 @@ sub start_master
GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean)
TO rewind_user;");
- #### Now run the test-specific parts to initialize the master before setting
+ #### Now run the test-specific parts to initialize the primary before setting
# up standby
return;
@@ -174,13 +174,13 @@ sub create_standby
$node_standby =
get_new_node('standby' . ($extra_name ? "_${extra_name}" : ''));
- $node_master->backup('my_backup');
- $node_standby->init_from_backup($node_master, 'my_backup');
- my $connstr_master = $node_master->connstr();
+ $node_primary->backup('my_backup');
+ $node_standby->init_from_backup($node_primary, 'my_backup');
+ my $connstr_primary = $node_primary->connstr();
$node_standby->append_conf(
"postgresql.conf", qq(
-primary_conninfo='$connstr_master'
+primary_conninfo='$connstr_primary'
));
$node_standby->set_standby_mode();
@@ -200,10 +200,10 @@ sub promote_standby
# up standby
# Wait for the standby to receive and write all WAL.
- $node_master->wait_for_catchup($node_standby, 'write');
+ $node_primary->wait_for_catchup($node_standby, 'write');
- # Now promote standby and insert some new data on master, this will put
- # the master out-of-sync with the standby.
+ # Now promote standby and insert some new data on primary, this will put
+ # the primary out-of-sync with the standby.
$node_standby->promote;
# Force a checkpoint after the promotion. pg_rewind looks at the control
@@ -220,7 +220,7 @@ sub promote_standby
sub run_pg_rewind
{
my $test_mode = shift;
- my $master_pgdata = $node_master->data_dir;
+ my $primary_pgdata = $node_primary->data_dir;
my $standby_pgdata = $node_standby->data_dir;
my $standby_connstr = $node_standby->connstr('postgres');
my $tmp_folder = TestLib::tempdir;
@@ -239,14 +239,14 @@ sub run_pg_rewind
# segments but that would just make the test more costly,
# without improving the coverage. Hence, instead, stop
# gracefully the primary here.
- $node_master->stop;
+ $node_primary->stop;
}
else
{
- # Stop the master and be ready to perform the rewind. The cluster
+ # Stop the primary and be ready to perform the rewind. The cluster
# needs recovery to finish once, and pg_rewind makes sure that it
# happens automatically.
- $node_master->stop('immediate');
+ $node_primary->stop('immediate');
}
# At this point, the rewind processing is ready to run.
@@ -254,25 +254,25 @@ sub run_pg_rewind
# The real testing begins really now with a bifurcation of the possible
# scenarios that pg_rewind supports.
- # Keep a temporary postgresql.conf for master node or it would be
+ # Keep a temporary postgresql.conf for primary node or it would be
# overwritten during the rewind.
copy(
- "$master_pgdata/postgresql.conf",
- "$tmp_folder/master-postgresql.conf.tmp");
+ "$primary_pgdata/postgresql.conf",
+ "$tmp_folder/primary-postgresql.conf.tmp");
# Now run pg_rewind
if ($test_mode eq "local")
{
# Do rewind using a local pgdata as source
- # Stop the master and be ready to perform the rewind
+ # Stop the primary and be ready to perform the rewind
$node_standby->stop;
command_ok(
[
'pg_rewind',
"--debug",
"--source-pgdata=$standby_pgdata",
- "--target-pgdata=$master_pgdata",
+ "--target-pgdata=$primary_pgdata",
"--no-sync"
],
'pg_rewind local');
@@ -285,19 +285,19 @@ sub run_pg_rewind
[
'pg_rewind', "--debug",
"--source-server", $standby_connstr,
- "--target-pgdata=$master_pgdata", "--no-sync",
+ "--target-pgdata=$primary_pgdata", "--no-sync",
"--write-recovery-conf"
],
'pg_rewind remote');
# Check that standby.signal is here as recovery configuration
# was requested.
- ok( -e "$master_pgdata/standby.signal",
+ ok( -e "$primary_pgdata/standby.signal",
'standby.signal created after pg_rewind');
# Now, when pg_rewind apparently succeeded with minimal permissions,
# add REPLICATION privilege. So we could test that new standby
- # is able to connect to the new master with generated config.
+ # is able to connect to the new primary with generated config.
$node_standby->safe_psql('postgres',
"ALTER ROLE rewind_user WITH REPLICATION;");
}
@@ -305,30 +305,30 @@ sub run_pg_rewind
{
# Do rewind using a local pgdata as source and specified
- # directory with target WAL archive. The old master has
+ # directory with target WAL archive. The old primary has
# to be stopped at this point.
# Remove the existing archive directory and move all WAL
- # segments from the old master to the archives. These
+ # segments from the old primary to the archives. These
# will be used by pg_rewind.
- rmtree($node_master->archive_dir);
- RecursiveCopy::copypath($node_master->data_dir . "/pg_wal",
- $node_master->archive_dir);
+ rmtree($node_primary->archive_dir);
+ RecursiveCopy::copypath($node_primary->data_dir . "/pg_wal",
+ $node_primary->archive_dir);
# Fast way to remove entire directory content
- rmtree($node_master->data_dir . "/pg_wal");
- mkdir($node_master->data_dir . "/pg_wal");
+ rmtree($node_primary->data_dir . "/pg_wal");
+ mkdir($node_primary->data_dir . "/pg_wal");
# Make sure that directories have the right umask as this is
# required by a follow-up check on permissions, and better
# safe than sorry.
- chmod(0700, $node_master->archive_dir);
- chmod(0700, $node_master->data_dir . "/pg_wal");
+ chmod(0700, $node_primary->archive_dir);
+ chmod(0700, $node_primary->data_dir . "/pg_wal");
# Add appropriate restore_command to the target cluster
- $node_master->enable_restoring($node_master, 0);
+ $node_primary->enable_restoring($node_primary, 0);
- # Stop the new master and be ready to perform the rewind.
+ # Stop the new primary and be ready to perform the rewind.
$node_standby->stop;
# Note the use of --no-ensure-shutdown here. WAL files are
@@ -339,7 +339,7 @@ sub run_pg_rewind
'pg_rewind',
"--debug",
"--source-pgdata=$standby_pgdata",
- "--target-pgdata=$master_pgdata",
+ "--target-pgdata=$primary_pgdata",
"--no-sync",
"--no-ensure-shutdown",
"--restore-target-wal"
@@ -355,28 +355,28 @@ sub run_pg_rewind
# Now move back postgresql.conf with old settings
move(
- "$tmp_folder/master-postgresql.conf.tmp",
- "$master_pgdata/postgresql.conf");
+ "$tmp_folder/primary-postgresql.conf.tmp",
+ "$primary_pgdata/postgresql.conf");
chmod(
- $node_master->group_access() ? 0640 : 0600,
- "$master_pgdata/postgresql.conf")
+ $node_primary->group_access() ? 0640 : 0600,
+ "$primary_pgdata/postgresql.conf")
or BAIL_OUT(
- "unable to set permissions for $master_pgdata/postgresql.conf");
+ "unable to set permissions for $primary_pgdata/postgresql.conf");
# Plug-in rewound node to the now-promoted standby node
if ($test_mode ne "remote")
{
my $port_standby = $node_standby->port;
- $node_master->append_conf(
+ $node_primary->append_conf(
'postgresql.conf', qq(
primary_conninfo='port=$port_standby'));
- $node_master->set_standby_mode();
+ $node_primary->set_standby_mode();
}
- # Restart the master to check that rewind went correctly
- $node_master->start;
+ # Restart the primary to check that rewind went correctly
+ $node_primary->start;
#### Now run the test-specific parts to check the result
@@ -386,7 +386,7 @@ primary_conninfo='port=$port_standby'));
# Clean up after the test. Stop both servers, if they're still running.
sub clean_rewind_test
{
- $node_master->teardown_node if defined $node_master;
+ $node_primary->teardown_node if defined $node_primary;
$node_standby->teardown_node if defined $node_standby;
return;
}
diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl
index d0c97ae3cc3..6c118832668 100644
--- a/src/bin/pg_verifybackup/t/002_algorithm.pl
+++ b/src/bin/pg_verifybackup/t/002_algorithm.pl
@@ -9,13 +9,13 @@ use PostgresNode;
use TestLib;
use Test::More tests => 19;
-my $master = get_new_node('master');
-$master->init(allows_streaming => 1);
-$master->start;
+my $primary = get_new_node('primary');
+$primary->init(allows_streaming => 1);
+$primary->start;
for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512))
{
- my $backup_path = $master->backup_dir . '/' . $algorithm;
+ my $backup_path = $primary->backup_dir . '/' . $algorithm;
my @backup = (
'pg_basebackup', '-D', $backup_path,
'--manifest-checksums', $algorithm, '--no-sync');
@@ -24,13 +24,13 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512))
# A backup with a bogus algorithm should fail.
if ($algorithm eq 'bogus')
{
- $master->command_fails(\@backup,
+ $primary->command_fails(\@backup,
"backup fails with algorithm \"$algorithm\"");
next;
}
# A backup with a valid algorithm should work.
- $master->command_ok(\@backup, "backup ok with algorithm \"$algorithm\"");
+ $primary->command_ok(\@backup, "backup ok with algorithm \"$algorithm\"");
# We expect each real checksum algorithm to be mentioned on every line of
# the backup manifest file except the first and last; for simplicity, we
@@ -50,7 +50,7 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512))
}
# Make sure that it verifies OK.
- $master->command_ok(\@verify,
+ $primary->command_ok(\@verify,
"verify backup with algorithm \"$algorithm\"");
# Remove backup immediately to save disk space.
diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl
index c2e04d0be20..0c0691ba2b2 100644
--- a/src/bin/pg_verifybackup/t/003_corruption.pl
+++ b/src/bin/pg_verifybackup/t/003_corruption.pl
@@ -9,9 +9,9 @@ use PostgresNode;
use TestLib;
use Test::More tests => 44;
-my $master = get_new_node('master');
-$master->init(allows_streaming => 1);
-$master->start;
+my $primary = get_new_node('primary');
+$primary->init(allows_streaming => 1);
+$primary->start;
# Include a user-defined tablespace in the hopes of detecting problems in that
# area.
@@ -19,7 +19,7 @@ my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short());
my $source_ts_prefix = $source_ts_path;
$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
-$master->safe_psql('postgres', <<EOM);
+$primary->safe_psql('postgres', <<EOM);
CREATE TABLE x1 (a int);
INSERT INTO x1 VALUES (111);
CREATE TABLESPACE ts1 LOCATION '$source_ts_path';
@@ -103,13 +103,13 @@ for my $scenario (@scenario)
if $scenario->{'skip_on_windows'} && $windows_os;
# Take a backup and check that it verifies OK.
- my $backup_path = $master->backup_dir . '/' . $name;
+ my $backup_path = $primary->backup_dir . '/' . $name;
my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short());
# The tablespace map parameter confuses Msys2, which tries to mangle
# it. Tell it not to.
# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix;
- $master->command_ok(
+ $primary->command_ok(
[
'pg_basebackup', '-D', $backup_path, '--no-sync',
'-T', "${source_ts_path}=${backup_ts_path}"
diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl
index 271b7ee5043..1bd0aab5459 100644
--- a/src/bin/pg_verifybackup/t/004_options.pl
+++ b/src/bin/pg_verifybackup/t/004_options.pl
@@ -10,11 +10,11 @@ use TestLib;
use Test::More tests => 25;
# Start up the server and take a backup.
-my $master = get_new_node('master');
-$master->init(allows_streaming => 1);
-$master->start;
-my $backup_path = $master->backup_dir . '/test_options';
-$master->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
+my $primary = get_new_node('primary');
+$primary->init(allows_streaming => 1);
+$primary->start;
+my $backup_path = $primary->backup_dir . '/test_options';
+$primary->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
"base backup ok");
# Verify that pg_verifybackup -q succeeds and produces no output.
diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl
index 5ab9649ab6f..35b854a78e8 100644
--- a/src/bin/pg_verifybackup/t/006_encoding.pl
+++ b/src/bin/pg_verifybackup/t/006_encoding.pl
@@ -8,11 +8,11 @@ use PostgresNode;
use TestLib;
use Test::More tests => 5;
-my $master = get_new_node('master');
-$master->init(allows_streaming => 1);
-$master->start;
-my $backup_path = $master->backup_dir . '/test_encoding';
-$master->command_ok(
+my $primary = get_new_node('primary');
+$primary->init(allows_streaming => 1);
+$primary->start;
+my $backup_path = $primary->backup_dir . '/test_encoding';
+$primary->command_ok(
[
'pg_basebackup', '-D',
$backup_path, '--no-sync',
diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl
index 56d536675c9..23a4f8bbd8d 100644
--- a/src/bin/pg_verifybackup/t/007_wal.pl
+++ b/src/bin/pg_verifybackup/t/007_wal.pl
@@ -10,16 +10,16 @@ use TestLib;
use Test::More tests => 7;
# Start up the server and take a backup.
-my $master = get_new_node('master');
-$master->init(allows_streaming => 1);
-$master->start;
-my $backup_path = $master->backup_dir . '/test_wal';
-$master->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
+my $primary = get_new_node('primary');
+$primary->init(allows_streaming => 1);
+$primary->start;
+my $backup_path = $primary->backup_dir . '/test_wal';
+$primary->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
"base backup ok");
# Rename pg_wal.
my $original_pg_wal = $backup_path . '/pg_wal';
-my $relocated_pg_wal = $master->backup_dir . '/relocated_pg_wal';
+my $relocated_pg_wal = $primary->backup_dir . '/relocated_pg_wal';
rename($original_pg_wal, $relocated_pg_wal) || die "rename pg_wal: $!";
# WAL verification should fail.