Skip to content

Commit f8c51fe

Browse files
committed
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.
1 parent 0e68570 commit f8c51fe

File tree

1 file changed

+2
-2
lines changed
  • src/backend/access/transam

1 file changed

+2
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7270,7 +7270,7 @@ CreateEndOfRecoveryRecord(void)
72707270
if (!RecoveryInProgress())
72717271
elog(ERROR, "can only be used to end recovery");
72727272

7273-
xlrec.end_time = time(NULL);
7273+
xlrec.end_time = GetCurrentTimestamp();
72747274

72757275
LWLockAcquire(WALInsertLock, LW_SHARED);
72767276
xlrec.ThisTimeLineID = ThisTimeLineID;
@@ -7295,7 +7295,7 @@ CreateEndOfRecoveryRecord(void)
72957295
* changes to this point.
72967296
*/
72977297
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
7298-
ControlFile->time = (pg_time_t) xlrec.end_time;
7298+
ControlFile->time = (pg_time_t) time(NULL);
72997299
ControlFile->minRecoveryPoint = recptr;
73007300
ControlFile->minRecoveryPointTLI = ThisTimeLineID;
73017301
UpdateControlFile();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy