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

Commit74dc05e

Browse files
committed
Make local copy of client hostnames in backend status array.
The other strings, application_name and query string, were snapshotted tolocal memory in pgstat_read_current_status(), but we forgot to do that forclient hostnames. As a result, the client hostname would appear to change inthe local copy, if the client disconnected.Backpatch to all supported versions.Author: Edmund HornerReviewed-by: Michael PaquierDiscussion:https://www.postgresql.org/message-id/CAMyN-kA7aOJzBmrYFdXcc7Z0NmW%2B5jBaf_m%3D_-77uRNyKC9r%3DA%40mail.gmail.com
1 parent494f3cb commit74dc05e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎src/backend/postmaster/pgstat.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3058,6 +3058,7 @@ pgstat_read_current_status(void)
30583058
LocalPgBackendStatus*localtable;
30593059
LocalPgBackendStatus*localentry;
30603060
char*localappname,
3061+
*localclienthostname,
30613062
*localactivity;
30623063
#ifdefUSE_SSL
30633064
PgBackendSSLStatus*localsslstatus;
@@ -3076,6 +3077,9 @@ pgstat_read_current_status(void)
30763077
localappname= (char*)
30773078
MemoryContextAlloc(pgStatLocalContext,
30783079
NAMEDATALEN*MaxBackends);
3080+
localclienthostname= (char*)
3081+
MemoryContextAlloc(pgStatLocalContext,
3082+
NAMEDATALEN*MaxBackends);
30793083
localactivity= (char*)
30803084
MemoryContextAlloc(pgStatLocalContext,
30813085
pgstat_track_activity_query_size*MaxBackends);
@@ -3116,6 +3120,8 @@ pgstat_read_current_status(void)
31163120
*/
31173121
strcpy(localappname, (char*)beentry->st_appname);
31183122
localentry->backendStatus.st_appname=localappname;
3123+
strcpy(localclienthostname, (char*)beentry->st_clienthostname);
3124+
localentry->backendStatus.st_clienthostname=localclienthostname;
31193125
strcpy(localactivity, (char*)beentry->st_activity);
31203126
localentry->backendStatus.st_activity=localactivity;
31213127
localentry->backendStatus.st_ssl=beentry->st_ssl;
@@ -3147,6 +3153,7 @@ pgstat_read_current_status(void)
31473153

31483154
localentry++;
31493155
localappname+=NAMEDATALEN;
3156+
localclienthostname+=NAMEDATALEN;
31503157
localactivity+=pgstat_track_activity_query_size;
31513158
#ifdefUSE_SSL
31523159
localsslstatus++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp