diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-12-19 17:00:21 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-12-19 17:04:20 +0200 |
commit | 5c805d0a813e6c611485bfc9bde9d2a10d1800e5 (patch) | |
tree | 1e74858d52a0dc605c7ad9fc7e73d0f72c8b9611 /src/backend/access/transam/xlog.c | |
parent | 37de8de9e33606a043e98fee64b5595aedaa8254 (diff) | |
download | postgresql-5c805d0a813e6c611485bfc9bde9d2a10d1800e5.tar.gz postgresql-5c805d0a813e6c611485bfc9bde9d2a10d1800e5.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/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 53044eb4f68..9e459761797 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -8076,7 +8076,7 @@ CreateEndOfRecoveryRecord(void) if (!RecoveryInProgress()) elog(ERROR, "can only be used to end recovery"); - xlrec.end_time = time(NULL); + xlrec.end_time = GetCurrentTimestamp(); WALInsertLockAcquireExclusive(); xlrec.ThisTimeLineID = ThisTimeLineID; @@ -8098,7 +8098,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(); |