From 3c306b20a9bee7ea750f4d9cacae9532ebd67427 Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Thu, 30 Apr 2026 16:06:06 -0400
Subject: [PATCH v1_PGMASTER 3/7] Turn off debug for pg_combinebackup TAP tests

Having --debug as the default option to pg_combinebackup in
init_from_backup() makes the logs extremely verbose. It seems better to
let developers set an environment variable or pass it as a keyword
argument to init_from_backup() to turn on debugging as they wish.
---
 src/test/perl/PostgreSQL/Test/Cluster.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index bdc051e6ead..ebc776f7590 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -925,7 +925,11 @@ pathnames that should be used for the target cluster.
 
 To restore from an incremental backup, pass the parameter combine_with_prior
 as a reference to an array of prior backup names with which this backup
-is to be combined using pg_combinebackup.
+is to be combined using pg_combinebackup.  By default, pg_combinebackup is
+run without --debug.  To enable --debug output when diagnosing test
+failures, either pass combine_debug => 1 as a keyword parameter, or set
+the environment variable PG_TEST_PG_COMBINEBACKUP_DEBUG to a true value
+to enable it globally for all callers.
 
 Streaming replication can be enabled on this node by passing the keyword
 parameter has_streaming => 1. This is disabled by default.
@@ -976,7 +980,9 @@ sub init_from_backup
 		}
 
 		local %ENV = $self->_get_env();
-		my @combineargs = ('pg_combinebackup', '--debug');
+		my @combineargs = ('pg_combinebackup');
+		push @combineargs, '--debug'
+		  if $params{combine_debug} // $ENV{PG_TEST_PG_COMBINEBACKUP_DEBUG};
 		if (exists $params{tablespace_map})
 		{
 			while (my ($olddir, $newdir) = each %{ $params{tablespace_map} })
-- 
2.43.0

