Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 306b991

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 4c85364 commit 306b991

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -8408,7 +8408,7 @@ CreateEndOfRecoveryRecord(void)
84088408
if (!RecoveryInProgress())
84098409
elog(ERROR, "can only be used to end recovery");
84108410

8411-
xlrec.end_time = time(NULL);
8411+
xlrec.end_time = GetCurrentTimestamp();
84128412

84138413
WALInsertLockAcquireExclusive();
84148414
xlrec.ThisTimeLineID = ThisTimeLineID;
@@ -8433,7 +8433,7 @@ CreateEndOfRecoveryRecord(void)
84338433
* changes to this point.
84348434
*/
84358435
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
8436-
ControlFile->time = (pg_time_t) xlrec.end_time;
8436+
ControlFile->time = (pg_time_t) time(NULL);
84378437
ControlFile->minRecoveryPoint = recptr;
84388438
ControlFile->minRecoveryPointTLI = ThisTimeLineID;
84398439
UpdateControlFile();

0 commit comments

Comments
 (0)