On Sat, Jun 04, 2022 at 12:35:45PM +0900, Michael Paquier wrote:
> Something like 80~85% of the bloat comes from the diffs in your case.
> Well, it is always possible to limit that to an arbitrary amount of
> characters (say 50k~100k?) to still give some context, and dump the
> whole in a different file outside the log/ path (aka tmp_check/), so
> that the buildfarm would show a minimum amount of information, while
> local failures would still have an access to everything.

After looking a bit around that.  Something like the attached, where
the characters are limited at 10k, would limit the output generated..
--
Michael
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 55c7354ba2..4581ddc915 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -223,6 +223,9 @@ command_ok(
 	'run of pg_upgrade for new instance');
 $newnode->start;
 
+# Limit all contents to 10k characters.
+my $report_max_chars = 10000;
+
 # Check if there are any logs coming from pg_upgrade, that would only be
 # retained on failure.
 my $log_path = $newnode->data_dir . "/pg_upgrade_output.d/log";
@@ -231,7 +234,8 @@ if (-d $log_path)
 	foreach my $log (glob("$log_path/*"))
 	{
 		note "=== contents of $log ===\n";
-		print slurp_file($log);
+		my $contents = slurp_file($log);
+		print substr($contents, 0, $report_max_chars);
 		print "=== EOF ===\n";
 	}
 }
@@ -256,9 +260,9 @@ if ($compare_res != 0)
 	  run_command([ 'diff', "$tempdir/dump1.sql", "$tempdir/dump2.sql" ]);
 	print "=== diff of $tempdir/dump1.sql and $tempdir/dump2.sql\n";
 	print "=== stdout ===\n";
-	print $stdout;
+	print substr($stdout, 0, $report_max_chars);
 	print "=== stderr ===\n";
-	print $stderr;
+	print substr($stderr, 0, $report_max_chars);
 	print "=== EOF ===\n";
 }
 

Attachment: signature.asc
Description: PGP signature

Reply via email to