pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Support "postgres -C" with runtime-computed GUCs
Date: Tue, 21 Sep 2021 13:42:34 +0900
Message-ID: <YUliupGihilpM2Xm@paquier.xyz> (raw)
In-Reply-To: <YUlVzPkVgEPjtmIB@paquier.xyz>
References: <E1mQglq-0007xB-Jw@gemulon.postgresql.org>
	<20210921032040.lyl4lcax37aedx2x@alap3.anarazel.de>
	<YUlVzPkVgEPjtmIB@paquier.xyz>

On Tue, Sep 21, 2021 at 12:47:24PM +0900, Michael Paquier wrote:
> This would print the parameter, while getting to stderr mostly a
> "could not start server".  Would that work for you?

And..  Here is an actual patch.  The first test works here on Win32,
but I don't have a CI environment with an unprivileged account.  The
second is funky, as pg_ctl would return 0 causing a failure with
command_fails_like() because of the way start_postmaster() differs in
pg_ctl.

it may be possible to work around that by switching to
command_checks_all() but that would make the whole uglier with
different error handling, and I guess different reports generated, so
I would just remove it.  Could you check if the first case would work
in your environment?  If not, I would not mind just removing the test.
I have discovered a separate bug thanks to it, but that's not worth
breaking your case either.
--
Michael
diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl
index 97492caab4..085c264a8e 100644
--- a/src/bin/pg_checksums/t/002_actions.pl
+++ b/src/bin/pg_checksums/t/002_actions.pl
@@ -11,7 +11,7 @@ use PostgresNode;
 use TestLib;
 
 use Fcntl qw(:seek);
-use Test::More tests => 69;
+use Test::More tests => 66;
 
 
 # Utility routine to create and check a table with corrupted checksums
@@ -181,17 +181,22 @@ command_fails(
 
 # Test postgres -C for an offline cluster.
 # Run-time GUCs are safe to query here.  Note that a lock file is created,
-# then unlinked, leading to an extra LOG entry showing in stderr.
+# then unlinked, leading to an extra LOG entry showing in stderr so use
+# log_min_messages=fatal to remove this noise.  This test uses a startup
+# wrapped with pg_ctl to allow the case of a CI running under an unprivileged
+# account on Windows.
 SKIP:
 {
 	skip "unstable output generated with Msys", 3
 	  if ($Config{osname} eq 'msys');
 	command_checks_all(
-		[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
-		0,
+		[
+			'pg_ctl', 'start', '-D', $pgdata, '-s', '-o',
+			'-C data_checksums -c log_min_messages=fatal'
+		],
+		1,
 		[qr/^on$/],
-		# LOG entry when unlinking lock file.
-		[qr/database system is shut down/],
+		[qr/could not start server/],
 		'data_checksums=on is reported on an offline cluster');
 }
 
@@ -200,15 +205,6 @@ $node->start;
 command_fails([ 'pg_checksums', '--check', '-D', $pgdata ],
 	"fails with online cluster");
 
-# Test postgres -C on an online cluster.
-command_fails_like(
-	[ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ],
-	qr/lock file .* already exists/,
-	'data_checksums is not reported on an online cluster');
-command_ok(
-	[ 'postgres', '-D', $pgdata, '-C', 'work_mem' ],
-	'non-runtime parameter is reported on an online cluster');
-
 # Check corruption of table on default tablespace.
 check_relation_corruption($node, 'corrupt1', 'pg_default');
 

Attachments:

checksum-tap-fix.patch (text/plain, 1.9K) download diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl index 97492caab4..085c264a8e 100644 --- a/src/bin/pg_checksums/t/002_actions.pl +++ b/src/bin/pg_checksums/t/002_actions.pl @@ -11,7 +11,7 @@ use PostgresNode; use TestLib; use Fcntl qw(:seek); -use Test::More tests => 69; +use Test::More tests => 66; # Utility routine to create and check a table with corrupted checksums @@ -181,17 +181,22 @@ command_fails( # Test postgres -C for an offline cluster. # Run-time GUCs are safe to query here. Note that a lock file is created, -# then unlinked, leading to an extra LOG entry showing in stderr. +# then unlinked, leading to an extra LOG entry showing in stderr so use +# log_min_messages=fatal to remove this noise. This test uses a startup +# wrapped with pg_ctl to allow the case of a CI running under an unprivileged +# account on Windows. SKIP: { skip "unstable output generated with Msys", 3 if ($Config{osname} eq 'msys'); command_checks_all( - [ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ], - 0, + [ + 'pg_ctl', 'start', '-D', $pgdata, '-s', '-o', + '-C data_checksums -c log_min_messages=fatal' + ], + 1, [qr/^on$/], - # LOG entry when unlinking lock file. - [qr/database system is shut down/], + [qr/could not start server/], 'data_checksums=on is reported on an offline cluster'); } @@ -200,15 +205,6 @@ $node->start; command_fails([ 'pg_checksums', '--check', '-D', $pgdata ], "fails with online cluster"); -# Test postgres -C on an online cluster. -command_fails_like( - [ 'postgres', '-D', $pgdata, '-C', 'data_checksums' ], - qr/lock file .* already exists/, - 'data_checksums is not reported on an online cluster'); -command_ok( - [ 'postgres', '-D', $pgdata, '-C', 'work_mem' ], - 'non-runtime parameter is reported on an online cluster'); - # Check corruption of table on default tablespace. check_relation_corruption($node, 'corrupt1', 'pg_default');
signature.asc (application/pgp-signature, 832B) download

view thread (21+ messages)  latest in thread

Message-ID: <YUliupGihilpM2Xm@paquier.xyz>
Permalink:  ../YUliupGihilpM2Xm@paquier.xyz/
Also on:    postgresql.org/message-id/YUliupGihilpM2Xm@paquier.xyz

 ·  · 

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-committers@postgresql.org
  Cc: michael@paquier.xyz, andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Support "postgres -C" with runtime-computed GUCs
  In-Reply-To: <YUliupGihilpM2Xm@paquier.xyz>

* 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