Re: multithreaded zstd backup compression for client and server - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: multithreaded zstd backup compression for client and server
Date
Msg-id 875ynvr6pa.fsf@wibble.ilmari.org
Whole thread Raw
In response to multithreaded zstd backup compression for client and server  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: multithreaded zstd backup compression for client and server
Re: multithreaded zstd backup compression for client and server
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:

> This patch contains a trivial adjustment to
> PostgreSQL::Test::Cluster::run_log to make it return a useful value
> instead of not. I think that should be pulled out and committed
> independently regardless of what happens to this patch overall, and
> possibly back-patched.

run_log() is far from the only such method in PostgreSQL::Test::Cluster.
Here's a patch that gives the same treatment to all the methods that
just pass through to the corresponding PostgreSQL::Test::Utils function.

Also attached is a fix a typo in the _get_env doc comment that I noticed
while auditing the return values.

- ilmari

From 2e6ccdb2148128357e26816776a448a0ef95a1c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Wed, 30 Mar 2022 02:56:51 +0100
Subject: [PATCH] Make more PostgreSQL:Test::Cluster methods return a useful
 value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit ad4f2c47de440cdd5d58cf9ffea09afa0da04d6c made run_log() return
the value of the corresponding PostgreSQL::Test::Utils function, but
missed out a lot of other ones.  This makes all the methods that call
a corresponding function in ::Utils pass on the underlying function's
return value so they too can be used in the idiomatic fashion of

    $node->some_test(…) or diag(…);
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index b6e3351611..c56a7e6c3b 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2376,8 +2376,7 @@ sub command_ok
 
     local %ENV = $self->_get_env();
 
-    PostgreSQL::Test::Utils::command_ok(@_);
-    return;
+    return PostgreSQL::Test::Utils::command_ok(@_);
 }
 
 =pod
@@ -2396,8 +2395,7 @@ sub command_fails
 
     local %ENV = $self->_get_env();
 
-    PostgreSQL::Test::Utils::command_fails(@_);
-    return;
+    return PostgreSQL::Test::Utils::command_fails(@_);
 }
 
 =pod
@@ -2416,8 +2414,7 @@ sub command_like
 
     local %ENV = $self->_get_env();
 
-    PostgreSQL::Test::Utils::command_like(@_);
-    return;
+    return PostgreSQL::Test::Utils::command_like(@_);
 }
 
 =pod
@@ -2436,8 +2433,7 @@ sub command_fails_like
 
     local %ENV = $self->_get_env();
 
-    PostgreSQL::Test::Utils::command_fails_like(@_);
-    return;
+    return PostgreSQL::Test::Utils::command_fails_like(@_);
 }
 
 =pod
@@ -2457,8 +2453,7 @@ sub command_checks_all
 
     local %ENV = $self->_get_env();
 
-    PostgreSQL::Test::Utils::command_checks_all(@_);
-    return;
+    return PostgreSQL::Test::Utils::command_checks_all(@_);
 }
 
 =pod
@@ -2483,8 +2478,7 @@ sub issues_sql_like
     my $result = PostgreSQL::Test::Utils::run_log($cmd);
     ok($result, "@$cmd exit code 0");
     my $log = PostgreSQL::Test::Utils::slurp_file($self->logfile, $log_location);
-    like($log, $expected_sql, "$test_name: SQL found in server log");
-    return;
+    return like($log, $expected_sql, "$test_name: SQL found in server log");
 }
 
 =pod
-- 
2.30.2

From 24423ca6a9cc69adb6d0a08554d94dac25db6d27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Wed, 30 Mar 2022 12:58:25 +0100
Subject: [PATCH 2/2] Fix typo in PostgreSQL::Test::Cluster::_get_env docs

It had the wrong opening brackend on the method call.
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index c56a7e6c3b..b98bff278a 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -1368,7 +1368,7 @@ sub _set_pg_version
 #
 # Routines that call Postgres binaries need to call this routine like this:
 #
-#    local %ENV = $self->_get_env{[%extra_settings]);
+#    local %ENV = $self->_get_env([%extra_settings]);
 #
 # A copy of the environment is taken and node's host and port settings are
 # added as PGHOST and PGPORT, then the extra settings (if any) are applied.
-- 
2.30.2


pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Next
From: Tomas Vondra
Date:
Subject: Re: Column Filtering in Logical Replication