On 12 June 2016 at 12:51, Michael Paquier <michael.paqu...@gmail.com> wrote:
> On Sun, Jun 12, 2016 at 7:52 PM, Thom Brown <t...@linux.com> wrote: > > Aren't those already set by recoveryStopsBefore()? > > It is possible to exit the main redo loop if a NULL record is found > after calling ReadRecord, in which case those would not be set, no? > I'm apprehensive about initialising those values myself as I don't want to set them at a point where they may potentially already be set. And I've noticed that I didn't re-read my own output messages, so I've corrected them in the attached patch. Thom
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e4645a3..d724d4b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7105,19 +7105,34 @@ StartupXLOG(void) * timeline changed. */ if (recoveryTarget == RECOVERY_TARGET_XID) - snprintf(reason, sizeof(reason), - "%s transaction %u", - recoveryStopAfter ? "after" : "before", - recoveryStopXid); + if (recoveryStopXid == InvalidTransactionId) + snprintf(reason, sizeof(reason), + "recovery finished without reaching recovery target xid of \"%u\"\n", + recoveryTargetXid); + else + snprintf(reason, sizeof(reason), + "%s transaction %u", + recoveryStopAfter ? "after" : "before", + recoveryStopXid); else if (recoveryTarget == RECOVERY_TARGET_TIME) - snprintf(reason, sizeof(reason), - "%s %s\n", - recoveryStopAfter ? "after" : "before", - timestamptz_to_str(recoveryStopTime)); + if (recoveryStopTime == 0) + snprintf(reason, sizeof(reason), + "recovery finished without reaching recovery target time of \"%s\"\n", + timestamptz_to_str(recoveryTargetTime)); + else + snprintf(reason, sizeof(reason), + "%s %s\n", + recoveryStopAfter ? "after" : "before", + timestamptz_to_str(recoveryStopTime)); else if (recoveryTarget == RECOVERY_TARGET_NAME) - snprintf(reason, sizeof(reason), - "at restore point \"%s\"", - recoveryStopName); + if (*recoveryStopName == '\0') + snprintf(reason, sizeof(reason), + "recovery finished without reaching recovery target name of \"%s\"\n", + recoveryTargetName); + else + snprintf(reason, sizeof(reason), + "at restore point \"%s\"", + recoveryStopName); else if (recoveryTarget == RECOVERY_TARGET_IMMEDIATE) snprintf(reason, sizeof(reason), "reached consistency"); else
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers