Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit8120c74

Browse files
committed
Fix bogus time printout in walreceiver's debug log messages.
The displayed sendtime and receipttime were always exactly equal, becausesomebody forgot that timestamptz_to_str returns a static buffer (therebysimplifying life for most callers, at the cost of complicating it for thosewho need two results concurrently). Apply the same pstrdup solution usedby the other call sites with this issue. Back-patch to 9.2 where thefaulty code was introduced. Per bug #9849 from Haruka Takatsuka, thoughthis is not exactly his patch.Possibly we should change timestamptz_to_str's API, but I wouldn't wantto do so in the back branches.
1 parent59202fa commit8120c74

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎src/backend/replication/walreceiver.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,9 +1199,19 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
11991199
SpinLockRelease(&walrcv->mutex);
12001200

12011201
if (log_min_messages <=DEBUG2)
1202+
{
1203+
char*sendtime;
1204+
char*receipttime;
1205+
1206+
/* Copy because timestamptz_to_str returns a static buffer */
1207+
sendtime=pstrdup(timestamptz_to_str(sendTime));
1208+
receipttime=pstrdup(timestamptz_to_str(lastMsgReceiptTime));
12021209
elog(DEBUG2,"sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
1203-
timestamptz_to_str(sendTime),
1204-
timestamptz_to_str(lastMsgReceiptTime),
1210+
sendtime,
1211+
receipttime,
12051212
GetReplicationApplyDelay(),
12061213
GetReplicationTransferLatency());
1214+
pfree(sendtime);
1215+
pfree(receipttime);
1216+
}
12071217
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp