aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-12-19 17:00:21 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-12-19 17:03:56 +0200
commitf8c51fe6bbb095133e4218170ac70f7b86f928f5 (patch)
tree359e0dff75590e6cf247488216fa022e40a4bf1e /src
parent0e68570e8b4419b0484a0f96ee30ab34561c3a91 (diff)
downloadpostgresql-f8c51fe6bbb095133e4218170ac70f7b86f928f5.tar.gz
postgresql-f8c51fe6bbb095133e4218170ac70f7b86f928f5.zip
Fix timestamp in end-of-recovery WAL records.
We used time(null) to set a TimestampTz field, which gave bogus results. Noticed while looking at pg_xlogdump output. Backpatch to 9.3 and above, where the fast promotion was introduced.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index e1fa0f28c36..7e05bdf7c7c 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7270,7 +7270,7 @@ CreateEndOfRecoveryRecord(void)
if (!RecoveryInProgress())
elog(ERROR, "can only be used to end recovery");
- xlrec.end_time = time(NULL);
+ xlrec.end_time = GetCurrentTimestamp();
LWLockAcquire(WALInsertLock, LW_SHARED);
xlrec.ThisTimeLineID = ThisTimeLineID;
@@ -7295,7 +7295,7 @@ CreateEndOfRecoveryRecord(void)
* changes to this point.
*/
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
- ControlFile->time = (pg_time_t) xlrec.end_time;
+ ControlFile->time = (pg_time_t) time(NULL);
ControlFile->minRecoveryPoint = recptr;
ControlFile->minRecoveryPointTLI = ThisTimeLineID;
UpdateControlFile();