From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Torsten Förtsch <tfoertsch123@gmail.com>
To: pgsql-hackers@postgresql.org
Subject: Re: minor bug
Date: Tue, 17 Jan 2023 10:42:03 +0100
Message-ID: <b41b61c8ba52efa23d1079cc53c689713f5b1e0c.camel@cybertec.at> (raw)
In-Reply-To: <CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com>
References: <CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com>
On Mon, 2023-01-16 at 19:59 +0100, Torsten Förtsch wrote:
> not sure if this is known behavior.
>
> Server version is 14.6 (Debian 14.6-1.pgdg110+1).
>
> In a PITR setup I have these settings:
>
> recovery_target_xid = '852381'
> recovery_target_inclusive = 'false'
>
> In the log file I see this message:
>
> LOG: recovery stopping before commit of transaction 852381, time 2000-01-01 00:00:00+00
>
> But:
>
> postgres=# select * from pg_last_committed_xact();
> xid | timestamp | roident
> --------+-------------------------------+---------
> 852380 | 2023-01-16 18:00:35.054495+00 | 0
>
> So, the timestamp displayed in the log message is certainly wrong.
Redirected to -hackers.
If recovery stops at a WAL record that has no timestamp, you get this
bogus recovery stop time. I think we should show the recovery stop time
only if time was the target, as in the attached patch.
Yours,
Laurenz Albe
Attachments:0001-Don-t-show-bogus-recovery-stop-time.patch (text/x-patch, 1.9K) download
From 622e52bbd652fc8872448e46c3ca0bc78dd847fe Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Tue, 17 Jan 2023 10:38:40 +0100
Subject: [PATCH] Don't show bogus recovery stop time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If target for archive recovery was different from time, the
WAL record that ended recovery might not have a timestamp.
In that case, the log message at the end of recovery would
show a recovery time of midnight on 2000-01-01.
Reported-by: Torsten Förtsch
Author: Laurenz Albe
Discussion: https://postgr.es/m/CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com
---
src/backend/access/transam/xlogrecovery.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.cindex bc3c3eb3e7..ce3718ca2d 100644--- a/src/backend/access/transam/xlogrecovery.c+++ b/src/backend/access/transam/xlogrecovery.c@@ -2570,19 +2570,21 @@ recoveryStopsBefore(XLogReaderState *record)
recoveryStopLSN = InvalidXLogRecPtr;
recoveryStopName[0] = '\0';
- if (isCommit)+ /* for targets other than time, we might have no stop time */+ if (recoveryTarget == RECOVERY_TARGET_XID)
{
ereport(LOG,
- (errmsg("recovery stopping before commit of transaction %u, time %s",+ (errmsg("recovery stopping before %s of transaction %u, time %s",+ (isCommit ? "commit" : "abort"),
recoveryStopXid,
timestamptz_to_str(recoveryStopTime))));
}
else
{
ereport(LOG,
- (errmsg("recovery stopping before abort of transaction %u, time %s",- recoveryStopXid,- timestamptz_to_str(recoveryStopTime))));+ (errmsg("recovery stopping before %s of transaction %u",+ (isCommit ? "commit" : "abort"),+ recoveryStopXid)));
}
}
--
2.39.0
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: laurenz.albe@cybertec.at, tfoertsch123@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: minor bug
In-Reply-To: <b41b61c8ba52efa23d1079cc53c689713f5b1e0c.camel@cybertec.at>
References: <CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com> <b41b61c8ba52efa23d1079cc53c689713f5b1e0c.camel@cybertec.at>
* 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