0001-Don-t-show-bogus-recovery-stop-time.V2.patch
text/x-patch
Filename: 0001-Don-t-show-bogus-recovery-stop-time.V2.patch
Type: text/x-patch
Part: 0
Message:
Re: minor bug
Patch
Format: format-patch
Series: patch 0001
Subject: Don't show bogus recovery stop time
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlogrecovery.c | 27 | 8 |
From b01428486f7795f757edd14f66362ee575d2f168 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@cybertec.at>
Date: Wed, 18 Jan 2023 09:23:50 +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 | 35 +++++++++++++++++------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index bc3c3eb3e7..73929a535e 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -2570,19 +2570,38 @@ recoveryStopsBefore(XLogReaderState *record)
recoveryStopLSN = InvalidXLogRecPtr;
recoveryStopName[0] = '\0';
+ /* this could be simplified, but that might break translatability */
if (isCommit)
{
- ereport(LOG,
- (errmsg("recovery stopping before commit of transaction %u, time %s",
- recoveryStopXid,
- timestamptz_to_str(recoveryStopTime))));
+ if (recoveryStopTime != 0)
+ {
+ ereport(LOG,
+ (errmsg("recovery stopping before commit of transaction %u, time %s",
+ recoveryStopXid,
+ timestamptz_to_str(recoveryStopTime))));
+ }
+ else
+ {
+ ereport(LOG,
+ (errmsg("recovery stopping before commit of transaction %u",
+ recoveryStopXid)));
+ }
}
else
{
- ereport(LOG,
- (errmsg("recovery stopping before abort of transaction %u, time %s",
- recoveryStopXid,
- timestamptz_to_str(recoveryStopTime))));
+ if (recoveryStopTime != 0)
+ {
+ ereport(LOG,
+ (errmsg("recovery stopping before abort of transaction %u, time %s",
+ recoveryStopXid,
+ timestamptz_to_str(recoveryStopTime))));
+ }
+ else
+ {
+ ereport(LOG,
+ (errmsg("recovery stopping before abort of transaction %u",
+ recoveryStopXid)));
+ }
}
}
--
2.39.0