From df8f4d295ebc205d46e77c5037c399afda17c546 Mon Sep 17 00:00:00 2001 From: Euler Taveira Date: Wed, 11 Nov 2020 11:24:25 -0300 Subject: [PATCH 1/2] Report latest completed checkpoint timestamp A new detail message prints the latest completed checkpoint when reaching the consistent state. This information is useful when you use recovery_target = immediate because it is not clear what timestamp it stops applying the WAL. It also adds new debug messages that report the checkpoint timestamp. It might be useful for debug purposes. --- src/backend/access/transam/xlog.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index aa63f37615..2ff83c49e2 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6524,6 +6524,8 @@ StartupXLOG(void) ereport(DEBUG1, (errmsg("checkpoint record is at %X/%X", (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); + ereport(DEBUG1, + (errmsg("checkpoint time is %s", str_time(checkPoint.time)))); InRecovery = true; /* force recovery even if SHUTDOWNED */ /* @@ -6657,6 +6659,8 @@ StartupXLOG(void) ereport(DEBUG1, (errmsg("checkpoint record is at %X/%X", (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); + ereport(DEBUG1, + (errmsg("checkpoint time is %s", str_time(ControlFile->checkPointCopy.time)))); } else { @@ -8033,7 +8037,9 @@ CheckRecoveryConsistency(void) ereport(LOG, (errmsg("consistent recovery state reached at %X/%X", (uint32) (lastReplayedEndRecPtr >> 32), - (uint32) lastReplayedEndRecPtr))); + (uint32) lastReplayedEndRecPtr), + errdetail("Last completed checkpoint was at log time %s.", + str_time(ControlFile->checkPointCopy.time)))); } /* -- 2.20.1