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

Commited1cb42

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 parent7d1e0e8 commited1cb42

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
@@ -767,9 +767,19 @@ ProcessWalSndrMessage(XLogRecPtr walEnd, TimestampTz sendTime)
767767
SpinLockRelease(&walrcv->mutex);
768768

769769
if (log_min_messages <=DEBUG2)
770+
{
771+
char*sendtime;
772+
char*receipttime;
773+
774+
/* Copy because timestamptz_to_str returns a static buffer */
775+
sendtime=pstrdup(timestamptz_to_str(sendTime));
776+
receipttime=pstrdup(timestamptz_to_str(lastMsgReceiptTime));
770777
elog(DEBUG2,"sendtime %s receipttime %s replication apply delay %d ms transfer latency %d ms",
771-
timestamptz_to_str(sendTime),
772-
timestamptz_to_str(lastMsgReceiptTime),
778+
sendtime,
779+
receipttime,
773780
GetReplicationApplyDelay(),
774781
GetReplicationTransferLatency());
782+
pfree(sendtime);
783+
pfree(receipttime);
784+
}
775785
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp