Commit 229f8c21 authored by Andres Freund's avatar Andres Freund

tap tests: replace 'master' with 'primary'.

We've largely replaced master with primary in docs etc, but tap test
still widely used master.

Author: Andres Freund
Reviewed-By: David Steele
Discussion: https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue@alap3.anarazel.de
parent 2661a793
...@@ -5,10 +5,10 @@ use PostgresNode; ...@@ -5,10 +5,10 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 31; use Test::More tests => 31;
my $node_master; my $node_primary;
my $node_standby; my $node_standby;
# Run few queries on both master and standby and check their results match. # Run few queries on both primary and standby and check their results match.
sub test_index_replay sub test_index_replay
{ {
my ($test_name) = @_; my ($test_name) = @_;
...@@ -17,7 +17,7 @@ sub test_index_replay ...@@ -17,7 +17,7 @@ sub test_index_replay
my $applname = $node_standby->name; my $applname = $node_standby->name;
my $caughtup_query = my $caughtup_query =
"SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';"; "SELECT pg_current_wal_lsn() <= write_lsn FROM pg_stat_replication WHERE application_name = '$applname';";
$node_master->poll_query_until('postgres', $caughtup_query) $node_primary->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby 1 to catch up"; or die "Timed out while waiting for standby 1 to catch up";
my $queries = qq(SET enable_seqscan=off; my $queries = qq(SET enable_seqscan=off;
...@@ -32,35 +32,35 @@ SELECT * FROM tst WHERE i = 7 AND t = 'e'; ...@@ -32,35 +32,35 @@ SELECT * FROM tst WHERE i = 7 AND t = 'e';
); );
# Run test queries and compare their result # Run test queries and compare their result
my $master_result = $node_master->safe_psql("postgres", $queries); my $primary_result = $node_primary->safe_psql("postgres", $queries);
my $standby_result = $node_standby->safe_psql("postgres", $queries); my $standby_result = $node_standby->safe_psql("postgres", $queries);
is($master_result, $standby_result, "$test_name: query result matches"); is($primary_result, $standby_result, "$test_name: query result matches");
return; return;
} }
# Initialize master node # Initialize primary node
$node_master = get_new_node('master'); $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->start; $node_primary->start;
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
# Take backup # Take backup
$node_master->backup($backup_name); $node_primary->backup($backup_name);
# Create streaming standby linking to master # Create streaming standby linking to primary
$node_standby = get_new_node('standby'); $node_standby = get_new_node('standby');
$node_standby->init_from_backup($node_master, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;
# Create some bloom index on master # Create some bloom index on primary
$node_master->safe_psql("postgres", "CREATE EXTENSION bloom;"); $node_primary->safe_psql("postgres", "CREATE EXTENSION bloom;");
$node_master->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);"); $node_primary->safe_psql("postgres", "CREATE TABLE tst (i int4, t text);");
$node_master->safe_psql("postgres", $node_primary->safe_psql("postgres",
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;" "INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series(1,100000) i;"
); );
$node_master->safe_psql("postgres", $node_primary->safe_psql("postgres",
"CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);"); "CREATE INDEX bloomidx ON tst USING bloom (i, t) WITH (col1 = 3);");
# Test that queries give same result # Test that queries give same result
...@@ -69,12 +69,12 @@ test_index_replay('initial'); ...@@ -69,12 +69,12 @@ test_index_replay('initial');
# Run 10 cycles of table modification. Run test queries after each modification. # Run 10 cycles of table modification. Run test queries after each modification.
for my $i (1 .. 10) for my $i (1 .. 10)
{ {
$node_master->safe_psql("postgres", "DELETE FROM tst WHERE i = $i;"); $node_primary->safe_psql("postgres", "DELETE FROM tst WHERE i = $i;");
test_index_replay("delete $i"); test_index_replay("delete $i");
$node_master->safe_psql("postgres", "VACUUM tst;"); $node_primary->safe_psql("postgres", "VACUUM tst;");
test_index_replay("vacuum $i"); test_index_replay("vacuum $i");
my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000); my ($start, $end) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000);
$node_master->safe_psql("postgres", $node_primary->safe_psql("postgres",
"INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;" "INSERT INTO tst SELECT i%10, substr(md5(i::text), 1, 1) FROM generate_series($start,$end) i;"
); );
test_index_replay("insert $i"); test_index_replay("insert $i");
......
...@@ -13,58 +13,58 @@ sub run_test ...@@ -13,58 +13,58 @@ sub run_test
my $test_mode = shift; my $test_mode = shift;
RewindTest::setup_cluster($test_mode); RewindTest::setup_cluster($test_mode);
RewindTest::start_master(); RewindTest::start_primary();
# Create a test table and insert a row in master. # Create a test table and insert a row in primary.
master_psql("CREATE TABLE tbl1 (d text)"); primary_psql("CREATE TABLE tbl1 (d text)");
master_psql("INSERT INTO tbl1 VALUES ('in master')"); primary_psql("INSERT INTO tbl1 VALUES ('in primary')");
# This test table will be used to test truncation, i.e. the table # This test table will be used to test truncation, i.e. the table
# is extended in the old master after promotion # is extended in the old primary after promotion
master_psql("CREATE TABLE trunc_tbl (d text)"); primary_psql("CREATE TABLE trunc_tbl (d text)");
master_psql("INSERT INTO trunc_tbl VALUES ('in master')"); primary_psql("INSERT INTO trunc_tbl VALUES ('in primary')");
# This test table will be used to test the "copy-tail" case, i.e. the # This test table will be used to test the "copy-tail" case, i.e. the
# table is truncated in the old master after promotion # table is truncated in the old primary after promotion
master_psql("CREATE TABLE tail_tbl (id integer, d text)"); primary_psql("CREATE TABLE tail_tbl (id integer, d text)");
master_psql("INSERT INTO tail_tbl VALUES (0, 'in master')"); primary_psql("INSERT INTO tail_tbl VALUES (0, 'in primary')");
master_psql("CHECKPOINT"); primary_psql("CHECKPOINT");
RewindTest::create_standby($test_mode); RewindTest::create_standby($test_mode);
# Insert additional data on master that will be replicated to standby # Insert additional data on primary that will be replicated to standby
master_psql("INSERT INTO tbl1 values ('in master, before promotion')"); primary_psql("INSERT INTO tbl1 values ('in primary, before promotion')");
master_psql( primary_psql(
"INSERT INTO trunc_tbl values ('in master, before promotion')"); "INSERT INTO trunc_tbl values ('in primary, before promotion')");
master_psql( primary_psql(
"INSERT INTO tail_tbl SELECT g, 'in master, before promotion: ' || g FROM generate_series(1, 10000) g" "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(); 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 # to have "diverged", it's no longer possible to just apply the
# standy's logs over master directory - you need to rewind. # standy's logs over primary directory - you need to rewind.
master_psql("INSERT INTO tbl1 VALUES ('in master, after promotion')"); 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 # 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')"); standby_psql("INSERT INTO tbl1 VALUES ('in standby, after promotion')");
# Insert enough rows to trunc_tbl to extend the file. pg_rewind should # Insert enough rows to trunc_tbl to extend the file. pg_rewind should
# truncate it back to the old size. # truncate it back to the old size.
master_psql( primary_psql(
"INSERT INTO trunc_tbl SELECT 'in master, after promotion: ' || g FROM generate_series(1, 10000) g" "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 # Truncate tail_tbl. pg_rewind should copy back the truncated part
# (We cannot use an actual TRUNCATE command here, as that creates a # (We cannot use an actual TRUNCATE command here, as that creates a
# whole new relfilenode) # whole new relfilenode)
master_psql("DELETE FROM tail_tbl WHERE id > 10"); primary_psql("DELETE FROM tail_tbl WHERE id > 10");
master_psql("VACUUM tail_tbl"); primary_psql("VACUUM tail_tbl");
# Before running pg_rewind, do a couple of extra tests with several # Before running pg_rewind, do a couple of extra tests with several
# option combinations. As the code paths taken by those tests # option combinations. As the code paths taken by those tests
...@@ -72,7 +72,7 @@ sub run_test ...@@ -72,7 +72,7 @@ sub run_test
# in "local" mode for simplicity's sake. # in "local" mode for simplicity's sake.
if ($test_mode eq 'local') 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; my $standby_pgdata = $node_standby->data_dir;
# First check that pg_rewind fails if the target cluster is # First check that pg_rewind fails if the target cluster is
...@@ -82,7 +82,7 @@ sub run_test ...@@ -82,7 +82,7 @@ sub run_test
[ [
'pg_rewind', '--debug', 'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata, '--source-pgdata', $standby_pgdata,
'--target-pgdata', $master_pgdata, '--target-pgdata', $primary_pgdata,
'--no-sync' '--no-sync'
], ],
'pg_rewind with running target'); 'pg_rewind with running target');
...@@ -94,7 +94,7 @@ sub run_test ...@@ -94,7 +94,7 @@ sub run_test
[ [
'pg_rewind', '--debug', 'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata, '--source-pgdata', $standby_pgdata,
'--target-pgdata', $master_pgdata, '--target-pgdata', $primary_pgdata,
'--no-sync', '--no-ensure-shutdown' '--no-sync', '--no-ensure-shutdown'
], ],
'pg_rewind --no-ensure-shutdown with running target'); 'pg_rewind --no-ensure-shutdown with running target');
...@@ -102,12 +102,12 @@ sub run_test ...@@ -102,12 +102,12 @@ sub run_test
# Stop the target, and attempt to run with a local source # Stop the target, and attempt to run with a local source
# still running. This fails as pg_rewind requires to have # still running. This fails as pg_rewind requires to have
# a source cleanly stopped. # a source cleanly stopped.
$node_master->stop; $node_primary->stop;
command_fails( command_fails(
[ [
'pg_rewind', '--debug', 'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata, '--source-pgdata', $standby_pgdata,
'--target-pgdata', $master_pgdata, '--target-pgdata', $primary_pgdata,
'--no-sync', '--no-ensure-shutdown' '--no-sync', '--no-ensure-shutdown'
], ],
'pg_rewind with unexpected running source'); 'pg_rewind with unexpected running source');
...@@ -121,30 +121,30 @@ sub run_test ...@@ -121,30 +121,30 @@ sub run_test
[ [
'pg_rewind', '--debug', 'pg_rewind', '--debug',
'--source-pgdata', $standby_pgdata, '--source-pgdata', $standby_pgdata,
'--target-pgdata', $master_pgdata, '--target-pgdata', $primary_pgdata,
'--no-sync', '--dry-run' '--no-sync', '--dry-run'
], ],
'pg_rewind --dry-run'); 'pg_rewind --dry-run');
# Both clusters need to be alive moving forward. # Both clusters need to be alive moving forward.
$node_standby->start; $node_standby->start;
$node_master->start; $node_primary->start;
} }
RewindTest::run_pg_rewind($test_mode); RewindTest::run_pg_rewind($test_mode);
check_query( check_query(
'SELECT * FROM tbl1', 'SELECT * FROM tbl1',
qq(in master qq(in primary
in master, before promotion in primary, before promotion
in standby, after promotion in standby, after promotion
), ),
'table content'); 'table content');
check_query( check_query(
'SELECT * FROM trunc_tbl', 'SELECT * FROM trunc_tbl',
qq(in master qq(in primary
in master, before promotion in primary, before promotion
), ),
'truncation'); 'truncation');
...@@ -160,7 +160,7 @@ in master, before promotion ...@@ -160,7 +160,7 @@ in master, before promotion
skip "unix-style permissions not supported on Windows", 1 skip "unix-style permissions not supported on Windows", 1
if ($windows_os); 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'); 'check PGDATA permissions');
} }
......
...@@ -13,26 +13,26 @@ sub run_test ...@@ -13,26 +13,26 @@ sub run_test
my $test_mode = shift; my $test_mode = shift;
RewindTest::setup_cluster($test_mode, ['-g']); RewindTest::setup_cluster($test_mode, ['-g']);
RewindTest::start_master(); RewindTest::start_primary();
# Create a database in master with a table. # Create a database in primary with a table.
master_psql('CREATE DATABASE inmaster'); primary_psql('CREATE DATABASE inprimary');
master_psql('CREATE TABLE inmaster_tab (a int)', 'inmaster'); primary_psql('CREATE TABLE inprimary_tab (a int)', 'inprimary');
RewindTest::create_standby($test_mode); RewindTest::create_standby($test_mode);
# Create another database with another table, the creation is # Create another database with another table, the creation is
# replicated to the standby. # replicated to the standby.
master_psql('CREATE DATABASE beforepromotion'); primary_psql('CREATE DATABASE beforepromotion');
master_psql('CREATE TABLE beforepromotion_tab (a int)', primary_psql('CREATE TABLE beforepromotion_tab (a int)',
'beforepromotion'); 'beforepromotion');
RewindTest::promote_standby(); RewindTest::promote_standby();
# Create databases in the old master and the new promoted standby. # Create databases in the old primary and the new promoted standby.
master_psql('CREATE DATABASE master_afterpromotion'); primary_psql('CREATE DATABASE primary_afterpromotion');
master_psql('CREATE TABLE master_promotion_tab (a int)', primary_psql('CREATE TABLE primary_promotion_tab (a int)',
'master_afterpromotion'); 'primary_afterpromotion');
standby_psql('CREATE DATABASE standby_afterpromotion'); standby_psql('CREATE DATABASE standby_afterpromotion');
standby_psql('CREATE TABLE standby_promotion_tab (a int)', standby_psql('CREATE TABLE standby_promotion_tab (a int)',
'standby_afterpromotion'); 'standby_afterpromotion');
...@@ -45,7 +45,7 @@ sub run_test ...@@ -45,7 +45,7 @@ sub run_test
check_query( check_query(
'SELECT datname FROM pg_database ORDER BY 1', 'SELECT datname FROM pg_database ORDER BY 1',
qq(beforepromotion qq(beforepromotion
inmaster inprimary
postgres postgres
standby_afterpromotion standby_afterpromotion
template0 template0
...@@ -59,7 +59,7 @@ template1 ...@@ -59,7 +59,7 @@ template1
skip "unix-style permissions not supported on Windows", 1 skip "unix-style permissions not supported on Windows", 1
if ($windows_os); 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'); 'check PGDATA permissions');
} }
......
...@@ -18,21 +18,21 @@ sub run_test ...@@ -18,21 +18,21 @@ sub run_test
my $test_mode = shift; my $test_mode = shift;
RewindTest::setup_cluster($test_mode); 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 # Create a subdir and files that will be present in both
mkdir "$test_master_datadir/tst_both_dir"; mkdir "$test_primary_datadir/tst_both_dir";
append_to_file "$test_master_datadir/tst_both_dir/both_file1", "in both1"; append_to_file "$test_primary_datadir/tst_both_dir/both_file1", "in both1";
append_to_file "$test_master_datadir/tst_both_dir/both_file2", "in both2"; append_to_file "$test_primary_datadir/tst_both_dir/both_file2", "in both2";
mkdir "$test_master_datadir/tst_both_dir/both_subdir/"; mkdir "$test_primary_datadir/tst_both_dir/both_subdir/";
append_to_file "$test_master_datadir/tst_both_dir/both_subdir/both_file3", append_to_file "$test_primary_datadir/tst_both_dir/both_subdir/both_file3",
"in both3"; "in both3";
RewindTest::create_standby($test_mode); 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; my $test_standby_datadir = $node_standby->data_dir;
mkdir "$test_standby_datadir/tst_standby_dir"; mkdir "$test_standby_datadir/tst_standby_dir";
...@@ -45,15 +45,15 @@ sub run_test ...@@ -45,15 +45,15 @@ sub run_test
"$test_standby_datadir/tst_standby_dir/standby_subdir/standby_file3", "$test_standby_datadir/tst_standby_dir/standby_subdir/standby_file3",
"in standby3"; "in standby3";
mkdir "$test_master_datadir/tst_master_dir"; mkdir "$test_primary_datadir/tst_primary_dir";
append_to_file "$test_master_datadir/tst_master_dir/master_file1", append_to_file "$test_primary_datadir/tst_primary_dir/primary_file1",
"in master1"; "in primary1";
append_to_file "$test_master_datadir/tst_master_dir/master_file2", append_to_file "$test_primary_datadir/tst_primary_dir/primary_file2",
"in master2"; "in primary2";
mkdir "$test_master_datadir/tst_master_dir/master_subdir/"; mkdir "$test_primary_datadir/tst_primary_dir/primary_subdir/";
append_to_file append_to_file
"$test_master_datadir/tst_master_dir/master_subdir/master_file3", "$test_primary_datadir/tst_primary_dir/primary_subdir/primary_file3",
"in master3"; "in primary3";
RewindTest::promote_standby(); RewindTest::promote_standby();
RewindTest::run_pg_rewind($test_mode); RewindTest::run_pg_rewind($test_mode);
...@@ -65,21 +65,21 @@ sub run_test ...@@ -65,21 +65,21 @@ sub run_test
push @paths, $File::Find::name push @paths, $File::Find::name
if $File::Find::name =~ m/.*tst_.*/; if $File::Find::name =~ m/.*tst_.*/;
}, },
$test_master_datadir); $test_primary_datadir);
@paths = sort @paths; @paths = sort @paths;
is_deeply( is_deeply(
\@paths, \@paths,
[ [
"$test_master_datadir/tst_both_dir", "$test_primary_datadir/tst_both_dir",
"$test_master_datadir/tst_both_dir/both_file1", "$test_primary_datadir/tst_both_dir/both_file1",
"$test_master_datadir/tst_both_dir/both_file2", "$test_primary_datadir/tst_both_dir/both_file2",
"$test_master_datadir/tst_both_dir/both_subdir", "$test_primary_datadir/tst_both_dir/both_subdir",
"$test_master_datadir/tst_both_dir/both_subdir/both_file3", "$test_primary_datadir/tst_both_dir/both_subdir/both_file3",
"$test_master_datadir/tst_standby_dir", "$test_primary_datadir/tst_standby_dir",
"$test_master_datadir/tst_standby_dir/standby_file1", "$test_primary_datadir/tst_standby_dir/standby_file1",
"$test_master_datadir/tst_standby_dir/standby_file2", "$test_primary_datadir/tst_standby_dir/standby_file2",
"$test_master_datadir/tst_standby_dir/standby_subdir", "$test_primary_datadir/tst_standby_dir/standby_subdir",
"$test_master_datadir/tst_standby_dir/standby_subdir/standby_file3" "$test_primary_datadir/tst_standby_dir/standby_subdir/standby_file3"
], ],
"file lists match"); "file lists match");
......
...@@ -26,50 +26,50 @@ sub run_test ...@@ -26,50 +26,50 @@ sub run_test
{ {
my $test_mode = shift; 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); 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 # turn pg_wal into a symlink
print("moving $test_master_datadir/pg_wal to $master_xlogdir\n"); print("moving $test_primary_datadir/pg_wal to $primary_xlogdir\n");
move("$test_master_datadir/pg_wal", $master_xlogdir) or die; move("$test_primary_datadir/pg_wal", $primary_xlogdir) or die;
symlink($master_xlogdir, "$test_master_datadir/pg_wal") 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. # Create a test table and insert a row in primary.
master_psql("CREATE TABLE tbl1 (d text)"); primary_psql("CREATE TABLE tbl1 (d text)");
master_psql("INSERT INTO tbl1 VALUES ('in master')"); primary_psql("INSERT INTO tbl1 VALUES ('in primary')");
master_psql("CHECKPOINT"); primary_psql("CHECKPOINT");
RewindTest::create_standby($test_mode); RewindTest::create_standby($test_mode);
# Insert additional data on master that will be replicated to standby # Insert additional data on primary that will be replicated to standby
master_psql("INSERT INTO tbl1 values ('in master, before promotion')"); primary_psql("INSERT INTO tbl1 values ('in primary, before promotion')");
master_psql('CHECKPOINT'); primary_psql('CHECKPOINT');
RewindTest::promote_standby(); 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 # to have "diverged", it's no longer possible to just apply the
# standy's logs over master directory - you need to rewind. # standy's logs over primary directory - you need to rewind.
master_psql("INSERT INTO tbl1 VALUES ('in master, after promotion')"); 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 # 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')"); standby_psql("INSERT INTO tbl1 VALUES ('in standby, after promotion')");
RewindTest::run_pg_rewind($test_mode); RewindTest::run_pg_rewind($test_mode);
check_query( check_query(
'SELECT * FROM tbl1', 'SELECT * FROM tbl1',
qq(in master qq(in primary
in master, before promotion in primary, before promotion
in standby, after promotion in standby, after promotion
), ),
'table content'); 'table content');
......
...@@ -13,7 +13,7 @@ use lib $FindBin::RealBin; ...@@ -13,7 +13,7 @@ use lib $FindBin::RealBin;
use RewindTest; use RewindTest;
RewindTest::setup_cluster(); RewindTest::setup_cluster();
RewindTest::start_master(); RewindTest::start_primary();
RewindTest::create_standby(); RewindTest::create_standby();
RewindTest::run_pg_rewind('local'); RewindTest::run_pg_rewind('local');
RewindTest::clean_rewind_test(); RewindTest::clean_rewind_test();
......
This diff is collapsed.
...@@ -9,13 +9,13 @@ use PostgresNode; ...@@ -9,13 +9,13 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 19; use Test::More tests => 19;
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->start; $primary->start;
for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512)) 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 = ( my @backup = (
'pg_basebackup', '-D', $backup_path, 'pg_basebackup', '-D', $backup_path,
'--manifest-checksums', $algorithm, '--no-sync'); '--manifest-checksums', $algorithm, '--no-sync');
...@@ -24,13 +24,13 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512)) ...@@ -24,13 +24,13 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512))
# A backup with a bogus algorithm should fail. # A backup with a bogus algorithm should fail.
if ($algorithm eq 'bogus') if ($algorithm eq 'bogus')
{ {
$master->command_fails(\@backup, $primary->command_fails(\@backup,
"backup fails with algorithm \"$algorithm\""); "backup fails with algorithm \"$algorithm\"");
next; next;
} }
# A backup with a valid algorithm should work. # 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 # 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 # 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)) ...@@ -50,7 +50,7 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512))
} }
# Make sure that it verifies OK. # Make sure that it verifies OK.
$master->command_ok(\@verify, $primary->command_ok(\@verify,
"verify backup with algorithm \"$algorithm\""); "verify backup with algorithm \"$algorithm\"");
# Remove backup immediately to save disk space. # Remove backup immediately to save disk space.
......
...@@ -9,9 +9,9 @@ use PostgresNode; ...@@ -9,9 +9,9 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 44; use Test::More tests => 44;
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->start; $primary->start;
# Include a user-defined tablespace in the hopes of detecting problems in that # Include a user-defined tablespace in the hopes of detecting problems in that
# area. # area.
...@@ -19,7 +19,7 @@ my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short()); ...@@ -19,7 +19,7 @@ my $source_ts_path = TestLib::perl2host(TestLib::tempdir_short());
my $source_ts_prefix = $source_ts_path; my $source_ts_prefix = $source_ts_path;
$source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!; $source_ts_prefix =~ s!(^[A-Z]:/[^/]*)/.*!$1!;
$master->safe_psql('postgres', <<EOM); $primary->safe_psql('postgres', <<EOM);
CREATE TABLE x1 (a int); CREATE TABLE x1 (a int);
INSERT INTO x1 VALUES (111); INSERT INTO x1 VALUES (111);
CREATE TABLESPACE ts1 LOCATION '$source_ts_path'; CREATE TABLESPACE ts1 LOCATION '$source_ts_path';
...@@ -103,13 +103,13 @@ for my $scenario (@scenario) ...@@ -103,13 +103,13 @@ for my $scenario (@scenario)
if $scenario->{'skip_on_windows'} && $windows_os; if $scenario->{'skip_on_windows'} && $windows_os;
# Take a backup and check that it verifies OK. # 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()); my $backup_ts_path = TestLib::perl2host(TestLib::tempdir_short());
# The tablespace map parameter confuses Msys2, which tries to mangle # The tablespace map parameter confuses Msys2, which tries to mangle
# it. Tell it not to. # it. Tell it not to.
# See https://www.msys2.org/wiki/Porting/#filesystem-namespaces # See https://www.msys2.org/wiki/Porting/#filesystem-namespaces
local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix; local $ENV{MSYS2_ARG_CONV_EXCL} = $source_ts_prefix;
$master->command_ok( $primary->command_ok(
[ [
'pg_basebackup', '-D', $backup_path, '--no-sync', 'pg_basebackup', '-D', $backup_path, '--no-sync',
'-T', "${source_ts_path}=${backup_ts_path}" '-T', "${source_ts_path}=${backup_ts_path}"
......
...@@ -10,11 +10,11 @@ use TestLib; ...@@ -10,11 +10,11 @@ use TestLib;
use Test::More tests => 25; use Test::More tests => 25;
# Start up the server and take a backup. # Start up the server and take a backup.
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->start; $primary->start;
my $backup_path = $master->backup_dir . '/test_options'; my $backup_path = $primary->backup_dir . '/test_options';
$master->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ], $primary->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
"base backup ok"); "base backup ok");
# Verify that pg_verifybackup -q succeeds and produces no output. # Verify that pg_verifybackup -q succeeds and produces no output.
......
...@@ -8,11 +8,11 @@ use PostgresNode; ...@@ -8,11 +8,11 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 5; use Test::More tests => 5;
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->start; $primary->start;
my $backup_path = $master->backup_dir . '/test_encoding'; my $backup_path = $primary->backup_dir . '/test_encoding';
$master->command_ok( $primary->command_ok(
[ [
'pg_basebackup', '-D', 'pg_basebackup', '-D',
$backup_path, '--no-sync', $backup_path, '--no-sync',
......
...@@ -10,16 +10,16 @@ use TestLib; ...@@ -10,16 +10,16 @@ use TestLib;
use Test::More tests => 7; use Test::More tests => 7;
# Start up the server and take a backup. # Start up the server and take a backup.
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->start; $primary->start;
my $backup_path = $master->backup_dir . '/test_wal'; my $backup_path = $primary->backup_dir . '/test_wal';
$master->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ], $primary->command_ok([ 'pg_basebackup', '-D', $backup_path, '--no-sync' ],
"base backup ok"); "base backup ok");
# Rename pg_wal. # Rename pg_wal.
my $original_pg_wal = $backup_path . '/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: $!"; rename($original_pg_wal, $relocated_pg_wal) || die "rename pg_wal: $!";
# WAL verification should fail. # WAL verification should fail.
......
...@@ -51,8 +51,8 @@ sub test_role ...@@ -51,8 +51,8 @@ sub test_role
return; return;
} }
# Initialize master node # Initialize primary node
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init; $node->init;
$node->start; $node->start;
......
...@@ -49,9 +49,9 @@ sub test_login ...@@ -49,9 +49,9 @@ sub test_login
return; return;
} }
# Initialize master node. Force UTF-8 encoding, so that we can use non-ASCII # Initialize primary node. Force UTF-8 encoding, so that we can use non-ASCII
# characters in the passwords below. # characters in the passwords below.
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init(extra => [ '--locale=C', '--encoding=UTF8' ]); $node->init(extra => [ '--locale=C', '--encoding=UTF8' ]);
$node->start; $node->start;
......
...@@ -8,45 +8,45 @@ use Test::More tests => 4; ...@@ -8,45 +8,45 @@ use Test::More tests => 4;
use PostgresNode; use PostgresNode;
my $bkplabel = 'backup'; my $bkplabel = 'backup';
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->append_conf( $primary->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{
track_commit_timestamp = on track_commit_timestamp = on
max_wal_senders = 5 max_wal_senders = 5
}); });
$master->start; $primary->start;
$master->backup($bkplabel); $primary->backup($bkplabel);
my $standby = get_new_node('standby'); my $standby = get_new_node('standby');
$standby->init_from_backup($master, $bkplabel, has_streaming => 1); $standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start; $standby->start;
for my $i (1 .. 10) for my $i (1 .. 10)
{ {
$master->safe_psql('postgres', "create table t$i()"); $primary->safe_psql('postgres', "create table t$i()");
} }
my $master_ts = $master->safe_psql('postgres', my $primary_ts = $primary->safe_psql('postgres',
qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'} qq{SELECT ts.* FROM pg_class, pg_xact_commit_timestamp(xmin) AS ts WHERE relname = 't10'}
); );
my $master_lsn = my $primary_lsn =
$master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $primary->safe_psql('postgres', 'select pg_current_wal_lsn()');
$standby->poll_query_until('postgres', $standby->poll_query_until('postgres',
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) qq{SELECT '$primary_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
or die "standby never caught up"; or die "standby never caught up";
my $standby_ts = $standby->safe_psql('postgres', my $standby_ts = $standby->safe_psql('postgres',
qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'} qq{select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = 't10'}
); );
is($master_ts, $standby_ts, "standby gives same value as master"); is($primary_ts, $standby_ts, "standby gives same value as primary");
$master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $primary->append_conf('postgresql.conf', 'track_commit_timestamp = off');
$master->restart; $primary->restart;
$master->safe_psql('postgres', 'checkpoint'); $primary->safe_psql('postgres', 'checkpoint');
$master_lsn = $master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $primary_lsn = $primary->safe_psql('postgres', 'select pg_current_wal_lsn()');
$standby->poll_query_until('postgres', $standby->poll_query_until('postgres',
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) qq{SELECT '$primary_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
or die "standby never caught up"; or die "standby never caught up";
$standby->safe_psql('postgres', 'checkpoint'); $standby->safe_psql('postgres', 'checkpoint');
...@@ -54,10 +54,10 @@ $standby->safe_psql('postgres', 'checkpoint'); ...@@ -54,10 +54,10 @@ $standby->safe_psql('postgres', 'checkpoint');
my ($ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres', my ($ret, $standby_ts_stdout, $standby_ts_stderr) = $standby->psql('postgres',
'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\'' 'select ts.* from pg_class, pg_xact_commit_timestamp(xmin) ts where relname = \'t10\''
); );
is($ret, 3, 'standby errors when master turned feature off'); is($ret, 3, 'standby errors when primary turned feature off');
is($standby_ts_stdout, '', is($standby_ts_stdout, '',
"standby gives no value when master turned feature off"); "standby gives no value when primary turned feature off");
like( like(
$standby_ts_stderr, $standby_ts_stderr,
qr/could not get commit timestamp data/, qr/could not get commit timestamp data/,
'expected error when master turned feature off'); 'expected error when primary turned feature off');
# Test master/standby scenario where the track_commit_timestamp GUC is # Test primary/standby scenario where the track_commit_timestamp GUC is
# repeatedly toggled on and off. # repeatedly toggled on and off.
use strict; use strict;
use warnings; use warnings;
...@@ -8,31 +8,31 @@ use Test::More tests => 4; ...@@ -8,31 +8,31 @@ use Test::More tests => 4;
use PostgresNode; use PostgresNode;
my $bkplabel = 'backup'; my $bkplabel = 'backup';
my $master = get_new_node('master'); my $primary = get_new_node('primary');
$master->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$master->append_conf( $primary->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{
track_commit_timestamp = on track_commit_timestamp = on
max_wal_senders = 5 max_wal_senders = 5
}); });
$master->start; $primary->start;
$master->backup($bkplabel); $primary->backup($bkplabel);
my $standby = get_new_node('standby'); my $standby = get_new_node('standby');
$standby->init_from_backup($master, $bkplabel, has_streaming => 1); $standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start; $standby->start;
for my $i (1 .. 10) for my $i (1 .. 10)
{ {
$master->safe_psql('postgres', "create table t$i()"); $primary->safe_psql('postgres', "create table t$i()");
} }
$master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $primary->append_conf('postgresql.conf', 'track_commit_timestamp = off');
$master->restart; $primary->restart;
$master->safe_psql('postgres', 'checkpoint'); $primary->safe_psql('postgres', 'checkpoint');
my $master_lsn = my $primary_lsn =
$master->safe_psql('postgres', 'select pg_current_wal_lsn()'); $primary->safe_psql('postgres', 'select pg_current_wal_lsn()');
$standby->poll_query_until('postgres', $standby->poll_query_until('postgres',
qq{SELECT '$master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()}) qq{SELECT '$primary_lsn'::pg_lsn <= pg_last_wal_replay_lsn()})
or die "standby never caught up"; or die "standby never caught up";
$standby->safe_psql('postgres', 'checkpoint'); $standby->safe_psql('postgres', 'checkpoint');
...@@ -49,10 +49,10 @@ like( ...@@ -49,10 +49,10 @@ like(
qr/could not get commit timestamp data/, qr/could not get commit timestamp data/,
'expected err msg after restart'); 'expected err msg after restart');
$master->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$master->restart; $primary->restart;
$master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $primary->append_conf('postgresql.conf', 'track_commit_timestamp = off');
$master->restart; $primary->restart;
system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote'); system_or_bail('pg_ctl', '-D', $standby->data_dir, 'promote');
......
...@@ -5,15 +5,15 @@ use PostgresNode; ...@@ -5,15 +5,15 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 16; use Test::More tests => 16;
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$node_master->start; $node_primary->start;
my ($ret, $stdout, $stderr); my ($ret, $stdout, $stderr);
($ret, $stdout, $stderr) = ($ret, $stdout, $stderr) =
$node_master->psql('postgres', qq[SELECT pg_xact_commit_timestamp('0');]); $node_primary->psql('postgres', qq[SELECT pg_xact_commit_timestamp('0');]);
is($ret, 3, 'getting ts of InvalidTransactionId reports error'); is($ret, 3, 'getting ts of InvalidTransactionId reports error');
like( like(
$stderr, $stderr,
...@@ -21,27 +21,27 @@ like( ...@@ -21,27 +21,27 @@ like(
'expected error from InvalidTransactionId'); 'expected error from InvalidTransactionId');
($ret, $stdout, $stderr) = ($ret, $stdout, $stderr) =
$node_master->psql('postgres', qq[SELECT pg_xact_commit_timestamp('1');]); $node_primary->psql('postgres', qq[SELECT pg_xact_commit_timestamp('1');]);
is($ret, 0, 'getting ts of BootstrapTransactionId succeeds'); is($ret, 0, 'getting ts of BootstrapTransactionId succeeds');
is($stdout, '', 'timestamp of BootstrapTransactionId is null'); is($stdout, '', 'timestamp of BootstrapTransactionId is null');
($ret, $stdout, $stderr) = ($ret, $stdout, $stderr) =
$node_master->psql('postgres', qq[SELECT pg_xact_commit_timestamp('2');]); $node_primary->psql('postgres', qq[SELECT pg_xact_commit_timestamp('2');]);
is($ret, 0, 'getting ts of FrozenTransactionId succeeds'); is($ret, 0, 'getting ts of FrozenTransactionId succeeds');
is($stdout, '', 'timestamp of FrozenTransactionId is null'); is($stdout, '', 'timestamp of FrozenTransactionId is null');
# Since FirstNormalTransactionId will've occurred during initdb, long before we # Since FirstNormalTransactionId will've occurred during initdb, long before we
# enabled commit timestamps, it'll be null since we have no cts data for it but # enabled commit timestamps, it'll be null since we have no cts data for it but
# cts are enabled. # cts are enabled.
is( $node_master->safe_psql( is( $node_primary->safe_psql(
'postgres', qq[SELECT pg_xact_commit_timestamp('3');]), 'postgres', qq[SELECT pg_xact_commit_timestamp('3');]),
'', '',
'committs for FirstNormalTransactionId is null'); 'committs for FirstNormalTransactionId is null');
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[CREATE TABLE committs_test(x integer, y timestamp with time zone);]); qq[CREATE TABLE committs_test(x integer, y timestamp with time zone);]);
my $xid = $node_master->safe_psql( my $xid = $node_primary->safe_psql(
'postgres', qq[ 'postgres', qq[
BEGIN; BEGIN;
INSERT INTO committs_test(x, y) VALUES (1, current_timestamp); INSERT INTO committs_test(x, y) VALUES (1, current_timestamp);
...@@ -49,43 +49,43 @@ my $xid = $node_master->safe_psql( ...@@ -49,43 +49,43 @@ my $xid = $node_master->safe_psql(
COMMIT; COMMIT;
]); ]);
my $before_restart_ts = $node_master->safe_psql('postgres', my $before_restart_ts = $node_primary->safe_psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid');]); qq[SELECT pg_xact_commit_timestamp('$xid');]);
ok($before_restart_ts ne '' && $before_restart_ts ne 'null', ok($before_restart_ts ne '' && $before_restart_ts ne 'null',
'commit timestamp recorded'); 'commit timestamp recorded');
$node_master->stop('immediate'); $node_primary->stop('immediate');
$node_master->start; $node_primary->start;
my $after_crash_ts = $node_master->safe_psql('postgres', my $after_crash_ts = $node_primary->safe_psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid');]); qq[SELECT pg_xact_commit_timestamp('$xid');]);
is($after_crash_ts, $before_restart_ts, is($after_crash_ts, $before_restart_ts,
'timestamps before and after crash are equal'); 'timestamps before and after crash are equal');
$node_master->stop('fast'); $node_primary->stop('fast');
$node_master->start; $node_primary->start;
my $after_restart_ts = $node_master->safe_psql('postgres', my $after_restart_ts = $node_primary->safe_psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid');]); qq[SELECT pg_xact_commit_timestamp('$xid');]);
is($after_restart_ts, $before_restart_ts, is($after_restart_ts, $before_restart_ts,
'timestamps before and after restart are equal'); 'timestamps before and after restart are equal');
# Now disable commit timestamps # Now disable commit timestamps
$node_master->append_conf('postgresql.conf', 'track_commit_timestamp = off'); $node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = off');
$node_master->stop('fast'); $node_primary->stop('fast');
# Start the server, which generates a XLOG_PARAMETER_CHANGE record where # Start the server, which generates a XLOG_PARAMETER_CHANGE record where
# the parameter change is registered. # the parameter change is registered.
$node_master->start; $node_primary->start;
# Now restart again the server so as no XLOG_PARAMETER_CHANGE record are # Now restart again the server so as no XLOG_PARAMETER_CHANGE record are
# replayed with the follow-up immediate shutdown. # replayed with the follow-up immediate shutdown.
$node_master->restart; $node_primary->restart;
# Move commit timestamps across page boundaries. Things should still # Move commit timestamps across page boundaries. Things should still
# be able to work across restarts with those transactions committed while # be able to work across restarts with those transactions committed while
# track_commit_timestamp is disabled. # track_commit_timestamp is disabled.
$node_master->safe_psql( $node_primary->safe_psql(
'postgres', 'postgres',
qq(CREATE PROCEDURE consume_xid(cnt int) qq(CREATE PROCEDURE consume_xid(cnt int)
AS \$\$ AS \$\$
...@@ -100,9 +100,9 @@ DECLARE ...@@ -100,9 +100,9 @@ DECLARE
\$\$ \$\$
LANGUAGE plpgsql; LANGUAGE plpgsql;
)); ));
$node_master->safe_psql('postgres', 'CALL consume_xid(2000)'); $node_primary->safe_psql('postgres', 'CALL consume_xid(2000)');
($ret, $stdout, $stderr) = $node_master->psql('postgres', ($ret, $stdout, $stderr) = $node_primary->psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid');]); qq[SELECT pg_xact_commit_timestamp('$xid');]);
is($ret, 3, 'no commit timestamp from enable tx when cts disabled'); is($ret, 3, 'no commit timestamp from enable tx when cts disabled');
like( like(
...@@ -111,7 +111,7 @@ like( ...@@ -111,7 +111,7 @@ like(
'expected error from enabled tx when committs disabled'); 'expected error from enabled tx when committs disabled');
# Do a tx while cts disabled # Do a tx while cts disabled
my $xid_disabled = $node_master->safe_psql( my $xid_disabled = $node_primary->safe_psql(
'postgres', qq[ 'postgres', qq[
BEGIN; BEGIN;
INSERT INTO committs_test(x, y) VALUES (2, current_timestamp); INSERT INTO committs_test(x, y) VALUES (2, current_timestamp);
...@@ -120,7 +120,7 @@ my $xid_disabled = $node_master->safe_psql( ...@@ -120,7 +120,7 @@ my $xid_disabled = $node_master->safe_psql(
]); ]);
# Should be inaccessible # Should be inaccessible
($ret, $stdout, $stderr) = $node_master->psql('postgres', ($ret, $stdout, $stderr) = $node_primary->psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid_disabled');]); qq[SELECT pg_xact_commit_timestamp('$xid_disabled');]);
is($ret, 3, 'no commit timestamp when disabled'); is($ret, 3, 'no commit timestamp when disabled');
like( like(
...@@ -129,21 +129,21 @@ like( ...@@ -129,21 +129,21 @@ like(
'expected error from disabled tx when committs disabled'); 'expected error from disabled tx when committs disabled');
# Re-enable, restart and ensure we can still get the old timestamps # Re-enable, restart and ensure we can still get the old timestamps
$node_master->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
# An immediate shutdown is used here. At next startup recovery will # An immediate shutdown is used here. At next startup recovery will
# replay transactions which committed when track_commit_timestamp was # replay transactions which committed when track_commit_timestamp was
# disabled, and the facility should be able to work properly. # disabled, and the facility should be able to work properly.
$node_master->stop('immediate'); $node_primary->stop('immediate');
$node_master->start; $node_primary->start;
my $after_enable_ts = $node_master->safe_psql('postgres', my $after_enable_ts = $node_primary->safe_psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid');]); qq[SELECT pg_xact_commit_timestamp('$xid');]);
is($after_enable_ts, '', 'timestamp of enabled tx null after re-enable'); is($after_enable_ts, '', 'timestamp of enabled tx null after re-enable');
my $after_enable_disabled_ts = $node_master->safe_psql('postgres', my $after_enable_disabled_ts = $node_primary->safe_psql('postgres',
qq[SELECT pg_xact_commit_timestamp('$xid_disabled');]); qq[SELECT pg_xact_commit_timestamp('$xid_disabled');]);
is($after_enable_disabled_ts, '', is($after_enable_disabled_ts, '',
'timestamp of disabled tx null after re-enable'); 'timestamp of disabled tx null after re-enable');
$node_master->stop; $node_primary->stop;
...@@ -7,7 +7,7 @@ use TestLib; ...@@ -7,7 +7,7 @@ use TestLib;
use Test::More tests => 42; use Test::More tests => 42;
# Initialize a test cluster # Initialize a test cluster
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init(); $node->init();
# Turn message level up to DEBUG1 so that we get the messages we want to see # Turn message level up to DEBUG1 so that we get the messages we want to see
$node->append_conf('postgresql.conf', 'client_min_messages = DEBUG1'); $node->append_conf('postgresql.conf', 'client_min_messages = DEBUG1');
......
...@@ -1822,11 +1822,11 @@ sub run_log ...@@ -1822,11 +1822,11 @@ sub run_log
Look up WAL locations on the server: Look up WAL locations on the server:
* insert location (master only, error on replica) * insert location (primary only, error on replica)
* write location (master only, error on replica) * write location (primary only, error on replica)
* flush location (master only, error on replica) * flush location (primary only, error on replica)
* receive location (always undef on master) * receive location (always undef on primary)
* replay location (always undef on master) * replay location (always undef on primary)
mode must be specified. mode must be specified.
...@@ -1876,7 +1876,7 @@ poll_query_until timeout. ...@@ -1876,7 +1876,7 @@ poll_query_until timeout.
Requires that the 'postgres' db exists and is accessible. Requires that the 'postgres' db exists and is accessible.
target_lsn may be any arbitrary lsn, but is typically $master_node->lsn('insert'). target_lsn may be any arbitrary lsn, but is typically $primary_node->lsn('insert').
If omitted, pg_current_wal_lsn() is used. If omitted, pg_current_wal_lsn() is used.
This is not a test. It die()s on failure. This is not a test. It die()s on failure.
...@@ -1935,7 +1935,7 @@ This is not a test. It die()s on failure. ...@@ -1935,7 +1935,7 @@ This is not a test. It die()s on failure.
If the slot is not active, will time out after poll_query_until's timeout. If the slot is not active, will time out after poll_query_until's timeout.
target_lsn may be any arbitrary lsn, but is typically $master_node->lsn('insert'). target_lsn may be any arbitrary lsn, but is typically $primary_node->lsn('insert').
Note that for logical slots, restart_lsn is held down by the oldest in-progress tx. Note that for logical slots, restart_lsn is held down by the oldest in-progress tx.
......
...@@ -48,7 +48,7 @@ Each test script should begin with: ...@@ -48,7 +48,7 @@ Each test script should begin with:
then it will generally need to set up one or more nodes, run commands then it will generally need to set up one or more nodes, run commands
against them and evaluate the results. For example: against them and evaluate the results. For example:
my $node = PostgresNode->get_new_node('master'); my $node = PostgresNode->get_new_node('primary');
$node->init; $node->init;
$node->start; $node->start;
......
This diff is collapsed.
...@@ -6,38 +6,38 @@ use TestLib; ...@@ -6,38 +6,38 @@ use TestLib;
use Test::More tests => 3; use Test::More tests => 3;
use File::Copy; use File::Copy;
# Initialize master node, doing archives # Initialize primary node, doing archives
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init( $node_primary->init(
has_archiving => 1, has_archiving => 1,
allows_streaming => 1); allows_streaming => 1);
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
# Start it # Start it
$node_master->start; $node_primary->start;
# Take backup for standby # Take backup for standby
$node_master->backup($backup_name); $node_primary->backup($backup_name);
# Initialize standby node from backup, fetching WAL from archives # Initialize standby node from backup, fetching WAL from archives
my $node_standby = get_new_node('standby'); my $node_standby = get_new_node('standby');
$node_standby->init_from_backup($node_master, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_restoring => 1); has_restoring => 1);
$node_standby->append_conf('postgresql.conf', $node_standby->append_conf('postgresql.conf',
"wal_retrieve_retry_interval = '100ms'"); "wal_retrieve_retry_interval = '100ms'");
$node_standby->start; $node_standby->start;
# Create some content on master # Create some content on primary
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a"); "CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
my $current_lsn = my $current_lsn =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
# Force archiving of WAL file to make it present on master # Force archiving of WAL file to make it present on primary
$node_master->safe_psql('postgres', "SELECT pg_switch_wal()"); $node_primary->safe_psql('postgres', "SELECT pg_switch_wal()");
# Add some more content, it should not be present on standby # Add some more content, it should not be present on standby
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(1001,2000))"); "INSERT INTO tab_int VALUES (generate_series(1001,2000))");
# Wait until necessary replay has been done on standby # Wait until necessary replay has been done on standby
...@@ -60,7 +60,7 @@ is($result, qq(1000), 'check content from archives'); ...@@ -60,7 +60,7 @@ is($result, qq(1000), 'check content from archives');
$node_standby->promote; $node_standby->promote;
my $node_standby2 = get_new_node('standby2'); my $node_standby2 = get_new_node('standby2');
$node_standby2->init_from_backup($node_master, $backup_name, $node_standby2->init_from_backup($node_primary, $backup_name,
has_restoring => 1); has_restoring => 1);
$node_standby2->start; $node_standby2->start;
......
...@@ -13,13 +13,13 @@ sub test_recovery_standby ...@@ -13,13 +13,13 @@ sub test_recovery_standby
{ {
my $test_name = shift; my $test_name = shift;
my $node_name = shift; my $node_name = shift;
my $node_master = shift; my $node_primary = shift;
my $recovery_params = shift; my $recovery_params = shift;
my $num_rows = shift; my $num_rows = shift;
my $until_lsn = shift; my $until_lsn = shift;
my $node_standby = get_new_node($node_name); my $node_standby = get_new_node($node_name);
$node_standby->init_from_backup($node_master, 'my_backup', $node_standby->init_from_backup($node_primary, 'my_backup',
has_restoring => 1); has_restoring => 1);
foreach my $param_item (@$recovery_params) foreach my $param_item (@$recovery_params)
...@@ -35,7 +35,7 @@ sub test_recovery_standby ...@@ -35,7 +35,7 @@ sub test_recovery_standby
$node_standby->poll_query_until('postgres', $caughtup_query) $node_standby->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby to catch up"; or die "Timed out while waiting for standby to catch up";
# Create some content on master and check its presence in standby # Create some content on primary and check its presence in standby
my $result = my $result =
$node_standby->safe_psql('postgres', "SELECT count(*) FROM tab_int"); $node_standby->safe_psql('postgres', "SELECT count(*) FROM tab_int");
is($result, qq($num_rows), "check standby content for $test_name"); is($result, qq($num_rows), "check standby content for $test_name");
...@@ -46,74 +46,74 @@ sub test_recovery_standby ...@@ -46,74 +46,74 @@ sub test_recovery_standby
return; return;
} }
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(has_archiving => 1, allows_streaming => 1); $node_primary->init(has_archiving => 1, allows_streaming => 1);
# Start it # Start it
$node_master->start; $node_primary->start;
# Create data before taking the backup, aimed at testing # Create data before taking the backup, aimed at testing
# recovery_target = 'immediate' # recovery_target = 'immediate'
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a"); "CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
my $lsn1 = my $lsn1 =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
# Take backup from which all operations will be run # Take backup from which all operations will be run
$node_master->backup('my_backup'); $node_primary->backup('my_backup');
# Insert some data with used as a replay reference, with a recovery # Insert some data with used as a replay reference, with a recovery
# target TXID. # target TXID.
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(1001,2000))"); "INSERT INTO tab_int VALUES (generate_series(1001,2000))");
my $ret = $node_master->safe_psql('postgres', my $ret = $node_primary->safe_psql('postgres',
"SELECT pg_current_wal_lsn(), pg_current_xact_id();"); "SELECT pg_current_wal_lsn(), pg_current_xact_id();");
my ($lsn2, $recovery_txid) = split /\|/, $ret; my ($lsn2, $recovery_txid) = split /\|/, $ret;
# More data, with recovery target timestamp # More data, with recovery target timestamp
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(2001,3000))"); "INSERT INTO tab_int VALUES (generate_series(2001,3000))");
my $lsn3 = my $lsn3 =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
my $recovery_time = $node_master->safe_psql('postgres', "SELECT now()"); my $recovery_time = $node_primary->safe_psql('postgres', "SELECT now()");
# Even more data, this time with a recovery target name # Even more data, this time with a recovery target name
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(3001,4000))"); "INSERT INTO tab_int VALUES (generate_series(3001,4000))");
my $recovery_name = "my_target"; my $recovery_name = "my_target";
my $lsn4 = my $lsn4 =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"SELECT pg_create_restore_point('$recovery_name');"); "SELECT pg_create_restore_point('$recovery_name');");
# And now for a recovery target LSN # And now for a recovery target LSN
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(4001,5000))"); "INSERT INTO tab_int VALUES (generate_series(4001,5000))");
my $lsn5 = my $recovery_lsn = my $lsn5 = my $recovery_lsn =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn()");
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(5001,6000))"); "INSERT INTO tab_int VALUES (generate_series(5001,6000))");
# Force archiving of WAL file # Force archiving of WAL file
$node_master->safe_psql('postgres', "SELECT pg_switch_wal()"); $node_primary->safe_psql('postgres', "SELECT pg_switch_wal()");
# Test recovery targets # Test recovery targets
my @recovery_params = ("recovery_target = 'immediate'"); my @recovery_params = ("recovery_target = 'immediate'");
test_recovery_standby('immediate target', test_recovery_standby('immediate target',
'standby_1', $node_master, \@recovery_params, "1000", $lsn1); 'standby_1', $node_primary, \@recovery_params, "1000", $lsn1);
@recovery_params = ("recovery_target_xid = '$recovery_txid'"); @recovery_params = ("recovery_target_xid = '$recovery_txid'");
test_recovery_standby('XID', 'standby_2', $node_master, \@recovery_params, test_recovery_standby('XID', 'standby_2', $node_primary, \@recovery_params,
"2000", $lsn2); "2000", $lsn2);
@recovery_params = ("recovery_target_time = '$recovery_time'"); @recovery_params = ("recovery_target_time = '$recovery_time'");
test_recovery_standby('time', 'standby_3', $node_master, \@recovery_params, test_recovery_standby('time', 'standby_3', $node_primary, \@recovery_params,
"3000", $lsn3); "3000", $lsn3);
@recovery_params = ("recovery_target_name = '$recovery_name'"); @recovery_params = ("recovery_target_name = '$recovery_name'");
test_recovery_standby('name', 'standby_4', $node_master, \@recovery_params, test_recovery_standby('name', 'standby_4', $node_primary, \@recovery_params,
"4000", $lsn4); "4000", $lsn4);
@recovery_params = ("recovery_target_lsn = '$recovery_lsn'"); @recovery_params = ("recovery_target_lsn = '$recovery_lsn'");
test_recovery_standby('LSN', 'standby_5', $node_master, \@recovery_params, test_recovery_standby('LSN', 'standby_5', $node_primary, \@recovery_params,
"5000", $lsn5); "5000", $lsn5);
# Multiple targets # Multiple targets
...@@ -127,10 +127,10 @@ test_recovery_standby('LSN', 'standby_5', $node_master, \@recovery_params, ...@@ -127,10 +127,10 @@ test_recovery_standby('LSN', 'standby_5', $node_master, \@recovery_params,
"recovery_target_name = ''", "recovery_target_name = ''",
"recovery_target_time = '$recovery_time'"); "recovery_target_time = '$recovery_time'");
test_recovery_standby('multiple overriding settings', test_recovery_standby('multiple overriding settings',
'standby_6', $node_master, \@recovery_params, "3000", $lsn3); 'standby_6', $node_primary, \@recovery_params, "3000", $lsn3);
my $node_standby = get_new_node('standby_7'); my $node_standby = get_new_node('standby_7');
$node_standby->init_from_backup($node_master, 'my_backup', $node_standby->init_from_backup($node_primary, 'my_backup',
has_restoring => 1); has_restoring => 1);
$node_standby->append_conf( $node_standby->append_conf(
'postgresql.conf', "recovery_target_name = '$recovery_name' 'postgresql.conf', "recovery_target_name = '$recovery_name'
...@@ -151,7 +151,7 @@ ok($logfile =~ qr/multiple recovery targets specified/, ...@@ -151,7 +151,7 @@ ok($logfile =~ qr/multiple recovery targets specified/,
$node_standby = get_new_node('standby_8'); $node_standby = get_new_node('standby_8');
$node_standby->init_from_backup( $node_standby->init_from_backup(
$node_master, 'my_backup', $node_primary, 'my_backup',
has_restoring => 1, has_restoring => 1,
standby => 0); standby => 0);
$node_standby->append_conf('postgresql.conf', $node_standby->append_conf('postgresql.conf',
......
...@@ -10,35 +10,35 @@ use Test::More tests => 2; ...@@ -10,35 +10,35 @@ use Test::More tests => 2;
$ENV{PGDATABASE} = 'postgres'; $ENV{PGDATABASE} = 'postgres';
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->start; $node_primary->start;
# Take backup # Take backup
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
$node_master->backup($backup_name); $node_primary->backup($backup_name);
# Create two standbys linking to it # Create two standbys linking to it
my $node_standby_1 = get_new_node('standby_1'); my $node_standby_1 = get_new_node('standby_1');
$node_standby_1->init_from_backup($node_master, $backup_name, $node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby_1->start; $node_standby_1->start;
my $node_standby_2 = get_new_node('standby_2'); my $node_standby_2 = get_new_node('standby_2');
$node_standby_2->init_from_backup($node_master, $backup_name, $node_standby_2->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby_2->start; $node_standby_2->start;
# Create some content on master # Create some content on primary
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a"); "CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
# Wait until standby has replayed enough data on standby 1 # Wait until standby has replayed enough data on standby 1
$node_master->wait_for_catchup($node_standby_1, 'replay', $node_primary->wait_for_catchup($node_standby_1, 'replay',
$node_master->lsn('write')); $node_primary->lsn('write'));
# Stop and remove master # Stop and remove primary
$node_master->teardown_node; $node_primary->teardown_node;
# promote standby 1 using "pg_promote", switching it to a new timeline # promote standby 1 using "pg_promote", switching it to a new timeline
my $psql_out = ''; my $psql_out = '';
......
...@@ -6,23 +6,23 @@ use PostgresNode; ...@@ -6,23 +6,23 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->start; $node_primary->start;
# And some content # And some content
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"CREATE TABLE tab_int AS SELECT generate_series(1, 10) AS a"); "CREATE TABLE tab_int AS SELECT generate_series(1, 10) AS a");
# Take backup # Take backup
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
$node_master->backup($backup_name); $node_primary->backup($backup_name);
# Create streaming standby from backup # Create streaming standby from backup
my $node_standby = get_new_node('standby'); my $node_standby = get_new_node('standby');
my $delay = 3; my $delay = 3;
$node_standby->init_from_backup($node_master, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->append_conf( $node_standby->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
...@@ -30,19 +30,19 @@ recovery_min_apply_delay = '${delay}s' ...@@ -30,19 +30,19 @@ recovery_min_apply_delay = '${delay}s'
)); ));
$node_standby->start; $node_standby->start;
# Make new content on master and check its presence in standby depending # Make new content on primary and check its presence in standby depending
# on the delay applied above. Before doing the insertion, get the # on the delay applied above. Before doing the insertion, get the
# current timestamp that will be used as a comparison base. Even on slow # current timestamp that will be used as a comparison base. Even on slow
# machines, this allows to have a predictable behavior when comparing the # machines, this allows to have a predictable behavior when comparing the
# delay between data insertion moment on master and replay time on standby. # delay between data insertion moment on primary and replay time on standby.
my $master_insert_time = time(); my $primary_insert_time = time();
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(11, 20))"); "INSERT INTO tab_int VALUES (generate_series(11, 20))");
# Now wait for replay to complete on standby. We're done waiting when the # Now wait for replay to complete on standby. We're done waiting when the
# standby has replayed up to the previously saved master LSN. # standby has replayed up to the previously saved primary LSN.
my $until_lsn = my $until_lsn =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn()");
$node_standby->poll_query_until('postgres', $node_standby->poll_query_until('postgres',
"SELECT (pg_last_wal_replay_lsn() - '$until_lsn'::pg_lsn) >= 0") "SELECT (pg_last_wal_replay_lsn() - '$until_lsn'::pg_lsn) >= 0")
...@@ -50,5 +50,5 @@ $node_standby->poll_query_until('postgres', ...@@ -50,5 +50,5 @@ $node_standby->poll_query_until('postgres',
# This test is successful if and only if the LSN has been applied with at least # This test is successful if and only if the LSN has been applied with at least
# the configured apply delay. # the configured apply delay.
ok(time() - $master_insert_time >= $delay, ok(time() - $primary_insert_time >= $delay,
"standby applies WAL only after replication delay"); "standby applies WAL only after replication delay");
...@@ -10,25 +10,25 @@ use TestLib; ...@@ -10,25 +10,25 @@ use TestLib;
use Test::More tests => 14; use Test::More tests => 14;
use Config; use Config;
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
wal_level = logical wal_level = logical
)); ));
$node_master->start; $node_primary->start;
my $backup_name = 'master_backup'; my $backup_name = 'primary_backup';
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[CREATE TABLE decoding_test(x integer, y text);]); qq[CREATE TABLE decoding_test(x integer, y text);]);
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[SELECT pg_create_logical_replication_slot('test_slot', 'test_decoding');] qq[SELECT pg_create_logical_replication_slot('test_slot', 'test_decoding');]
); );
# Cover walsender error shutdown code # Cover walsender error shutdown code
my ($result, $stdout, $stderr) = $node_master->psql( my ($result, $stdout, $stderr) = $node_primary->psql(
'template1', 'template1',
qq[START_REPLICATION SLOT test_slot LOGICAL 0/0], qq[START_REPLICATION SLOT test_slot LOGICAL 0/0],
replication => 'database'); replication => 'database');
...@@ -38,19 +38,19 @@ ok( $stderr =~ ...@@ -38,19 +38,19 @@ ok( $stderr =~
# Check case of walsender not using a database connection. Logical # Check case of walsender not using a database connection. Logical
# decoding should not be allowed. # decoding should not be allowed.
($result, $stdout, $stderr) = $node_master->psql( ($result, $stdout, $stderr) = $node_primary->psql(
'template1', 'template1',
qq[START_REPLICATION SLOT s1 LOGICAL 0/1], qq[START_REPLICATION SLOT s1 LOGICAL 0/1],
replication => 'true'); replication => 'true');
ok($stderr =~ /ERROR: logical decoding requires a database connection/, ok($stderr =~ /ERROR: logical decoding requires a database connection/,
"Logical decoding fails on non-database connection"); "Logical decoding fails on non-database connection");
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,10) s;] qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,10) s;]
); );
# Basic decoding works # Basic decoding works
$result = $node_master->safe_psql('postgres', $result = $node_primary->safe_psql('postgres',
qq[SELECT pg_logical_slot_get_changes('test_slot', NULL, NULL);]); qq[SELECT pg_logical_slot_get_changes('test_slot', NULL, NULL);]);
is(scalar(my @foobar = split /^/m, $result), is(scalar(my @foobar = split /^/m, $result),
12, 'Decoding produced 12 rows inc BEGIN/COMMIT'); 12, 'Decoding produced 12 rows inc BEGIN/COMMIT');
...@@ -58,17 +58,17 @@ is(scalar(my @foobar = split /^/m, $result), ...@@ -58,17 +58,17 @@ is(scalar(my @foobar = split /^/m, $result),
# If we immediately crash the server we might lose the progress we just made # If we immediately crash the server we might lose the progress we just made
# and replay the same changes again. But a clean shutdown should never repeat # and replay the same changes again. But a clean shutdown should never repeat
# the same changes when we use the SQL decoding interface. # the same changes when we use the SQL decoding interface.
$node_master->restart('fast'); $node_primary->restart('fast');
# There are no new writes, so the result should be empty. # There are no new writes, so the result should be empty.
$result = $node_master->safe_psql('postgres', $result = $node_primary->safe_psql('postgres',
qq[SELECT pg_logical_slot_get_changes('test_slot', NULL, NULL);]); qq[SELECT pg_logical_slot_get_changes('test_slot', NULL, NULL);]);
chomp($result); chomp($result);
is($result, '', 'Decoding after fast restart repeats no rows'); is($result, '', 'Decoding after fast restart repeats no rows');
# Insert some rows and verify that we get the same results from pg_recvlogical # Insert some rows and verify that we get the same results from pg_recvlogical
# and the SQL interface. # and the SQL interface.
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,4) s;] qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(1,4) s;]
); );
...@@ -79,22 +79,22 @@ table public.decoding_test: INSERT: x[integer]:3 y[text]:'3' ...@@ -79,22 +79,22 @@ table public.decoding_test: INSERT: x[integer]:3 y[text]:'3'
table public.decoding_test: INSERT: x[integer]:4 y[text]:'4' table public.decoding_test: INSERT: x[integer]:4 y[text]:'4'
COMMIT}; COMMIT};
my $stdout_sql = $node_master->safe_psql('postgres', my $stdout_sql = $node_primary->safe_psql('postgres',
qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');] qq[SELECT data FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');]
); );
is($stdout_sql, $expected, 'got expected output from SQL decoding session'); is($stdout_sql, $expected, 'got expected output from SQL decoding session');
my $endpos = $node_master->safe_psql('postgres', my $endpos = $node_primary->safe_psql('postgres',
"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
); );
print "waiting to replay $endpos\n"; print "waiting to replay $endpos\n";
# Insert some rows after $endpos, which we won't read. # Insert some rows after $endpos, which we won't read.
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(5,50) s;] qq[INSERT INTO decoding_test(x,y) SELECT s, s::text FROM generate_series(5,50) s;]
); );
my $stdout_recv = $node_master->pg_recvlogical_upto( my $stdout_recv = $node_primary->pg_recvlogical_upto(
'postgres', 'test_slot', $endpos, 180, 'postgres', 'test_slot', $endpos, 180,
'include-xids' => '0', 'include-xids' => '0',
'skip-empty-xacts' => '1'); 'skip-empty-xacts' => '1');
...@@ -102,27 +102,27 @@ chomp($stdout_recv); ...@@ -102,27 +102,27 @@ chomp($stdout_recv);
is($stdout_recv, $expected, is($stdout_recv, $expected,
'got same expected output from pg_recvlogical decoding session'); 'got same expected output from pg_recvlogical decoding session');
$node_master->poll_query_until('postgres', $node_primary->poll_query_until('postgres',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'test_slot' AND active_pid IS NULL)"
) or die "slot never became inactive"; ) or die "slot never became inactive";
$stdout_recv = $node_master->pg_recvlogical_upto( $stdout_recv = $node_primary->pg_recvlogical_upto(
'postgres', 'test_slot', $endpos, 180, 'postgres', 'test_slot', $endpos, 180,
'include-xids' => '0', 'include-xids' => '0',
'skip-empty-xacts' => '1'); 'skip-empty-xacts' => '1');
chomp($stdout_recv); chomp($stdout_recv);
is($stdout_recv, '', 'pg_recvlogical acknowledged changes'); is($stdout_recv, '', 'pg_recvlogical acknowledged changes');
$node_master->safe_psql('postgres', 'CREATE DATABASE otherdb'); $node_primary->safe_psql('postgres', 'CREATE DATABASE otherdb');
is( $node_master->psql( is( $node_primary->psql(
'otherdb', 'otherdb',
"SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;" "SELECT lsn FROM pg_logical_slot_peek_changes('test_slot', NULL, NULL) ORDER BY lsn DESC LIMIT 1;"
), ),
3, 3,
'replaying logical slot from another database fails'); 'replaying logical slot from another database fails');
$node_master->safe_psql('otherdb', $node_primary->safe_psql('otherdb',
qq[SELECT pg_create_logical_replication_slot('otherdb_slot', 'test_decoding');] qq[SELECT pg_create_logical_replication_slot('otherdb_slot', 'test_decoding');]
); );
...@@ -135,51 +135,51 @@ SKIP: ...@@ -135,51 +135,51 @@ SKIP:
my $pg_recvlogical = IPC::Run::start( my $pg_recvlogical = IPC::Run::start(
[ [
'pg_recvlogical', '-d', $node_master->connstr('otherdb'), 'pg_recvlogical', '-d', $node_primary->connstr('otherdb'),
'-S', 'otherdb_slot', '-f', '-', '--start' '-S', 'otherdb_slot', '-f', '-', '--start'
]); ]);
$node_master->poll_query_until('otherdb', $node_primary->poll_query_until('otherdb',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NOT NULL)"
) or die "slot never became active"; ) or die "slot never became active";
is($node_master->psql('postgres', 'DROP DATABASE otherdb'), is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
3, 'dropping a DB with active logical slots fails'); 3, 'dropping a DB with active logical slots fails');
$pg_recvlogical->kill_kill; $pg_recvlogical->kill_kill;
is($node_master->slot('otherdb_slot')->{'slot_name'}, is($node_primary->slot('otherdb_slot')->{'slot_name'},
undef, 'logical slot still exists'); undef, 'logical slot still exists');
} }
$node_master->poll_query_until('otherdb', $node_primary->poll_query_until('otherdb',
"SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)" "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'otherdb_slot' AND active_pid IS NULL)"
) or die "slot never became inactive"; ) or die "slot never became inactive";
is($node_master->psql('postgres', 'DROP DATABASE otherdb'), is($node_primary->psql('postgres', 'DROP DATABASE otherdb'),
0, 'dropping a DB with inactive logical slots succeeds'); 0, 'dropping a DB with inactive logical slots succeeds');
is($node_master->slot('otherdb_slot')->{'slot_name'}, is($node_primary->slot('otherdb_slot')->{'slot_name'},
undef, 'logical slot was actually dropped with DB'); undef, 'logical slot was actually dropped with DB');
# Test logical slot advancing and its durability. # Test logical slot advancing and its durability.
my $logical_slot = 'logical_slot'; my $logical_slot = 'logical_slot';
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"SELECT pg_create_logical_replication_slot('$logical_slot', 'test_decoding', false);" "SELECT pg_create_logical_replication_slot('$logical_slot', 'test_decoding', false);"
); );
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
CREATE TABLE tab_logical_slot (a int); CREATE TABLE tab_logical_slot (a int);
INSERT INTO tab_logical_slot VALUES (generate_series(1,10));"); INSERT INTO tab_logical_slot VALUES (generate_series(1,10));");
my $current_lsn = my $current_lsn =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
chomp($current_lsn); chomp($current_lsn);
my $psql_rc = $node_master->psql('postgres', my $psql_rc = $node_primary->psql('postgres',
"SELECT pg_replication_slot_advance('$logical_slot', '$current_lsn'::pg_lsn);" "SELECT pg_replication_slot_advance('$logical_slot', '$current_lsn'::pg_lsn);"
); );
is($psql_rc, '0', 'slot advancing with logical slot'); is($psql_rc, '0', 'slot advancing with logical slot');
my $logical_restart_lsn_pre = $node_master->safe_psql('postgres', my $logical_restart_lsn_pre = $node_primary->safe_psql('postgres',
"SELECT restart_lsn from pg_replication_slots WHERE slot_name = '$logical_slot';" "SELECT restart_lsn from pg_replication_slots WHERE slot_name = '$logical_slot';"
); );
chomp($logical_restart_lsn_pre); chomp($logical_restart_lsn_pre);
# Slot advance should persist across clean restarts. # Slot advance should persist across clean restarts.
$node_master->restart; $node_primary->restart;
my $logical_restart_lsn_post = $node_master->safe_psql('postgres', my $logical_restart_lsn_post = $node_primary->safe_psql('postgres',
"SELECT restart_lsn from pg_replication_slots WHERE slot_name = '$logical_slot';" "SELECT restart_lsn from pg_replication_slots WHERE slot_name = '$logical_slot';"
); );
chomp($logical_restart_lsn_post); chomp($logical_restart_lsn_post);
...@@ -187,4 +187,4 @@ ok(($logical_restart_lsn_pre cmp $logical_restart_lsn_post) == 0, ...@@ -187,4 +187,4 @@ ok(($logical_restart_lsn_pre cmp $logical_restart_lsn_post) == 0,
"logical slot advance persists across restarts"); "logical slot advance persists across restarts");
# done with the node # done with the node
$node_master->stop; $node_primary->stop;
...@@ -32,53 +32,53 @@ sub test_sync_state ...@@ -32,53 +32,53 @@ sub test_sync_state
# until the standby is confirmed as registered. # until the standby is confirmed as registered.
sub start_standby_and_wait sub start_standby_and_wait
{ {
my ($master, $standby) = @_; my ($primary, $standby) = @_;
my $master_name = $master->name; my $primary_name = $primary->name;
my $standby_name = $standby->name; my $standby_name = $standby->name;
my $query = my $query =
"SELECT count(1) = 1 FROM pg_stat_replication WHERE application_name = '$standby_name'"; "SELECT count(1) = 1 FROM pg_stat_replication WHERE application_name = '$standby_name'";
$standby->start; $standby->start;
print("### Waiting for standby \"$standby_name\" on \"$master_name\"\n"); print("### Waiting for standby \"$standby_name\" on \"$primary_name\"\n");
$master->poll_query_until('postgres', $query); $primary->poll_query_until('postgres', $query);
return; return;
} }
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->start; $node_primary->start;
my $backup_name = 'master_backup'; my $backup_name = 'primary_backup';
# Take backup # Take backup
$node_master->backup($backup_name); $node_primary->backup($backup_name);
# Create all the standbys. Their status on the primary is checked to ensure # Create all the standbys. Their status on the primary is checked to ensure
# the ordering of each one of them in the WAL sender array of the primary. # the ordering of each one of them in the WAL sender array of the primary.
# Create standby1 linking to master # Create standby1 linking to primary
my $node_standby_1 = get_new_node('standby1'); my $node_standby_1 = get_new_node('standby1');
$node_standby_1->init_from_backup($node_master, $backup_name, $node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_master, $node_standby_1); start_standby_and_wait($node_primary, $node_standby_1);
# Create standby2 linking to master # Create standby2 linking to primary
my $node_standby_2 = get_new_node('standby2'); my $node_standby_2 = get_new_node('standby2');
$node_standby_2->init_from_backup($node_master, $backup_name, $node_standby_2->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_master, $node_standby_2); start_standby_and_wait($node_primary, $node_standby_2);
# Create standby3 linking to master # Create standby3 linking to primary
my $node_standby_3 = get_new_node('standby3'); my $node_standby_3 = get_new_node('standby3');
$node_standby_3->init_from_backup($node_master, $backup_name, $node_standby_3->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_master, $node_standby_3); start_standby_and_wait($node_primary, $node_standby_3);
# Check that sync_state is determined correctly when # Check that sync_state is determined correctly when
# synchronous_standby_names is specified in old syntax. # synchronous_standby_names is specified in old syntax.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|2|potential standby2|2|potential
standby3|0|async), standby3|0|async),
'old syntax of synchronous_standby_names', 'old syntax of synchronous_standby_names',
...@@ -90,7 +90,7 @@ standby3|0|async), ...@@ -90,7 +90,7 @@ standby3|0|async),
# it's stored in the head of WalSnd array which manages # it's stored in the head of WalSnd array which manages
# all the standbys though they have the same priority. # all the standbys though they have the same priority.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|1|potential standby2|1|potential
standby3|1|potential), standby3|1|potential),
'asterisk in synchronous_standby_names', 'asterisk in synchronous_standby_names',
...@@ -105,23 +105,23 @@ $node_standby_3->stop; ...@@ -105,23 +105,23 @@ $node_standby_3->stop;
# Make sure that each standby reports back to the primary in the wanted # Make sure that each standby reports back to the primary in the wanted
# order. # order.
start_standby_and_wait($node_master, $node_standby_2); start_standby_and_wait($node_primary, $node_standby_2);
start_standby_and_wait($node_master, $node_standby_3); start_standby_and_wait($node_primary, $node_standby_3);
# Specify 2 as the number of sync standbys. # Specify 2 as the number of sync standbys.
# Check that two standbys are in 'sync' state. # Check that two standbys are in 'sync' state.
test_sync_state( test_sync_state(
$node_master, qq(standby2|2|sync $node_primary, qq(standby2|2|sync
standby3|3|sync), standby3|3|sync),
'2 synchronous standbys', '2 synchronous standbys',
'2(standby1,standby2,standby3)'); '2(standby1,standby2,standby3)');
# Start standby1 # Start standby1
start_standby_and_wait($node_master, $node_standby_1); start_standby_and_wait($node_primary, $node_standby_1);
# Create standby4 linking to master # Create standby4 linking to primary
my $node_standby_4 = get_new_node('standby4'); my $node_standby_4 = get_new_node('standby4');
$node_standby_4->init_from_backup($node_master, $backup_name, $node_standby_4->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby_4->start; $node_standby_4->start;
...@@ -130,7 +130,7 @@ $node_standby_4->start; ...@@ -130,7 +130,7 @@ $node_standby_4->start;
# standby3 appearing later represents potential, and standby4 is # standby3 appearing later represents potential, and standby4 is
# in 'async' state because it's not in the list. # in 'async' state because it's not in the list.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|2|sync standby2|2|sync
standby3|3|potential standby3|3|potential
standby4|0|async), standby4|0|async),
...@@ -140,7 +140,7 @@ standby4|0|async), ...@@ -140,7 +140,7 @@ standby4|0|async),
# when num_sync exceeds the number of names of potential sync standbys # when num_sync exceeds the number of names of potential sync standbys
# specified in synchronous_standby_names. # specified in synchronous_standby_names.
test_sync_state( test_sync_state(
$node_master, qq(standby1|0|async $node_primary, qq(standby1|0|async
standby2|4|sync standby2|4|sync
standby3|3|sync standby3|3|sync
standby4|1|sync), standby4|1|sync),
...@@ -154,7 +154,7 @@ standby4|1|sync), ...@@ -154,7 +154,7 @@ standby4|1|sync),
# second standby listed first in the WAL sender array, which is # second standby listed first in the WAL sender array, which is
# standby2 in this case. # standby2 in this case.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|2|sync standby2|2|sync
standby3|2|potential standby3|2|potential
standby4|2|potential), standby4|2|potential),
...@@ -164,7 +164,7 @@ standby4|2|potential), ...@@ -164,7 +164,7 @@ standby4|2|potential),
# Check that the setting of '2(*)' chooses standby2 and standby3 that are stored # Check that the setting of '2(*)' chooses standby2 and standby3 that are stored
# earlier in WalSnd array as sync standbys. # earlier in WalSnd array as sync standbys.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|potential $node_primary, qq(standby1|1|potential
standby2|1|sync standby2|1|sync
standby3|1|sync standby3|1|sync
standby4|1|potential), standby4|1|potential),
...@@ -177,7 +177,7 @@ $node_standby_3->stop; ...@@ -177,7 +177,7 @@ $node_standby_3->stop;
# Check that the state of standby1 stored earlier in WalSnd array than # Check that the state of standby1 stored earlier in WalSnd array than
# standby4 is transited from potential to sync. # standby4 is transited from potential to sync.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|1|sync standby2|1|sync
standby4|1|potential), standby4|1|potential),
'potential standby found earlier in array is promoted to sync'); 'potential standby found earlier in array is promoted to sync');
...@@ -185,7 +185,7 @@ standby4|1|potential), ...@@ -185,7 +185,7 @@ standby4|1|potential),
# Check that standby1 and standby2 are chosen as sync standbys # Check that standby1 and standby2 are chosen as sync standbys
# based on their priorities. # based on their priorities.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|sync $node_primary, qq(standby1|1|sync
standby2|2|sync standby2|2|sync
standby4|0|async), standby4|0|async),
'priority-based sync replication specified by FIRST keyword', 'priority-based sync replication specified by FIRST keyword',
...@@ -194,7 +194,7 @@ standby4|0|async), ...@@ -194,7 +194,7 @@ standby4|0|async),
# Check that all the listed standbys are considered as candidates # Check that all the listed standbys are considered as candidates
# for sync standbys in a quorum-based sync replication. # for sync standbys in a quorum-based sync replication.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|quorum $node_primary, qq(standby1|1|quorum
standby2|1|quorum standby2|1|quorum
standby4|0|async), standby4|0|async),
'2 quorum and 1 async', '2 quorum and 1 async',
...@@ -206,7 +206,7 @@ $node_standby_3->start; ...@@ -206,7 +206,7 @@ $node_standby_3->start;
# Check that the setting of 'ANY 2(*)' chooses all standbys as # Check that the setting of 'ANY 2(*)' chooses all standbys as
# candidates for quorum sync standbys. # candidates for quorum sync standbys.
test_sync_state( test_sync_state(
$node_master, qq(standby1|1|quorum $node_primary, qq(standby1|1|quorum
standby2|1|quorum standby2|1|quorum
standby3|1|quorum standby3|1|quorum
standby4|1|quorum), standby4|1|quorum),
......
...@@ -9,10 +9,10 @@ use PostgresNode; ...@@ -9,10 +9,10 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->append_conf( $node_primary->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{
fsync = on fsync = on
wal_log_hints = on wal_log_hints = on
...@@ -20,17 +20,17 @@ max_prepared_transactions = 5 ...@@ -20,17 +20,17 @@ max_prepared_transactions = 5
autovacuum = off autovacuum = off
}); });
# Create a master node and its standby, initializing both with some data # Create a primary node and its standby, initializing both with some data
# at the same time. # at the same time.
$node_master->start; $node_primary->start;
$node_master->backup('master_backup'); $node_primary->backup('primary_backup');
my $node_standby = get_new_node('standby'); my $node_standby = get_new_node('standby');
$node_standby->init_from_backup($node_master, 'master_backup', $node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;
$node_master->psql( $node_primary->psql(
'postgres', qq{ 'postgres', qq{
create table testtab (a int, b char(100)); create table testtab (a int, b char(100));
insert into testtab select generate_series(1,1000), 'foo'; insert into testtab select generate_series(1,1000), 'foo';
...@@ -39,7 +39,7 @@ delete from testtab where ctid > '(8,0)'; ...@@ -39,7 +39,7 @@ delete from testtab where ctid > '(8,0)';
}); });
# Take a lock on the table to prevent following vacuum from truncating it # Take a lock on the table to prevent following vacuum from truncating it
$node_master->psql( $node_primary->psql(
'postgres', qq{ 'postgres', qq{
begin; begin;
lock table testtab in row share mode; lock table testtab in row share mode;
...@@ -47,14 +47,14 @@ prepare transaction 'p1'; ...@@ -47,14 +47,14 @@ prepare transaction 'p1';
}); });
# Vacuum, update FSM without truncation # Vacuum, update FSM without truncation
$node_master->psql('postgres', 'vacuum verbose testtab'); $node_primary->psql('postgres', 'vacuum verbose testtab');
# Force a checkpoint # Force a checkpoint
$node_master->psql('postgres', 'checkpoint'); $node_primary->psql('postgres', 'checkpoint');
# Now do some more insert/deletes, another vacuum to ensure full-page writes # Now do some more insert/deletes, another vacuum to ensure full-page writes
# are done # are done
$node_master->psql( $node_primary->psql(
'postgres', qq{ 'postgres', qq{
insert into testtab select generate_series(1,1000), 'foo'; insert into testtab select generate_series(1,1000), 'foo';
delete from testtab where ctid > '(8,0)'; delete from testtab where ctid > '(8,0)';
...@@ -65,15 +65,15 @@ vacuum verbose testtab; ...@@ -65,15 +65,15 @@ vacuum verbose testtab;
$node_standby->psql('postgres', 'checkpoint'); $node_standby->psql('postgres', 'checkpoint');
# Release the lock, vacuum again which should lead to truncation # Release the lock, vacuum again which should lead to truncation
$node_master->psql( $node_primary->psql(
'postgres', qq{ 'postgres', qq{
rollback prepared 'p1'; rollback prepared 'p1';
vacuum verbose testtab; vacuum verbose testtab;
}); });
$node_master->psql('postgres', 'checkpoint'); $node_primary->psql('postgres', 'checkpoint');
my $until_lsn = my $until_lsn =
$node_master->safe_psql('postgres', "SELECT pg_current_wal_lsn();"); $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
# Wait long enough for standby to receive and apply all WAL # Wait long enough for standby to receive and apply all WAL
my $caughtup_query = my $caughtup_query =
......
This diff is collapsed.
...@@ -30,10 +30,10 @@ use Scalar::Util qw(blessed); ...@@ -30,10 +30,10 @@ use Scalar::Util qw(blessed);
my ($stdout, $stderr, $ret); my ($stdout, $stderr, $ret);
# Initialize master node # Initialize primary node
my $node_master = get_new_node('master'); my $node_primary = get_new_node('primary');
$node_master->init(allows_streaming => 1, has_archiving => 1); $node_primary->init(allows_streaming => 1, has_archiving => 1);
$node_master->append_conf( $node_primary->append_conf(
'postgresql.conf', q[ 'postgresql.conf', q[
wal_level = 'logical' wal_level = 'logical'
max_replication_slots = 3 max_replication_slots = 3
...@@ -42,38 +42,38 @@ log_min_messages = 'debug2' ...@@ -42,38 +42,38 @@ log_min_messages = 'debug2'
hot_standby_feedback = on hot_standby_feedback = on
wal_receiver_status_interval = 1 wal_receiver_status_interval = 1
]); ]);
$node_master->dump_info; $node_primary->dump_info;
$node_master->start; $node_primary->start;
note "testing logical timeline following with a filesystem-level copy"; note "testing logical timeline following with a filesystem-level copy";
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"SELECT pg_create_logical_replication_slot('before_basebackup', 'test_decoding');" "SELECT pg_create_logical_replication_slot('before_basebackup', 'test_decoding');"
); );
$node_master->safe_psql('postgres', "CREATE TABLE decoding(blah text);"); $node_primary->safe_psql('postgres', "CREATE TABLE decoding(blah text);");
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO decoding(blah) VALUES ('beforebb');"); "INSERT INTO decoding(blah) VALUES ('beforebb');");
# We also want to verify that DROP DATABASE on a standby with a logical # We also want to verify that DROP DATABASE on a standby with a logical
# slot works. This isn't strictly related to timeline following, but # slot works. This isn't strictly related to timeline following, but
# the only way to get a logical slot on a standby right now is to use # the only way to get a logical slot on a standby right now is to use
# the same physical copy trick, so: # the same physical copy trick, so:
$node_master->safe_psql('postgres', 'CREATE DATABASE dropme;'); $node_primary->safe_psql('postgres', 'CREATE DATABASE dropme;');
$node_master->safe_psql('dropme', $node_primary->safe_psql('dropme',
"SELECT pg_create_logical_replication_slot('dropme_slot', 'test_decoding');" "SELECT pg_create_logical_replication_slot('dropme_slot', 'test_decoding');"
); );
$node_master->safe_psql('postgres', 'CHECKPOINT;'); $node_primary->safe_psql('postgres', 'CHECKPOINT;');
my $backup_name = 'b1'; my $backup_name = 'b1';
$node_master->backup_fs_hot($backup_name); $node_primary->backup_fs_hot($backup_name);
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
q[SELECT pg_create_physical_replication_slot('phys_slot');]); q[SELECT pg_create_physical_replication_slot('phys_slot');]);
my $node_replica = get_new_node('replica'); my $node_replica = get_new_node('replica');
$node_replica->init_from_backup( $node_replica->init_from_backup(
$node_master, $backup_name, $node_primary, $backup_name,
has_streaming => 1, has_streaming => 1,
has_restoring => 1); has_restoring => 1);
$node_replica->append_conf('postgresql.conf', $node_replica->append_conf('postgresql.conf',
...@@ -81,26 +81,26 @@ $node_replica->append_conf('postgresql.conf', ...@@ -81,26 +81,26 @@ $node_replica->append_conf('postgresql.conf',
$node_replica->start; $node_replica->start;
# If we drop 'dropme' on the master, the standby should drop the # If we drop 'dropme' on the primary, the standby should drop the
# db and associated slot. # db and associated slot.
is($node_master->psql('postgres', 'DROP DATABASE dropme'), is($node_primary->psql('postgres', 'DROP DATABASE dropme'),
0, 'dropped DB with logical slot OK on master'); 0, 'dropped DB with logical slot OK on primary');
$node_master->wait_for_catchup($node_replica, 'replay', $node_primary->wait_for_catchup($node_replica, 'replay',
$node_master->lsn('insert')); $node_primary->lsn('insert'));
is( $node_replica->safe_psql( is( $node_replica->safe_psql(
'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']), 'postgres', q[SELECT 1 FROM pg_database WHERE datname = 'dropme']),
'', '',
'dropped DB dropme on standby'); 'dropped DB dropme on standby');
is($node_master->slot('dropme_slot')->{'slot_name'}, is($node_primary->slot('dropme_slot')->{'slot_name'},
undef, 'logical slot was actually dropped on standby'); undef, 'logical slot was actually dropped on standby');
# Back to testing failover... # Back to testing failover...
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"SELECT pg_create_logical_replication_slot('after_basebackup', 'test_decoding');" "SELECT pg_create_logical_replication_slot('after_basebackup', 'test_decoding');"
); );
$node_master->safe_psql('postgres', $node_primary->safe_psql('postgres',
"INSERT INTO decoding(blah) VALUES ('afterbb');"); "INSERT INTO decoding(blah) VALUES ('afterbb');");
$node_master->safe_psql('postgres', 'CHECKPOINT;'); $node_primary->safe_psql('postgres', 'CHECKPOINT;');
# Verify that only the before base_backup slot is on the replica # Verify that only the before base_backup slot is on the replica
$stdout = $node_replica->safe_psql('postgres', $stdout = $node_replica->safe_psql('postgres',
...@@ -109,20 +109,20 @@ is($stdout, 'before_basebackup', ...@@ -109,20 +109,20 @@ is($stdout, 'before_basebackup',
'Expected to find only slot before_basebackup on replica'); 'Expected to find only slot before_basebackup on replica');
# Examine the physical slot the replica uses to stream changes # Examine the physical slot the replica uses to stream changes
# from the master to make sure its hot_standby_feedback # from the primary to make sure its hot_standby_feedback
# has locked in a catalog_xmin on the physical slot, and that # has locked in a catalog_xmin on the physical slot, and that
# any xmin is < the catalog_xmin # any xmin is < the catalog_xmin
$node_master->poll_query_until( $node_primary->poll_query_until(
'postgres', q[ 'postgres', q[
SELECT catalog_xmin IS NOT NULL SELECT catalog_xmin IS NOT NULL
FROM pg_replication_slots FROM pg_replication_slots
WHERE slot_name = 'phys_slot' WHERE slot_name = 'phys_slot'
]) or die "slot's catalog_xmin never became set"; ]) or die "slot's catalog_xmin never became set";
my $phys_slot = $node_master->slot('phys_slot'); my $phys_slot = $node_primary->slot('phys_slot');
isnt($phys_slot->{'xmin'}, '', 'xmin assigned on physical slot of master'); isnt($phys_slot->{'xmin'}, '', 'xmin assigned on physical slot of primary');
isnt($phys_slot->{'catalog_xmin'}, isnt($phys_slot->{'catalog_xmin'},
'', 'catalog_xmin assigned on physical slot of master'); '', 'catalog_xmin assigned on physical slot of primary');
# Ignore wrap-around here, we're on a new cluster: # Ignore wrap-around here, we're on a new cluster:
cmp_ok( cmp_ok(
...@@ -130,11 +130,11 @@ cmp_ok( ...@@ -130,11 +130,11 @@ cmp_ok(
$phys_slot->{'catalog_xmin'}, $phys_slot->{'catalog_xmin'},
'xmin on physical slot must not be lower than catalog_xmin'); 'xmin on physical slot must not be lower than catalog_xmin');
$node_master->safe_psql('postgres', 'CHECKPOINT'); $node_primary->safe_psql('postgres', 'CHECKPOINT');
$node_master->wait_for_catchup($node_replica, 'write'); $node_primary->wait_for_catchup($node_replica, 'write');
# Boom, crash # Boom, crash
$node_master->stop('immediate'); $node_primary->stop('immediate');
$node_replica->promote; $node_replica->promote;
......
...@@ -18,7 +18,7 @@ else ...@@ -18,7 +18,7 @@ else
plan tests => 3; plan tests => 3;
} }
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init(allows_streaming => 1); $node->init(allows_streaming => 1);
$node->start; $node->start;
......
...@@ -6,30 +6,30 @@ use PostgresNode; ...@@ -6,30 +6,30 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 12; use Test::More tests => 12;
# Setup master node # Setup primary node
my $node_master = get_new_node("master"); my $node_primary = get_new_node("primary");
$node_master->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_master->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
max_prepared_transactions = 10 max_prepared_transactions = 10
log_checkpoints = true log_checkpoints = true
)); ));
$node_master->start; $node_primary->start;
$node_master->backup('master_backup'); $node_primary->backup('primary_backup');
$node_master->psql('postgres', "CREATE TABLE t_012_tbl (id int)"); $node_primary->psql('postgres', "CREATE TABLE t_012_tbl (id int)");
# Setup standby node # Setup standby node
my $node_standby = get_new_node('standby'); my $node_standby = get_new_node('standby');
$node_standby->init_from_backup($node_master, 'master_backup', $node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;
# Switch to synchronous replication # Switch to synchronous replication
$node_master->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
synchronous_standby_names = '*' synchronous_standby_names = '*'
)); ));
$node_master->psql('postgres', "SELECT pg_reload_conf()"); $node_primary->psql('postgres', "SELECT pg_reload_conf()");
my $psql_out = ''; my $psql_out = '';
my $psql_rc = ''; my $psql_rc = '';
...@@ -39,7 +39,7 @@ my $psql_rc = ''; ...@@ -39,7 +39,7 @@ my $psql_rc = '';
# so that it won't conflict with savepoint xids. # so that it won't conflict with savepoint xids.
############################################################################### ###############################################################################
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
BEGIN; BEGIN;
DELETE FROM t_012_tbl; DELETE FROM t_012_tbl;
...@@ -57,9 +57,9 @@ $node_master->psql( ...@@ -57,9 +57,9 @@ $node_master->psql(
PREPARE TRANSACTION 'xact_012_1'; PREPARE TRANSACTION 'xact_012_1';
CHECKPOINT;"); CHECKPOINT;");
$node_master->stop; $node_primary->stop;
$node_master->start; $node_primary->start;
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
-- here we can get xid of previous savepoint if nextXid -- here we can get xid of previous savepoint if nextXid
-- wasn't properly advanced -- wasn't properly advanced
...@@ -68,7 +68,7 @@ $node_master->psql( ...@@ -68,7 +68,7 @@ $node_master->psql(
ROLLBACK; ROLLBACK;
COMMIT PREPARED 'xact_012_1';"); COMMIT PREPARED 'xact_012_1';");
$node_master->psql( $node_primary->psql(
'postgres', 'postgres',
"SELECT count(*) FROM t_012_tbl", "SELECT count(*) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
...@@ -79,10 +79,10 @@ is($psql_out, '6', "Check nextXid handling for prepared subtransactions"); ...@@ -79,10 +79,10 @@ is($psql_out, '6', "Check nextXid handling for prepared subtransactions");
# PGPROC_MAX_CACHED_SUBXIDS subtransactions and also show data properly # PGPROC_MAX_CACHED_SUBXIDS subtransactions and also show data properly
# on promotion # on promotion
############################################################################### ###############################################################################
$node_master->psql('postgres', "DELETE FROM t_012_tbl"); $node_primary->psql('postgres', "DELETE FROM t_012_tbl");
# Function borrowed from src/test/regress/sql/hs_primary_extremes.sql # Function borrowed from src/test/regress/sql/hs_primary_extremes.sql
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
CREATE OR REPLACE FUNCTION hs_subxids (n integer) CREATE OR REPLACE FUNCTION hs_subxids (n integer)
RETURNS void RETURNS void
...@@ -95,19 +95,19 @@ $node_master->psql( ...@@ -95,19 +95,19 @@ $node_master->psql(
RETURN; RETURN;
EXCEPTION WHEN raise_exception THEN NULL; END; EXCEPTION WHEN raise_exception THEN NULL; END;
\$\$;"); \$\$;");
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
BEGIN; BEGIN;
SELECT hs_subxids(127); SELECT hs_subxids(127);
COMMIT;"); COMMIT;");
$node_master->wait_for_catchup($node_standby, 'replay', $node_primary->wait_for_catchup($node_standby, 'replay',
$node_master->lsn('insert')); $node_primary->lsn('insert'));
$node_standby->psql( $node_standby->psql(
'postgres', 'postgres',
"SELECT coalesce(sum(id),-1) FROM t_012_tbl", "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
is($psql_out, '8128', "Visible"); is($psql_out, '8128', "Visible");
$node_master->stop; $node_primary->stop;
$node_standby->promote; $node_standby->promote;
$node_standby->psql( $node_standby->psql(
...@@ -117,8 +117,8 @@ $node_standby->psql( ...@@ -117,8 +117,8 @@ $node_standby->psql(
is($psql_out, '8128', "Visible"); is($psql_out, '8128', "Visible");
# restore state # restore state
($node_master, $node_standby) = ($node_standby, $node_master); ($node_primary, $node_standby) = ($node_standby, $node_primary);
$node_standby->enable_streaming($node_master); $node_standby->enable_streaming($node_primary);
$node_standby->start; $node_standby->start;
$node_standby->psql( $node_standby->psql(
'postgres', 'postgres',
...@@ -126,10 +126,10 @@ $node_standby->psql( ...@@ -126,10 +126,10 @@ $node_standby->psql(
stdout => \$psql_out); stdout => \$psql_out);
is($psql_out, '8128', "Visible"); is($psql_out, '8128', "Visible");
$node_master->psql('postgres', "DELETE FROM t_012_tbl"); $node_primary->psql('postgres', "DELETE FROM t_012_tbl");
# Function borrowed from src/test/regress/sql/hs_primary_extremes.sql # Function borrowed from src/test/regress/sql/hs_primary_extremes.sql
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
CREATE OR REPLACE FUNCTION hs_subxids (n integer) CREATE OR REPLACE FUNCTION hs_subxids (n integer)
RETURNS void RETURNS void
...@@ -142,19 +142,19 @@ $node_master->psql( ...@@ -142,19 +142,19 @@ $node_master->psql(
RETURN; RETURN;
EXCEPTION WHEN raise_exception THEN NULL; END; EXCEPTION WHEN raise_exception THEN NULL; END;
\$\$;"); \$\$;");
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
BEGIN; BEGIN;
SELECT hs_subxids(127); SELECT hs_subxids(127);
PREPARE TRANSACTION 'xact_012_1';"); PREPARE TRANSACTION 'xact_012_1';");
$node_master->wait_for_catchup($node_standby, 'replay', $node_primary->wait_for_catchup($node_standby, 'replay',
$node_master->lsn('insert')); $node_primary->lsn('insert'));
$node_standby->psql( $node_standby->psql(
'postgres', 'postgres',
"SELECT coalesce(sum(id),-1) FROM t_012_tbl", "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
is($psql_out, '-1', "Not visible"); is($psql_out, '-1', "Not visible");
$node_master->stop; $node_primary->stop;
$node_standby->promote; $node_standby->promote;
$node_standby->psql( $node_standby->psql(
...@@ -164,34 +164,34 @@ $node_standby->psql( ...@@ -164,34 +164,34 @@ $node_standby->psql(
is($psql_out, '-1', "Not visible"); is($psql_out, '-1', "Not visible");
# restore state # restore state
($node_master, $node_standby) = ($node_standby, $node_master); ($node_primary, $node_standby) = ($node_standby, $node_primary);
$node_standby->enable_streaming($node_master); $node_standby->enable_streaming($node_primary);
$node_standby->start; $node_standby->start;
$psql_rc = $node_master->psql('postgres', "COMMIT PREPARED 'xact_012_1'"); $psql_rc = $node_primary->psql('postgres', "COMMIT PREPARED 'xact_012_1'");
is($psql_rc, '0', is($psql_rc, '0',
"Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby" "Restore of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
); );
$node_master->psql( $node_primary->psql(
'postgres', 'postgres',
"SELECT coalesce(sum(id),-1) FROM t_012_tbl", "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
is($psql_out, '8128', "Visible"); is($psql_out, '8128', "Visible");
$node_master->psql('postgres', "DELETE FROM t_012_tbl"); $node_primary->psql('postgres', "DELETE FROM t_012_tbl");
$node_master->psql( $node_primary->psql(
'postgres', " 'postgres', "
BEGIN; BEGIN;
SELECT hs_subxids(201); SELECT hs_subxids(201);
PREPARE TRANSACTION 'xact_012_1';"); PREPARE TRANSACTION 'xact_012_1';");
$node_master->wait_for_catchup($node_standby, 'replay', $node_primary->wait_for_catchup($node_standby, 'replay',
$node_master->lsn('insert')); $node_primary->lsn('insert'));
$node_standby->psql( $node_standby->psql(
'postgres', 'postgres',
"SELECT coalesce(sum(id),-1) FROM t_012_tbl", "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
is($psql_out, '-1', "Not visible"); is($psql_out, '-1', "Not visible");
$node_master->stop; $node_primary->stop;
$node_standby->promote; $node_standby->promote;
$node_standby->psql( $node_standby->psql(
...@@ -201,15 +201,15 @@ $node_standby->psql( ...@@ -201,15 +201,15 @@ $node_standby->psql(
is($psql_out, '-1', "Not visible"); is($psql_out, '-1', "Not visible");
# restore state # restore state
($node_master, $node_standby) = ($node_standby, $node_master); ($node_primary, $node_standby) = ($node_standby, $node_primary);
$node_standby->enable_streaming($node_master); $node_standby->enable_streaming($node_primary);
$node_standby->start; $node_standby->start;
$psql_rc = $node_master->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'"); $psql_rc = $node_primary->psql('postgres', "ROLLBACK PREPARED 'xact_012_1'");
is($psql_rc, '0', is($psql_rc, '0',
"Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby" "Rollback of PGPROC_MAX_CACHED_SUBXIDS+ prepared transaction on promoted standby"
); );
$node_master->psql( $node_primary->psql(
'postgres', 'postgres',
"SELECT coalesce(sum(id),-1) FROM t_012_tbl", "SELECT coalesce(sum(id),-1) FROM t_012_tbl",
stdout => \$psql_out); stdout => \$psql_out);
......
...@@ -25,7 +25,7 @@ plan tests => 18; ...@@ -25,7 +25,7 @@ plan tests => 18;
# is really wrong. # is really wrong.
my $psql_timeout = IPC::Run::timer(60); my $psql_timeout = IPC::Run::timer(60);
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init(allows_streaming => 1); $node->init(allows_streaming => 1);
$node->start(); $node->start();
......
This diff is collapsed.
...@@ -8,7 +8,7 @@ use TestLib; ...@@ -8,7 +8,7 @@ use TestLib;
use Test::More tests => 16; use Test::More tests => 16;
use Config; use Config;
my $primary = get_new_node('master'); my $primary = get_new_node('primary');
$primary->init( $primary->init(
has_archiving => 1, has_archiving => 1,
allows_streaming => 1); allows_streaming => 1);
......
...@@ -61,7 +61,7 @@ push @keys, 'client_wrongperms'; ...@@ -61,7 +61,7 @@ push @keys, 'client_wrongperms';
#### Set up the server. #### Set up the server.
note "setting up data directory"; note "setting up data directory";
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init; $node->init;
# PGHOST is enforced here to set up the node, subsequent connections # PGHOST is enforced here to set up the node, subsequent connections
......
...@@ -35,7 +35,7 @@ my $common_connstr; ...@@ -35,7 +35,7 @@ my $common_connstr;
# Set up the server. # Set up the server.
note "setting up data directory"; note "setting up data directory";
my $node = get_new_node('master'); my $node = get_new_node('primary');
$node->init; $node->init;
# PGHOST is enforced here to set up the node, subsequent connections # PGHOST is enforced here to set up the node, subsequent connections
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment