Unify PostgresNode's new() and get_new_node() methods

There is only one constructor now for PostgresNode, with the idiomatic
name 'new'. The method is not exported by the class, and must be called
as "PostgresNode->new('name',[args])". All the TAP tests that use
PostgresNode are modified accordingly. Third party scripts will need
adjusting, which is a fairly mechanical process (I just used a sed
script).
This commit is contained in:
Andrew Dunstan 2021-07-29 05:58:08 -04:00
parent dbfe6e4b17
commit 201a76183e
No known key found for this signature in database
GPG Key ID: 99FA7FCB59FC3B81
109 changed files with 212 additions and 238 deletions

View File

@ -15,7 +15,7 @@ my ($node, $result);
# #
# Test set-up # Test set-up
# #
$node = get_new_node('test'); $node = PostgresNode->new('test');
$node->init; $node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off'); $node->append_conf('postgresql.conf', 'autovacuum=off');
$node->start; $node->start;

View File

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 4; use Test::More tests => 4;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->append_conf('postgresql.conf', $node->append_conf('postgresql.conf',
"shared_preload_libraries = 'auto_explain'"); "shared_preload_libraries = 'auto_explain'");

View File

@ -43,7 +43,7 @@ SELECT * FROM tst WHERE i = 7 AND t = 'e';
} }
# Initialize primary node # Initialize primary node
$node_primary = get_new_node('primary'); $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->start; $node_primary->start;
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
@ -52,7 +52,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name); $node_primary->backup($backup_name);
# Create streaming standby linking to primary # Create streaming standby linking to primary
$node_standby = get_new_node('standby'); $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;

View File

@ -11,7 +11,7 @@ use TestLib;
use Test::More tests => 2; use Test::More tests => 2;
# Test set-up # Test set-up
my $node = get_new_node('test'); my $node = PostgresNode->new('test');
$node->init(allows_streaming => 'logical'); $node->init(allows_streaming => 'logical');
$node->append_conf('postgresql.conf', 'synchronous_commit = on'); $node->append_conf('postgresql.conf', 'synchronous_commit = on');
$node->start; $node->start;

View File

@ -10,7 +10,7 @@ use Test::More tests => 72;
# Test set-up # Test set-up
my ($node, $port); my ($node, $port);
$node = get_new_node('test'); $node = PostgresNode->new('test');
$node->init; $node->init;
$node->start; $node->start;
$port = $node->port; $port = $node->port;

View File

@ -120,7 +120,7 @@ sub perform_all_corruptions()
} }
# Test set-up # Test set-up
$node = get_new_node('test'); $node = PostgresNode->new('test');
$node->init; $node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off'); $node->append_conf('postgresql.conf', 'autovacuum=off');
$node->start; $node->start;

View File

@ -178,7 +178,7 @@ umask(0077);
# Set up the node. Once we create and corrupt the table, # Set up the node. Once we create and corrupt the table,
# autovacuum workers visiting the table could crash the backend. # autovacuum workers visiting the table could crash the backend.
# Disable autovacuum so that won't happen. # Disable autovacuum so that won't happen.
my $node = get_new_node('test'); my $node = PostgresNode->new('test');
$node->init; $node->init;
$node->append_conf('postgresql.conf', 'autovacuum=off'); $node->append_conf('postgresql.conf', 'autovacuum=off');

View File

@ -10,7 +10,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 5; use Test::More tests => 5;
my $node = get_new_node('test'); my $node = PostgresNode->new('test');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -18,7 +18,7 @@ program_options_handling_ok('pg_basebackup');
my $tempdir = TestLib::tempdir; my $tempdir = TestLib::tempdir;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
# Set umask so test directories and files are created with default permissions # Set umask so test directories and files are created with default permissions
umask(0077); umask(0077);
@ -268,7 +268,7 @@ SKIP:
skip "no tar program available", 1 skip "no tar program available", 1
if (!defined $tar || $tar eq ''); if (!defined $tar || $tar eq '');
my $node2 = get_new_node('replica'); my $node2 = PostgresNode->new('replica');
# Recover main data directory # Recover main data directory
$node2->init_from_backup($node, 'tarbackup2', tar_program => $tar); $node2->init_from_backup($node, 'tarbackup2', tar_program => $tar);

View File

@ -14,7 +14,7 @@ program_options_handling_ok('pg_receivewal');
# Set umask so test directories and files are created with default permissions # Set umask so test directories and files are created with default permissions
umask(0077); umask(0077);
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;

View File

@ -11,7 +11,7 @@ program_help_ok('pg_recvlogical');
program_version_ok('pg_recvlogical'); program_version_ok('pg_recvlogical');
program_options_handling_ok('pg_recvlogical'); program_options_handling_ok('pg_recvlogical');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
# Initialize node without replication settings # Initialize node without replication settings
$node->init(allows_streaming => 1, has_archiving => 1); $node->init(allows_streaming => 1, has_archiving => 1);

View File

@ -92,7 +92,7 @@ sub check_relation_corruption
} }
# Initialize node with checksums disabled. # Initialize node with checksums disabled.
my $node = get_new_node('node_checksum'); my $node = PostgresNode->new('node_checksum');
$node->init(); $node->init();
my $pgdata = $node->data_dir; my $pgdata = $node->data_dir;

View File

@ -14,7 +14,7 @@ command_fails(['pg_controldata'], 'pg_controldata without arguments fails');
command_fails([ 'pg_controldata', 'nonexistent' ], command_fails([ 'pg_controldata', 'nonexistent' ],
'pg_controldata with nonexistent directory fails'); 'pg_controldata with nonexistent directory fails');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
command_like([ 'pg_controldata', $node->data_dir ], command_like([ 'pg_controldata', $node->data_dir ],

View File

@ -14,7 +14,7 @@ my $tempdir_short = TestLib::tempdir_short;
command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ], command_exit_is([ 'pg_ctl', 'status', '-D', "$tempdir/nonexistent" ],
4, 'pg_ctl status with nonexistent directory'); 4, 'pg_ctl status with nonexistent directory');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ], command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ],

View File

