pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Augment every test postgresql.conf
Date: Sat, 6 Apr 2019 23:41:56 -0700
Message-ID: <20190407064156.GC1914190@rfd.leadboat.com> (raw)
In-Reply-To: <f8938ff6-4dc8-2beb-636b-1d524db78e2f@2ndQuadrant.com>
References: <20181229021950.GA3302966@rfd.leadboat.com>
	<20181230024014.GA181668@gust.leadboat.com>
	<16623.1546141591@sss.pgh.pa.us>
	<20181230055346.GB156585@gust.leadboat.com>
	<f8938ff6-4dc8-2beb-636b-1d524db78e2f@2ndQuadrant.com>

On Sun, Dec 30, 2018 at 10:32:31AM -0500, Andrew Dunstan wrote:
> On 12/30/18 12:53 AM, Noah Misch wrote:
> > 2. stats_temp_directory is incompatible with TAP suites that start more than
> >    one node simultaneously.

> The obvious quick fix would be to have PostgresNode.pm set this to the
> default after inserting the TEMP_CONFIG file.

I'd like to get $SUBJECT in place for variables other than
stats_temp_directory, using your quick fix idea.  Attached.  When its time
comes, your stats_temp_directory work can delete that section.
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 50a57d0..a1143e3 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -24,6 +24,8 @@ command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
+print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
+  if defined $ENV{TEMP_CONFIG};
 if (!$windows_os)
 {
 	print $conf "listen_addresses = ''\n";
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 81deed9..f576336 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -447,7 +447,17 @@ sub init
 	print $conf "log_statement = all\n";
 	print $conf "log_replication_commands = on\n";
 	print $conf "wal_retrieve_retry_interval = '500ms'\n";
-	print $conf "port = $port\n";
+
+	# If a setting tends to affect whether tests pass or fail, print it after
+	# TEMP_CONFIG.  Otherwise, print it before TEMP_CONFIG, thereby permitting
+	# overrides.  Settings that merely improve performance or ease debugging
+	# belong before TEMP_CONFIG.
+	print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
+	  if defined $ENV{TEMP_CONFIG};
+
+	# XXX Neutralize any stats_temp_directory in TEMP_CONFIG.  Nodes running
+	# concurrently must not share a stats_temp_directory.
+	print $conf "stats_temp_directory = 'pg_stat_tmp'\n";
 
 	if ($params{allows_streaming})
 	{
@@ -473,6 +483,7 @@ sub init
 		print $conf "max_wal_senders = 0\n";
 	}
 
+	print $conf "port = $port\n";
 	if ($TestLib::windows_os)
 	{
 		print $conf "listen_addresses = '$host'\n";

Attachments:

  [text/plain] TEMP_CONFIG-tap-v2.patch (1.7K, ../20190407064156.GC1914190@rfd.leadboat.com/2-TEMP_CONFIG-tap-v2.patch)
  download | inline diff:
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl
index 50a57d0..a1143e3 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -24,6 +24,8 @@ command_ok([ $ENV{PG_REGRESS}, '--config-auth', "$tempdir/data" ],
 	'configure authentication');
 open my $conf, '>>', "$tempdir/data/postgresql.conf";
 print $conf "fsync = off\n";
+print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
+  if defined $ENV{TEMP_CONFIG};
 if (!$windows_os)
 {
 	print $conf "listen_addresses = ''\n";
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 81deed9..f576336 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -447,7 +447,17 @@ sub init
 	print $conf "log_statement = all\n";
 	print $conf "log_replication_commands = on\n";
 	print $conf "wal_retrieve_retry_interval = '500ms'\n";
-	print $conf "port = $port\n";
+
+	# If a setting tends to affect whether tests pass or fail, print it after
+	# TEMP_CONFIG.  Otherwise, print it before TEMP_CONFIG, thereby permitting
+	# overrides.  Settings that merely improve performance or ease debugging
+	# belong before TEMP_CONFIG.
+	print $conf TestLib::slurp_file($ENV{TEMP_CONFIG})
+	  if defined $ENV{TEMP_CONFIG};
+
+	# XXX Neutralize any stats_temp_directory in TEMP_CONFIG.  Nodes running
+	# concurrently must not share a stats_temp_directory.
+	print $conf "stats_temp_directory = 'pg_stat_tmp'\n";
 
 	if ($params{allows_streaming})
 	{
@@ -473,6 +483,7 @@ sub init
 		print $conf "max_wal_senders = 0\n";
 	}
 
+	print $conf "port = $port\n";
 	if ($TestLib::windows_os)
 	{
 		print $conf "listen_addresses = '$host'\n";

view thread (10+ messages)  latest in thread

Message-ID: <20190407064156.GC1914190@rfd.leadboat.com>
Permalink:  ../20190407064156.GC1914190@rfd.leadboat.com/
Also on:    postgresql.org/message-id/20190407064156.GC1914190@rfd.leadboat.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: noah@leadboat.com, andrew.dunstan@2ndquadrant.com, tgl@sss.pgh.pa.us
  Subject: Re: Augment every test postgresql.conf
  In-Reply-To: <20190407064156.GC1914190@rfd.leadboat.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox