Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5c805d0

Browse filesBrowse 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 37de8de commit 5c805d0
Copy full SHA for 5c805d0

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
  • src/backend/access/transam
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎src/backend/access/transam/xlog.c

Copy file name to clipboardExpand all lines: src/backend/access/transam/xlog.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8076,7 +8076,7 @@ CreateEndOfRecoveryRecord(void)
80768076
if (!RecoveryInProgress())
80778077
elog(ERROR, "can only be used to end recovery");
80788078

8079-
xlrec.end_time = time(NULL);
8079+
xlrec.end_time = GetCurrentTimestamp();
80808080

80818081
WALInsertLockAcquireExclusive();
80828082
xlrec.ThisTimeLineID = ThisTimeLineID;
@@ -8098,7 +8098,7 @@ CreateEndOfRecoveryRecord(void)
80988098
* changes to this point.
80998099
*/
81008100
LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
8101-
ControlFile->time = (pg_time_t) xlrec.end_time;
8101+
ControlFile->time = (pg_time_t) time(NULL);
81028102
ControlFile->minRecoveryPoint = recptr;
81038103
ControlFile->minRecoveryPointTLI = ThisTimeLineID;
81048104
UpdateControlFile();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.