@ -15,7 +15,7 @@ command_fails_like(
qr/directory .* does not exist/, qr/directory .* does not exist/,
'pg_ctl promote with nonexistent directory'); 'pg_ctl promote with nonexistent directory');
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
command_fails_like( command_fails_like(
@ -30,7 +30,7 @@ command_fails_like(
qr/not in standby mode/, qr/not in standby mode/,
'pg_ctl promote of primary instance fails'); 'pg_ctl promote of primary instance fails');
my $node_standby = get_new_node('standby'); my $node_standby = PostgresNode->new('standby');
$node_primary->backup('my_backup'); $node_primary->backup('my_backup');
$node_standby->init_from_backup($node_primary, 'my_backup', $node_standby->init_from_backup($node_primary, 'my_backup',
has_streaming => 1); has_streaming => 1);
@ -47,7 +47,7 @@ ok( $node_standby->poll_query_until(
'promoted standby is not in recovery'); 'promoted standby is not in recovery');
# same again with default wait option # same again with default wait option
$node_standby = get_new_node('standby2'); $node_standby = PostgresNode->new('standby2');
$node_standby->init_from_backup($node_primary, 'my_backup', $node_standby->init_from_backup($node_primary, 'my_backup',
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;

View File

@ -10,7 +10,7 @@ use Test::More tests => 5;
use Time::HiRes qw(usleep); use Time::HiRes qw(usleep);
# Set up node with logging collector # Set up node with logging collector
my $node = get_new_node('primary'); my $node = PostgresNode->new('primary');
$node->init(); $node->init();
$node->append_conf( $node->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(

View File

@ -3562,7 +3562,7 @@ my %tests = (
######################################### #########################################
# Create a PG instance to test actually dumping from # Create a PG instance to test actually dumping from
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -11,7 +11,7 @@ use Test::More tests => 3;
my $tempdir = TestLib::tempdir; my $tempdir = TestLib::tempdir;
my $tempdir_short = TestLib::tempdir_short; my $tempdir_short = TestLib::tempdir_short;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
my $port = $node->port; my $port = $node->port;
$node->init; $node->init;

View File

@ -51,7 +51,7 @@ my $dbname4 = 'regression' . generate_ascii_string(203, 255);
my $src_bootstrap_super = 'regress_postgres'; my $src_bootstrap_super = 'regress_postgres';
my $dst_bootstrap_super = 'boot'; my $dst_bootstrap_super = 'boot';
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init(extra => $node->init(extra =>
[ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]); [ '-U', $src_bootstrap_super, '--locale=C', '--encoding=LATIN1' ]);
@ -181,7 +181,7 @@ $restore_super =~ s/"//g
# Restore full dump through psql using environment variables for # Restore full dump through psql using environment variables for
# dbname/user connection parameters # dbname/user connection parameters
my $envar_node = get_new_node('destination_envar'); my $envar_node = PostgresNode->new('destination_envar');
$envar_node->init( $envar_node->init(
extra => extra =>
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ], [ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],
@ -208,7 +208,7 @@ is($stderr, '', 'no dump errors');
# dbname/user connection parameters. "\connect dbname=" forgets # dbname/user connection parameters. "\connect dbname=" forgets
# user/port from command line. # user/port from command line.
my $cmdline_node = get_new_node('destination_cmdline'); my $cmdline_node = PostgresNode->new('destination_cmdline');
$cmdline_node->init( $cmdline_node->init(
extra => extra =>
[ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ], [ '-U', $dst_bootstrap_super, '--locale=C', '--encoding=LATIN1' ],

View File

@ -12,7 +12,7 @@ program_help_ok('pg_resetwal');
program_version_ok('pg_resetwal'); program_version_ok('pg_resetwal');
program_options_handling_ok('pg_resetwal'); program_options_handling_ok('pg_resetwal');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
command_like([ 'pg_resetwal', '-n', $node->data_dir ], command_like([ 'pg_resetwal', '-n', $node->data_dir ],

View File

@ -10,7 +10,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 6; use Test::More tests => 6;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
my $pg_control = $node->data_dir . '/global/pg_control'; my $pg_control = $node->data_dir . '/global/pg_control';

View File

@ -58,13 +58,13 @@ primary_psql("CHECKPOINT");
# #
# A (primary) <--- B (standby) <--- C (standby) # A (primary) <--- B (standby) <--- C (standby)
$node_a->backup('my_backup'); $node_a->backup('my_backup');
$node_b = get_new_node('node_b'); $node_b = PostgresNode->new('node_b');
$node_b->init_from_backup($node_a, 'my_backup', has_streaming => 1); $node_b->init_from_backup($node_a, 'my_backup', has_streaming => 1);
$node_b->set_standby_mode(); $node_b->set_standby_mode();
$node_b->start; $node_b->start;
$node_b->backup('my_backup'); $node_b->backup('my_backup');
$node_c = get_new_node('node_c'); $node_c = PostgresNode->new('node_c');
$node_c->init_from_backup($node_b, 'my_backup', has_streaming => 1); $node_c->init_from_backup($node_b, 'my_backup', has_streaming => 1);
$node_c->set_standby_mode(); $node_c->set_standby_mode();
$node_c->start; $node_c->start;

View File

@ -40,7 +40,7 @@ use File::Copy;
my $tmp_folder = TestLib::tempdir; my $tmp_folder = TestLib::tempdir;
my $node_1 = get_new_node('node_1'); my $node_1 = PostgresNode->new('node_1');
$node_1->init(allows_streaming => 1); $node_1->init(allows_streaming => 1);
$node_1->append_conf( $node_1->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -60,11 +60,11 @@ $node_1->safe_psql('postgres', "INSERT INTO public.bar VALUES ('in both')");
my $backup_name = 'my_backup'; my $backup_name = 'my_backup';
$node_1->backup($backup_name); $node_1->backup($backup_name);
my $node_2 = get_new_node('node_2'); my $node_2 = PostgresNode->new('node_2');
$node_2->init_from_backup($node_1, $backup_name, has_streaming => 1); $node_2->init_from_backup($node_1, $backup_name, has_streaming => 1);
$node_2->start; $node_2->start;
my $node_3 = get_new_node('node_3'); my $node_3 = PostgresNode->new('node_3');
$node_3->init_from_backup($node_1, $backup_name, has_streaming => 1); $node_3->init_from_backup($node_1, $backup_name, has_streaming => 1);
$node_3->start; $node_3->start;

View File

@ -128,7 +128,7 @@ sub setup_cluster
# Initialize primary, data checksums are mandatory # Initialize primary, data checksums are mandatory
$node_primary = $node_primary =
get_new_node('primary' . ($extra_name ? "_${extra_name}" : '')); PostgresNode->new('primary' . ($extra_name ? "_${extra_name}" : ''));
# Set up pg_hba.conf and pg_ident.conf for the role running # Set up pg_hba.conf and pg_ident.conf for the role running
# pg_rewind. This role is used for all the tests, and has # pg_rewind. This role is used for all the tests, and has
@ -176,7 +176,7 @@ sub create_standby
my $extra_name = shift; my $extra_name = shift;
$node_standby = $node_standby =
get_new_node('standby' . ($extra_name ? "_${extra_name}" : '')); PostgresNode->new('standby' . ($extra_name ? "_${extra_name}" : ''));
$node_primary->backup('my_backup'); $node_primary->backup('my_backup');
$node_standby->init_from_backup($node_primary, 'my_backup'); $node_standby->init_from_backup($node_primary, 'my_backup');
my $connstr_primary = $node_primary->connstr(); my $connstr_primary = $node_primary->connstr();

View File

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 19; use Test::More tests => 19;
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;

View File

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 44; use Test::More tests => 44;
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;

View File

@ -13,7 +13,7 @@ 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 $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;
my $backup_path = $primary->backup_dir . '/test_options'; my $backup_path = $primary->backup_dir . '/test_options';

View File

@ -11,7 +11,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 5; use Test::More tests => 5;
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;
my $backup_path = $primary->backup_dir . '/test_encoding'; my $backup_path = $primary->backup_dir . '/test_encoding';

View File

@ -13,7 +13,7 @@ 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 $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->start; $primary->start;
my $backup_path = $primary->backup_dir . '/test_wal'; my $backup_path = $primary->backup_dir . '/test_wal';

View File

@ -10,7 +10,7 @@ use Test::More;
use Config; use Config;
# start a pgbench specific server # start a pgbench specific server
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -34,7 +34,7 @@ if ($@)
} }
# start a new server # start a new server
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('clusterdb');
program_version_ok('clusterdb'); program_version_ok('clusterdb');
program_options_handling_ok('clusterdb'); program_options_handling_ok('clusterdb');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 2; use Test::More tests => 2;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('createdb');
program_version_ok('createdb'); program_version_ok('createdb');
program_options_handling_ok('createdb'); program_options_handling_ok('createdb');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('createuser');
program_version_ok('createuser'); program_version_ok('createuser');
program_options_handling_ok('createuser'); program_options_handling_ok('createuser');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('dropdb');
program_version_ok('dropdb'); program_version_ok('dropdb');
program_options_handling_ok('dropdb'); program_options_handling_ok('dropdb');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('dropuser');
program_version_ok('dropuser'); program_version_ok('dropuser');
program_options_handling_ok('dropuser'); program_options_handling_ok('dropuser');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -14,7 +14,7 @@ program_options_handling_ok('pg_isready');
command_fails(['pg_isready'], 'fails with no server running'); command_fails(['pg_isready'], 'fails with no server running');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('reindexdb');
program_version_ok('reindexdb'); program_version_ok('reindexdb');
program_options_handling_ok('reindexdb'); program_options_handling_ok('reindexdb');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -7,7 +7,7 @@ use warnings;
use PostgresNode; use PostgresNode;
use Test::More tests => 2; use Test::More tests => 2;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ program_help_ok('vacuumdb');
program_version_ok('vacuumdb'); program_version_ok('vacuumdb');
program_options_handling_ok('vacuumdb'); program_options_handling_ok('vacuumdb');
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -7,7 +7,7 @@ use warnings;
use PostgresNode; use PostgresNode;
use Test::More tests => 2; use Test::More tests => 2;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -7,7 +7,7 @@ use warnings;
use PostgresNode; use PostgresNode;
use Test::More tests => 4; use Test::More tests => 4;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -23,7 +23,7 @@ my $dbname2 =
my $dbname3 = generate_ascii_string(130, 192); my $dbname3 = generate_ascii_string(130, 192);
my $dbname4 = generate_ascii_string(193, 255); my $dbname4 = generate_ascii_string(193, 255);
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]); $node->init(extra => [ '--locale=C', '--encoding=LATIN1' ]);
$node->start; $node->start;

View File

@ -62,7 +62,7 @@ sub test_role
} }
# Initialize primary node # Initialize primary node
my $node = get_new_node('primary'); my $node = PostgresNode->new('primary');
$node->init; $node->init;
$node->append_conf('postgresql.conf', "log_connections = on\n"); $node->append_conf('postgresql.conf', "log_connections = on\n");
$node->start; $node->start;

View File

@ -62,7 +62,7 @@ sub test_login
# Initialize primary 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('primary'); my $node = PostgresNode->new('primary');
$node->init(extra => [ '--locale=C', '--encoding=UTF8' ]); $node->init(extra => [ '--locale=C', '--encoding=UTF8' ]);
$node->start; $node->start;

View File

@ -167,7 +167,7 @@ END
note "setting up PostgreSQL instance"; note "setting up PostgreSQL instance";
my $node = get_new_node('node'); my $node = PostgresNode->new('node');
$node->init; $node->init;
$node->append_conf( $node->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{

View File

@ -153,7 +153,7 @@ system_or_bail 'ldappasswd', '-x', '-y', $ldap_pwfile, '-s', 'secret2',
note "setting up PostgreSQL instance"; note "setting up PostgreSQL instance";
my $node = get_new_node('node'); my $node = PostgresNode->new('node');
$node->init; $node->init;
$node->append_conf('postgresql.conf', "log_connections = on\n"); $node->append_conf('postgresql.conf', "log_connections = on\n");
$node->start; $node->start;

View File

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 2; use Test::More tests => 2;
use PostgresNode; use PostgresNode;
my $node = get_new_node('tango'); my $node = PostgresNode->new('tango');
$node->init; $node->init;
$node->append_conf('postgresql.conf', 'autovacuum_naptime=1s'); $node->append_conf('postgresql.conf', 'autovacuum_naptime=1s');
$node->start; $node->start;

View File

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 2; use Test::More tests => 2;
use PostgresNode; use PostgresNode;
my $node = get_new_node('foxtrot'); my $node = PostgresNode->new('foxtrot');
$node->init; $node->init;
$node->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $node->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$node->start; $node->start;

View File

@ -11,7 +11,7 @@ use Test::More tests => 4;
use PostgresNode; use PostgresNode;
my $bkplabel = 'backup'; my $bkplabel = 'backup';
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->append_conf( $primary->append_conf(
@ -22,7 +22,7 @@ $primary->append_conf(
$primary->start; $primary->start;
$primary->backup($bkplabel); $primary->backup($bkplabel);
my $standby = get_new_node('standby'); my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1); $standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start; $standby->start;

View File

@ -11,7 +11,7 @@ use Test::More tests => 4;
use PostgresNode; use PostgresNode;
my $bkplabel = 'backup'; my $bkplabel = 'backup';
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
$primary->append_conf( $primary->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{
@ -21,7 +21,7 @@ $primary->append_conf(
$primary->start; $primary->start;
$primary->backup($bkplabel); $primary->backup($bkplabel);
my $standby = get_new_node('standby'); my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, $bkplabel, has_streaming => 1); $standby->init_from_backup($primary, $bkplabel, has_streaming => 1);
$standby->start; $standby->start;

View File

@ -8,7 +8,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 16; use Test::More tests => 16;
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on'); $node_primary->append_conf('postgresql.conf', 'track_commit_timestamp = on');
$node_primary->start; $node_primary->start;

View File

@ -9,7 +9,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More; use Test::More;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -20,7 +20,7 @@ my $rot13pass = "SbbOnE1";
# see the Makefile for how the certificate and key have been generated # see the Makefile for how the certificate and key have been generated
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->append_conf('postgresql.conf', $node->append_conf('postgresql.conf',
"ssl_passphrase.passphrase = '$rot13pass'"); "ssl_passphrase.passphrase = '$rot13pass'");

View File

@ -10,7 +10,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('primary'); my $node = PostgresNode->new('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');

View File

@ -713,7 +713,7 @@ my %tests = (
######################################### #########################################
# Create a PG instance to test actually dumping from # Create a PG instance to test actually dumping from
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -11,7 +11,7 @@ PostgresNode - class representing PostgreSQL server instance
use PostgresNode; use PostgresNode;
my $node = PostgresNode->get_new_node('mynode'); my $node = PostgresNode->new('mynode');
# Create a data directory with initdb # Create a data directory with initdb
$node->init(); $node->init();
@ -61,9 +61,9 @@ PostgresNode - class representing PostgreSQL server instance
my $ret = $node->backup_fs_cold('testbackup3') my $ret = $node->backup_fs_cold('testbackup3')
# Restore it to create a new independent node (not a replica) # Restore it to create a new independent node (not a replica)
my $replica = get_new_node('replica'); my $other_node = PostgresNode->new('mycopy');
$replica->init_from_backup($node, 'testbackup'); $other_node->init_from_backup($node, 'testbackup');
$replica->start; $other_node->start;
# Stop the server # Stop the server
$node->stop('fast'); $node->stop('fast');
@ -110,7 +110,6 @@ use Time::HiRes qw(usleep);
use Scalar::Util qw(blessed); use Scalar::Util qw(blessed);
our @EXPORT = qw( our @EXPORT = qw(
get_new_node
get_free_port get_free_port
); );
@ -139,41 +138,6 @@ INIT
=over =over
=item PostgresNode::new($class, $name, $pghost, $pgport)
Create a new PostgresNode instance. Does not initdb or start it.
You should generally prefer to use get_new_node() instead since it takes care
of finding port numbers, registering instances for cleanup, etc.
=cut
sub new
{
my ($class, $name, $pghost, $pgport) = @_;
my $testname = basename($0);
$testname =~ s/\.[^.]+$//;
my $self = {
_port => $pgport,
_host => $pghost,
_basedir => "$TestLib::tmp_check/t_${testname}_${name}_data",
_name => $name,
_logfile_generation => 0,
_logfile_base => "$TestLib::log_path/${testname}_${name}",
_logfile => "$TestLib::log_path/${testname}_${name}.log"
};
bless $self, $class;
mkdir $self->{_basedir}
or
BAIL_OUT("could not create data directory \"$self->{_basedir}\": $!");
$self->dump_info;
return $self;
}
=pod
=item $node->port() =item $node->port()
Get the port number assigned to the host. This won't necessarily be a TCP port Get the port number assigned to the host. This won't necessarily be a TCP port
@ -1168,15 +1132,13 @@ sub _update_pid
=pod =pod
=item PostgresNode->get_new_node(node_name, %params) =item PostgresNode->new(node_name, %params)
Build a new object of class C<PostgresNode> (or of a subclass, if you have Build a new object of class C<PostgresNode> (or of a subclass, if you have
one), assigning a free port number. Remembers the node, to prevent its port one), assigning a free port number. Remembers the node, to prevent its port
number from being reused for another node, and to ensure that it gets number from being reused for another node, and to ensure that it gets
shut down when the test script exits. shut down when the test script exits.
You should generally use this instead of C<PostgresNode::new(...)>.
=over =over
=item port => [1,65535] =item port => [1,65535]
@ -1201,15 +1163,11 @@ not provided, Postgres binaries will be found in the caller's PATH.
=back =back
For backwards compatibility, it is also exported as a standalone function,
which can only create objects of class C<PostgresNode>.
=cut =cut
sub get_new_node sub new
{ {
my $class = 'PostgresNode'; my $class = shift;
$class = shift if scalar(@_) % 2 != 1;
my ($name, %params) = @_; my ($name, %params) = @_;
# Select a port. # Select a port.
@ -1244,14 +1202,30 @@ sub get_new_node
} }
} }
# Lock port number found by creating a new node my $testname = basename($0);
my $node = $class->new($name, $host, $port); $testname =~ s/\.[^.]+$//;
my $node = {
_port => $port,
_host => $host,
_basedir => "$TestLib::tmp_check/t_${testname}_${name}_data",
_name => $name,
_logfile_generation => 0,
_logfile_base => "$TestLib::log_path/${testname}_${name}",
_logfile => "$TestLib::log_path/${testname}_${name}.log"
};
if ($params{install_path}) if ($params{install_path})
{ {
$node->{_install_path} = $params{install_path}; $node->{_install_path} = $params{install_path};
} }
bless $node, $class;
mkdir $node->{_basedir}
or
BAIL_OUT("could not create data directory \"$node->{_basedir}\": $!");
$node->dump_info;
# Add node to list of nodes # Add node to list of nodes
push(@all_nodes, $node); push(@all_nodes, $node);
@ -1322,7 +1296,7 @@ sub _set_pg_version
# the remainder are# set. Then the PATH and (DY)LD_LIBRARY_PATH are adjusted # the remainder are# set. Then the PATH and (DY)LD_LIBRARY_PATH are adjusted
# if the node's install path is set, and the copy environment is returned. # if the node's install path is set, and the copy environment is returned.
# #
# The install path set in get_new_node needs to be a directory containing # The install path set in new() needs to be a directory containing
# bin and lib subdirectories as in a standard PostgreSQL installation, so this # bin and lib subdirectories as in a standard PostgreSQL installation, so this
# can't be used with installations where the bin and lib directories don't have # can't be used with installations where the bin and lib directories don't have
# a common parent directory. # a common parent directory.
@ -1407,7 +1381,7 @@ sub installed_command
=item get_free_port() =item get_free_port()
Locate an unprivileged (high) TCP port that's not currently bound to Locate an unprivileged (high) TCP port that's not currently bound to
anything. This is used by get_new_node, and is also exported for use anything. This is used by new(), and is also exported for use
by test cases that need to start other, non-Postgres servers. by test cases that need to start other, non-Postgres servers.
Ports assigned to existing PostgresNode objects are automatically Ports assigned to existing PostgresNode objects are automatically

View File

@ -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('primary'); my $node = PostgresNode->new('primary');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -9,7 +9,7 @@ use TestLib;
use Test::More tests => 49; use Test::More tests => 49;
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
# A specific role is created to perform some tests related to replication, # A specific role is created to perform some tests related to replication,
# and it needs proper authentication configuration. # and it needs proper authentication configuration.
$node_primary->init( $node_primary->init(
@ -22,7 +22,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name); $node_primary->backup($backup_name);
# Create streaming standby linking to primary # Create streaming standby linking to primary
my $node_standby_1 = get_new_node('standby_1'); my $node_standby_1 = PostgresNode->new('standby_1');
$node_standby_1->init_from_backup($node_primary, $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;
@ -37,7 +37,7 @@ $node_standby_1->backup('my_backup_2');
$node_primary->start; $node_primary->start;
# Create second standby node linking to standby 1 # Create second standby node linking to standby 1
my $node_standby_2 = get_new_node('standby_2'); my $node_standby_2 = PostgresNode->new('standby_2');
$node_standby_2->init_from_backup($node_standby_1, $backup_name, $node_standby_2->init_from_backup($node_standby_1, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby_2->start; $node_standby_2->start;

View File

@ -10,7 +10,7 @@ use Test::More tests => 3;
use File::Copy; use File::Copy;
# Initialize primary node, doing archives # Initialize primary node, doing archives
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init( $node_primary->init(
has_archiving => 1, has_archiving => 1,
allows_streaming => 1); allows_streaming => 1);
@ -23,7 +23,7 @@ $node_primary->start;
$node_primary->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 = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $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',
@ -62,7 +62,7 @@ is($result, qq(1000), 'check content from archives');
# promoted. # promoted.
$node_standby->promote; $node_standby->promote;
my $node_standby2 = get_new_node('standby2'); my $node_standby2 = PostgresNode->new('standby2');
$node_standby2->init_from_backup($node_primary, $backup_name, $node_standby2->init_from_backup($node_primary, $backup_name,
has_restoring => 1); has_restoring => 1);
$node_standby2->start; $node_standby2->start;

View File

@ -21,7 +21,7 @@ sub test_recovery_standby
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 = PostgresNode->new($node_name);
$node_standby->init_from_backup($node_primary, 'my_backup', $node_standby->init_from_backup($node_primary, 'my_backup',
has_restoring => 1); has_restoring => 1);
@ -50,7 +50,7 @@ sub test_recovery_standby
} }
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(has_archiving => 1, allows_streaming => 1); $node_primary->init(has_archiving => 1, allows_streaming => 1);
# Bump the transaction ID epoch. This is useful to stress the portability # Bump the transaction ID epoch. This is useful to stress the portability
@ -136,7 +136,7 @@ test_recovery_standby('LSN', 'standby_5', $node_primary, \@recovery_params,
test_recovery_standby('multiple overriding settings', test_recovery_standby('multiple overriding settings',
'standby_6', $node_primary, \@recovery_params, "3000", $lsn3); 'standby_6', $node_primary, \@recovery_params, "3000", $lsn3);
my $node_standby = get_new_node('standby_7'); my $node_standby = PostgresNode->new('standby_7');
$node_standby->init_from_backup($node_primary, '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(
@ -156,7 +156,7 @@ ok($logfile =~ qr/multiple recovery targets specified/,
# Check behavior when recovery ends before target is reached # Check behavior when recovery ends before target is reached
$node_standby = get_new_node('standby_8'); $node_standby = PostgresNode->new('standby_8');
$node_standby->init_from_backup( $node_standby->init_from_backup(
$node_primary, 'my_backup', $node_primary, 'my_backup',
has_restoring => 1, has_restoring => 1,

View File

@ -15,7 +15,7 @@ $ENV{PGDATABASE} = 'postgres';
# on a new timeline. # on a new timeline.
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->start; $node_primary->start;
@ -24,11 +24,11 @@ my $backup_name = 'my_backup';
$node_primary->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 = PostgresNode->new('standby_1');
$node_standby_1->init_from_backup($node_primary, $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 = PostgresNode->new('standby_2');
$node_standby_2->init_from_backup($node_primary, $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;
@ -76,7 +76,7 @@ is($result, qq(2000), 'check content of standby 2');
# when WAL archiving is enabled. # when WAL archiving is enabled.
# Initialize primary node # Initialize primary node
my $node_primary_2 = get_new_node('primary_2'); my $node_primary_2 = PostgresNode->new('primary_2');
$node_primary_2->init(allows_streaming => 1, has_archiving => 1); $node_primary_2->init(allows_streaming => 1, has_archiving => 1);
$node_primary_2->append_conf( $node_primary_2->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -88,7 +88,7 @@ $node_primary_2->start;
$node_primary_2->backup($backup_name); $node_primary_2->backup($backup_name);
# Create standby node # Create standby node
my $node_standby_3 = get_new_node('standby_3'); my $node_standby_3 = PostgresNode->new('standby_3');
$node_standby_3->init_from_backup($node_primary_2, $backup_name, $node_standby_3->init_from_backup($node_primary_2, $backup_name,
has_streaming => 1); has_streaming => 1);

View File

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 3; use Test::More tests => 3;
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->start; $node_primary->start;
@ -23,7 +23,7 @@ my $backup_name = 'my_backup';
$node_primary->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 = PostgresNode->new('standby');
my $delay = 3; my $delay = 3;
$node_standby->init_from_backup($node_primary, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
@ -58,7 +58,7 @@ ok(time() - $primary_insert_time >= $delay,
# Check that recovery can be paused or resumed expectedly. # Check that recovery can be paused or resumed expectedly.
my $node_standby2 = get_new_node('standby2'); my $node_standby2 = PostgresNode->new('standby2');
$node_standby2->init_from_backup($node_primary, $backup_name, $node_standby2->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby2->start; $node_standby2->start;

View File

@ -14,7 +14,7 @@ use Test::More tests => 14;
use Config; use Config;
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(

View File

@ -49,7 +49,7 @@ sub start_standby_and_wait
} }
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->start; $node_primary->start;
my $backup_name = 'primary_backup'; my $backup_name = 'primary_backup';
@ -61,19 +61,19 @@ $node_primary->backup($backup_name);
# 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 primary # Create standby1 linking to primary
my $node_standby_1 = get_new_node('standby1'); my $node_standby_1 = PostgresNode->new('standby1');
$node_standby_1->init_from_backup($node_primary, $backup_name, $node_standby_1->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_1); start_standby_and_wait($node_primary, $node_standby_1);
# Create standby2 linking to primary # Create standby2 linking to primary
my $node_standby_2 = get_new_node('standby2'); my $node_standby_2 = PostgresNode->new('standby2');
$node_standby_2->init_from_backup($node_primary, $backup_name, $node_standby_2->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_2); start_standby_and_wait($node_primary, $node_standby_2);
# Create standby3 linking to primary # Create standby3 linking to primary
my $node_standby_3 = get_new_node('standby3'); my $node_standby_3 = PostgresNode->new('standby3');
$node_standby_3->init_from_backup($node_primary, $backup_name, $node_standby_3->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
start_standby_and_wait($node_primary, $node_standby_3); start_standby_and_wait($node_primary, $node_standby_3);
@ -123,7 +123,7 @@ standby3|3|sync),
start_standby_and_wait($node_primary, $node_standby_1); start_standby_and_wait($node_primary, $node_standby_1);
# Create standby4 linking to primary # Create standby4 linking to primary
my $node_standby_4 = get_new_node('standby4'); my $node_standby_4 = PostgresNode->new('standby4');
$node_standby_4->init_from_backup($node_primary, $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;

View File

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->append_conf( $node_primary->append_conf(
@ -28,7 +28,7 @@ autovacuum = off
$node_primary->start; $node_primary->start;
$node_primary->backup('primary_backup'); $node_primary->backup('primary_backup');
my $node_standby = get_new_node('standby'); my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, 'primary_backup', $node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;

View File

@ -29,7 +29,7 @@ sub configure_and_reload
# Set up two nodes, which will alternately be primary and replication standby. # Set up two nodes, which will alternately be primary and replication standby.
# Setup london node # Setup london node
my $node_london = get_new_node("london"); my $node_london = PostgresNode->new("london");
$node_london->init(allows_streaming => 1); $node_london->init(allows_streaming => 1);
$node_london->append_conf( $node_london->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -40,7 +40,7 @@ $node_london->start;
$node_london->backup('london_backup'); $node_london->backup('london_backup');
# Setup paris node # Setup paris node
my $node_paris = get_new_node('paris'); my $node_paris = PostgresNode->new('paris');
$node_paris->init_from_backup($node_london, 'london_backup', $node_paris->init_from_backup($node_london, 'london_backup',
has_streaming => 1); has_streaming => 1);
$node_paris->start; $node_paris->start;

View File

@ -34,7 +34,7 @@ use Scalar::Util qw(blessed);
my ($stdout, $stderr, $ret); my ($stdout, $stderr, $ret);
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1, has_archiving => 1); $node_primary->init(allows_streaming => 1, has_archiving => 1);
$node_primary->append_conf( $node_primary->append_conf(
'postgresql.conf', q[ 'postgresql.conf', q[
@ -74,7 +74,7 @@ $node_primary->backup_fs_hot($backup_name);
$node_primary->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 = PostgresNode->new('replica');
$node_replica->init_from_backup( $node_replica->init_from_backup(
$node_primary, $backup_name, $node_primary, $backup_name,
has_streaming => 1, has_streaming => 1,

View File

@ -13,7 +13,7 @@ use Config;
plan tests => 3; plan tests => 3;
my $node = get_new_node('primary'); my $node = PostgresNode->new('primary');
$node->init(allows_streaming => 1); $node->init(allows_streaming => 1);
$node->start; $node->start;

View File

@ -10,7 +10,7 @@ use TestLib;
use Test::More tests => 12; use Test::More tests => 12;
# Setup primary node # Setup primary node
my $node_primary = get_new_node("primary"); my $node_primary = PostgresNode->new("primary");
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -22,7 +22,7 @@ $node_primary->backup('primary_backup');
$node_primary->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 = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, 'primary_backup', $node_standby->init_from_backup($node_primary, 'primary_backup',
has_streaming => 1); has_streaming => 1);
$node_standby->start; $node_standby->start;

View File

@ -27,7 +27,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('primary'); my $node = PostgresNode->new('primary');
$node->init(allows_streaming => 1); $node->init(allows_streaming => 1);
$node->start(); $node->start();

View File

@ -12,7 +12,7 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 12; use Test::More tests => 12;
my $node = get_new_node('main'); my $node = PostgresNode->new('main');
$node->init; $node->init;
$node->start; $node->start;

View File

@ -12,7 +12,7 @@ use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
# Initialize primary node # Initialize primary node
my $alpha = get_new_node('alpha'); my $alpha = PostgresNode->new('alpha');
$alpha->init(allows_streaming => 1); $alpha->init(allows_streaming => 1);
# Setting wal_log_hints to off is important to get invalid page # Setting wal_log_hints to off is important to get invalid page
# references. # references.
@ -25,7 +25,7 @@ $alpha->start;
# setup/start a standby # setup/start a standby
$alpha->backup('bkp'); $alpha->backup('bkp');
my $bravo = get_new_node('bravo'); my $bravo = PostgresNode->new('bravo');
$bravo->init_from_backup($alpha, 'bkp', has_streaming => 1); $bravo->init_from_backup($alpha, 'bkp', has_streaming => 1);
$bravo->append_conf('postgresql.conf', <<EOF); $bravo->append_conf('postgresql.conf', <<EOF);
checkpoint_timeout=1h checkpoint_timeout=1h

View File

@ -43,7 +43,7 @@ sub find_largest_lsn
} }
# Initialize primary node # Initialize primary node
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1); $primary->init(allows_streaming => 1);
# Set shared_buffers to a very low value to enforce discard and flush # Set shared_buffers to a very low value to enforce discard and flush
@ -61,7 +61,7 @@ $primary->start;
# setup/start a standby # setup/start a standby
$primary->backup('bkp'); $primary->backup('bkp');
my $standby = get_new_node('standby'); my $standby = PostgresNode->new('standby');
$standby->init_from_backup($primary, 'bkp', has_streaming => 1); $standby->init_from_backup($primary, 'bkp', has_streaming => 1);
$standby->start; $standby->start;

View File

@ -43,7 +43,7 @@ sub log_ipcs
} }
# Node setup. # Node setup.
my $gnat = PostgresNode->get_new_node('gnat'); my $gnat = PostgresNode->new('gnat');
$gnat->init; $gnat->init;
# Create a shmem segment that will conflict with gnat's first choice # Create a shmem segment that will conflict with gnat's first choice

View File

@ -43,7 +43,7 @@ sub run_wal_optimize
{ {
my $wal_level = shift; my $wal_level = shift;
my $node = get_new_node("node_$wal_level"); my $node = PostgresNode->new("node_$wal_level");
$node->init; $node->init;
$node->append_conf( $node->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(

View File

@ -17,7 +17,7 @@ use Time::HiRes qw(usleep);
$ENV{PGDATABASE} = 'postgres'; $ENV{PGDATABASE} = 'postgres';
# Initialize primary node, setting wal-segsize to 1MB # Initialize primary node, setting wal-segsize to 1MB
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1, extra => ['--wal-segsize=1']); $node_primary->init(allows_streaming => 1, extra => ['--wal-segsize=1']);
$node_primary->append_conf( $node_primary->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -41,7 +41,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name); $node_primary->backup($backup_name);
# Create a standby linking to it using the replication slot # Create a standby linking to it using the replication slot
my $node_standby = get_new_node('standby_1'); my $node_standby = PostgresNode->new('standby_1');
$node_standby->init_from_backup($node_primary, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'"); $node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'");
@ -250,7 +250,7 @@ ok($failed, 'check that replication has been broken');
$node_primary->stop; $node_primary->stop;
$node_standby->stop; $node_standby->stop;
my $node_primary2 = get_new_node('primary2'); my $node_primary2 = PostgresNode->new('primary2');
$node_primary2->init(allows_streaming => 1); $node_primary2->init(allows_streaming => 1);
$node_primary2->append_conf( $node_primary2->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -271,7 +271,7 @@ max_slot_wal_keep_size = 0
)); ));
$node_primary2->start; $node_primary2->start;
$node_standby = get_new_node('standby_2'); $node_standby = PostgresNode->new('standby_2');
$node_standby->init_from_backup($node_primary2, $backup_name, $node_standby->init_from_backup($node_primary2, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'"); $node_standby->append_conf('postgresql.conf', "primary_slot_name = 'rep1'");
@ -303,7 +303,7 @@ if ($TestLib::windows_os)
# Get a slot terminated while the walsender is active # Get a slot terminated while the walsender is active
# We do this by sending SIGSTOP to the walsender. Skip this on Windows. # We do this by sending SIGSTOP to the walsender. Skip this on Windows.
my $node_primary3 = get_new_node('primary3'); my $node_primary3 = PostgresNode->new('primary3');
$node_primary3->init(allows_streaming => 1, extra => ['--wal-segsize=1']); $node_primary3->init(allows_streaming => 1, extra => ['--wal-segsize=1']);
$node_primary3->append_conf( $node_primary3->append_conf(
'postgresql.conf', qq( 'postgresql.conf', qq(
@ -319,7 +319,7 @@ $node_primary3->safe_psql('postgres',
$backup_name = 'my_backup'; $backup_name = 'my_backup';
$node_primary3->backup($backup_name); $node_primary3->backup($backup_name);
# Create standby # Create standby
my $node_standby3 = get_new_node('standby_3'); my $node_standby3 = PostgresNode->new('standby_3');
$node_standby3->init_from_backup($node_primary3, $backup_name, $node_standby3->init_from_backup($node_primary3, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby3->append_conf('postgresql.conf', "primary_slot_name = 'rep3'"); $node_standby3->append_conf('postgresql.conf', "primary_slot_name = 'rep3'");

View File

@ -11,7 +11,7 @@ use TestLib;
use Test::More tests => 16; use Test::More tests => 16;
use Config; use Config;
my $primary = get_new_node('primary'); my $primary = PostgresNode->new('primary');
$primary->init( $primary->init(
has_archiving => 1, has_archiving => 1,
allows_streaming => 1); allows_streaming => 1);
@ -138,7 +138,7 @@ $primary->poll_query_until('postgres',
or die "Timed out while waiting for archiving to finish"; or die "Timed out while waiting for archiving to finish";
# Test standby with archive_mode = on. # Test standby with archive_mode = on.
my $standby1 = get_new_node('standby'); my $standby1 = PostgresNode->new('standby');
$standby1->init_from_backup($primary, 'backup', has_restoring => 1); $standby1->init_from_backup($primary, 'backup', has_restoring => 1);
$standby1->append_conf('postgresql.conf', "archive_mode = on"); $standby1->append_conf('postgresql.conf', "archive_mode = on");
my $standby1_data = $standby1->data_dir; my $standby1_data = $standby1->data_dir;
@ -174,7 +174,7 @@ ok( -f "$standby1_data/$segment_path_2_done",
# command to fail to persist the .ready files. Note that this node # command to fail to persist the .ready files. Note that this node
# has inherited the archive command of the previous cold backup that # has inherited the archive command of the previous cold backup that
# will cause archiving failures. # will cause archiving failures.
my $standby2 = get_new_node('standby2'); my $standby2 = PostgresNode->new('standby2');
$standby2->init_from_backup($primary, 'backup', has_restoring => 1); $standby2->init_from_backup($primary, 'backup', has_restoring => 1);
$standby2->append_conf('postgresql.conf', 'archive_mode = always'); $standby2->append_conf('postgresql.conf', 'archive_mode = always');
my $standby2_data = $standby2->data_dir; my $standby2_data = $standby2->data_dir;

View File

@ -12,7 +12,7 @@ use Test::More tests => 10;
use Config; use Config;
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(allows_streaming => 1); $node_primary->init(allows_streaming => 1);
$node_primary->append_conf('postgresql.conf', 'max_prepared_transactions=10'); $node_primary->append_conf('postgresql.conf', 'max_prepared_transactions=10');
$node_primary->start; $node_primary->start;
@ -26,7 +26,7 @@ my $backup_name = 'my_backup';
$node_primary->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 = PostgresNode->new('standby');
$node_standby->init_from_backup($node_primary, $backup_name, $node_standby->init_from_backup($node_primary, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_standby->append_conf('postgresql.conf', 'max_prepared_transactions=10'); $node_standby->append_conf('postgresql.conf', 'max_prepared_transactions=10');

View File

@ -26,7 +26,7 @@ else
# 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('node_crash'); my $node = PostgresNode->new('node_crash');
$node->init(); $node->init();
$node->start(); $node->start();

View File

@ -10,7 +10,7 @@ use Test::More tests => 1;
use File::Compare; use File::Compare;
# Initialize and start primary node with WAL archiving # Initialize and start primary node with WAL archiving
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
$node_primary->init(has_archiving => 1, allows_streaming => 1); $node_primary->init(has_archiving => 1, allows_streaming => 1);
$node_primary->append_conf( $node_primary->append_conf(
'postgresql.conf', qq{ 'postgresql.conf', qq{
@ -24,7 +24,7 @@ $node_primary->backup($backup_name);
# Initialize node for PITR targeting a very specific restore point, just # Initialize node for PITR targeting a very specific restore point, just
# after a PREPARE TRANSACTION is issued so as we finish with a promoted # after a PREPARE TRANSACTION is issued so as we finish with a promoted
# node where this 2PC transaction needs an explicit COMMIT PREPARED. # node where this 2PC transaction needs an explicit COMMIT PREPARED.
my $node_pitr = get_new_node('node_pitr'); my $node_pitr = PostgresNode->new('node_pitr');
$node_pitr->init_from_backup( $node_pitr->init_from_backup(
$node_primary, $backup_name, $node_primary, $backup_name,
standby => 0, standby => 0,

View File

@ -11,7 +11,7 @@ use Time::HiRes qw(usleep);
# Initialize and start node with wal_level = replica and WAL archiving # Initialize and start node with wal_level = replica and WAL archiving
# enabled. # enabled.
my $node = get_new_node('orig'); my $node = PostgresNode->new('orig');
$node->init(has_archiving => 1, allows_streaming => 1); $node->init(has_archiving => 1, allows_streaming => 1);
my $replica_config = q[ my $replica_config = q[
wal_level = replica wal_level = replica
@ -66,7 +66,7 @@ sub test_recovery_wal_level_minimal
{ {
my ($node_name, $node_text, $standby_setting) = @_; my ($node_name, $node_text, $standby_setting) = @_;
my $recovery_node = get_new_node($node_name); my $recovery_node = PostgresNode->new($node_name);
$recovery_node->init_from_backup( $recovery_node->init_from_backup(
$node, $backup_name, $node, $backup_name,
has_restoring => 1, has_restoring => 1,

View File

@ -16,7 +16,7 @@ use FindBin;
use Test::More tests => 1; use Test::More tests => 1;
# Initialize primary node # Initialize primary node
my $node_primary = get_new_node('primary'); my $node_primary = PostgresNode->new('primary');
# Set up an archive command that will copy the history file but not the WAL # Set up an archive command that will copy the history file but not the WAL
# files. No real archive command should behave this way; the point is to # files. No real archive command should behave this way; the point is to
@ -47,7 +47,7 @@ my $backup_name = 'my_backup';
$node_primary->backup($backup_name); $node_primary->backup($backup_name);
# Create streaming standby linking to primary # Create streaming standby linking to primary
my $node_standby = get_new_node('standby'); my $node_standby = PostgresNode->new('standby');
$node_standby->init_from_backup( $node_standby->init_from_backup(
$node_primary, $backup_name, $node_primary, $backup_name,
allows_streaming => 1, allows_streaming => 1,
@ -60,7 +60,7 @@ $node_standby->backup($backup_name, backup_options => ['-Xnone']);
# Create cascading standby but don't start it yet. # Create cascading standby but don't start it yet.
# Must set up both streaming and archiving. # Must set up both streaming and archiving.
my $node_cascade = get_new_node('cascade'); my $node_cascade = PostgresNode->new('cascade');
$node_cascade->init_from_backup($node_standby, $backup_name, $node_cascade->init_from_backup($node_standby, $backup_name,
has_streaming => 1); has_streaming => 1);
$node_cascade->enable_restoring($node_primary); $node_cascade->enable_restoring($node_primary);

View File

@ -64,7 +64,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('primary'); my $node = PostgresNode->new('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

View File

@ -38,7 +38,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('primary'); my $node = PostgresNode->new('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

View File

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 32; use Test::More tests => 32;
# Initialize publisher node # Initialize publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -10,12 +10,12 @@ use TestLib;
use Test::More tests => 4; use Test::More tests => 4;
# Initialize publisher node # Initialize publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 6; use Test::More tests => 6;
# Initialize publisher node # Initialize publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 8; use Test::More tests => 8;
# Initialize publisher node # Initialize publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->append_conf('postgresql.conf', $node_subscriber->append_conf('postgresql.conf',
"wal_retrieve_retry_interval = 1ms"); "wal_retrieve_retry_interval = 1ms");

View File

@ -8,13 +8,13 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init( $node_publisher->init(
allows_streaming => 'logical', allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]); extra => [ '--locale=C', '--encoding=UTF8' ]);
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init( $node_subscriber->init(
allows_streaming => 'logical', allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=LATIN1' ]); extra => [ '--locale=C', '--encoding=LATIN1' ]);

View File

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 2; use Test::More tests => 2;
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -9,12 +9,12 @@ use TestLib;
use Test::More tests => 5; use Test::More tests => 5;
# Create publisher node # Create publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create subscriber node # Create subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -8,11 +8,11 @@ use PostgresNode;
use TestLib; use TestLib;
use Test::More tests => 1; use Test::More tests => 1;
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -10,11 +10,11 @@ use Test::More tests => 14;
# setup # setup
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->append_conf('postgresql.conf', $node_subscriber->append_conf('postgresql.conf',
qq(max_logical_replication_workers = 6)); qq(max_logical_replication_workers = 6));

View File

@ -10,11 +10,11 @@ use Test::More tests => 2;
# setup # setup
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

View File

@ -18,13 +18,13 @@ else
plan skip_all => 'ICU not supported by this build'; plan skip_all => 'ICU not supported by this build';
} }
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init( $node_publisher->init(
allows_streaming => 'logical', allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]); extra => [ '--locale=C', '--encoding=UTF8' ]);
$node_publisher->start; $node_publisher->start;
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init( $node_subscriber->init(
allows_streaming => 'logical', allows_streaming => 'logical',
extra => [ '--locale=C', '--encoding=UTF8' ]); extra => [ '--locale=C', '--encoding=UTF8' ]);

View File

@ -10,15 +10,15 @@ use Test::More tests => 62;
# setup # setup
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
my $node_subscriber1 = get_new_node('subscriber1'); my $node_subscriber1 = PostgresNode->new('subscriber1');
$node_subscriber1->init(allows_streaming => 'logical'); $node_subscriber1->init(allows_streaming => 'logical');
$node_subscriber1->start; $node_subscriber1->start;
my $node_subscriber2 = get_new_node('subscriber2'); my $node_subscriber2 = PostgresNode->new('subscriber2');
$node_subscriber2->init(allows_streaming => 'logical'); $node_subscriber2->init(allows_streaming => 'logical');
$node_subscriber2->start; $node_subscriber2->start;

View File

@ -10,12 +10,12 @@ use TestLib;
use Test::More tests => 5; use Test::More tests => 5;
# Create and initialize a publisher node # Create and initialize a publisher node
my $node_publisher = get_new_node('publisher'); my $node_publisher = PostgresNode->new('publisher');
$node_publisher->init(allows_streaming => 'logical'); $node_publisher->init(allows_streaming => 'logical');
$node_publisher->start; $node_publisher->start;
# Create and initialize subscriber node # Create and initialize subscriber node
my $node_subscriber = get_new_node('subscriber'); my $node_subscriber = PostgresNode->new('subscriber');
$node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->init(allows_streaming => 'logical');
$node_subscriber->start; $node_subscriber->start;

Some files were not shown because too many files have changed in this diff Show More