Hi all, When recovery_target_time is set, but recovery finishes before it reaches that time, it outputs "before 2000-01-01 00:00:00+00" to the .history file. This is because it uses recoveryStopTime, which is initialised to 0, but is never set, and is then passed to timestamptz_to_str, which gives it this date output.
A similar problem exists for recovery_target_xid. When recovery finishes before reaching the specified xid, it outputs "before transaction 0" to the .history file, which is also confusing. Could we produce something more meaningful? I've attached a patch which changes it to say 'recovery reached consistency before recovery target time of "<recovery_target_time>"' and 'recovery reached consistency before recovery target xid of "<recovery_target_xid>"'. It may be the wrong way of going about it, but you get the idea of what I'm suggesting we output instead. Thom
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index e4645a3..c68697a 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7105,15 +7105,25 @@ StartupXLOG(void) * timeline changed. */ if (recoveryTarget == RECOVERY_TARGET_XID) - snprintf(reason, sizeof(reason), - "%s transaction %u", - recoveryStopAfter ? "after" : "before", - recoveryStopXid); + if (recoveryStopXid == 0) + snprintf(reason, sizeof(reason), + "recovery reached consistency before 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 reached consistency before 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\"",
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers