Re: Cluster::restart dumping logs when stop fails

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cluster::restart dumping logs when stop fails
Date: 2024-04-07 09:39:39
Message-ID: 0AFC73FA-AFAE-4F21-A3CC-7FA9277E7D02@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 7 Apr 2024, at 02:49, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2024-04-07 00:19:35 +0200, Daniel Gustafsson wrote:
>>> On 6 Apr 2024, at 23:44, Andres Freund <andres(at)anarazel(dot)de> wrote:

>> The non-context aware fix would be to just print the last 1024 (or something)
>> bytes from the logfile:
>
> That'd be better, yes. I'd mainly log the path to the logfile though, that's
> probably at least as helpful for actually investigating the issue?

IIRC this was modelled around how it used to be earlier, in v14 in the
pre-refactored version we print the full logfile.

How about doing the below backpatched down to 15?

diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 54e1008ae5..a2f9409842 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -951,8 +951,7 @@ sub start

if ($ret != 0)
{
- print "# pg_ctl start failed; logfile:\n";
- print PostgreSQL::Test::Utils::slurp_file($self->logfile);
+ print "# pg_ctl start failed; see logfile for details: " . $self->logfile . "\n";

# pg_ctl could have timed out, so check to see if there's a pid file;
# otherwise our END block will fail to shut down the new postmaster.
@@ -1090,8 +1089,7 @@ sub restart

if ($ret != 0)
{
- print "# pg_ctl restart failed; logfile:\n";
- print PostgreSQL::Test::Utils::slurp_file($self->logfile);
+ print "# pg_ctl restart failed; see logfile for details: " . $self->logfile . "\n";

# pg_ctl could have timed out, so check to see if there's a pid file;
# otherwise our END block will fail to shut down the new postmaster.

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2024-04-07 09:44:56 Re: [PoC] Improve dead tuple storage for lazy vacuum
Previous Message David Rowley 2024-04-07 09:33:52 Re: Flushing large data immediately in pqcomm