diff --git a/src/bin/pg_rewind/RewindTest.pm b/src/bin/pg_rewind/RewindTest.pm index 426bd6e5cf..e1c989afa6 100644 --- a/src/bin/pg_rewind/RewindTest.pm +++ b/src/bin/pg_rewind/RewindTest.pm @@ -66,8 +66,8 @@ our @EXPORT = qw( clean_rewind_test ); -our $test_master_datadir = "$tmp_check/data_master"; -our $test_standby_datadir = "$tmp_check/data_standby"; +our $test_master_datadir = "$tmp_check/data_master_$$"; +our $test_standby_datadir = "$tmp_check/data_standby_$$"; # Define non-conflicting ports for both nodes. my $port_master = $ENV{PGPORT}; diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index 8eb27df796..641e864c1e 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -186,22 +186,25 @@ sub start_test_server my ($tempdir) = @_; my $ret; - print("### Starting test server in $tempdir\n"); + # Assign test-related variables. PID of the process running this + # script is assigned to the log file of the server to give uniqueness + # guarantee as this file's data is used for string comparison lookups. + $test_server_datadir = "$tempdir/pgdata"; + $test_server_logfile = "$log_path/postmaster_$$.log"; + + print("### Starting test server in $tempdir, with logs in $test_server_logfile\n"); standard_initdb "$tempdir/pgdata"; $ret = system_log('pg_ctl', '-D', "$tempdir/pgdata", '-w', '-l', - "$log_path/postmaster.log", '-o', "--log-statement=all", + $test_server_logfile, '-o', "--log-statement=all", 'start'); if ($ret != 0) { print "# pg_ctl failed; logfile:\n"; - system('cat', "$log_path/postmaster.log"); + system('cat', $test_server_logfile); BAIL_OUT("pg_ctl failed"); } - - $test_server_datadir = "$tempdir/pgdata"; - $test_server_logfile = "$log_path/postmaster.log"; } sub restart_test_server