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

Commita820b4c

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 parent72cf7f3 commita820b4c

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
@@ -3224,6 +3224,7 @@ pgstat_read_current_status(void)
32243224
LocalPgBackendStatus*localtable;
32253225
LocalPgBackendStatus*localentry;
32263226
char*localappname,
3227+
*localclienthostname,
32273228
*localactivity;
32283229
#ifdefUSE_SSL
32293230
PgBackendSSLStatus*localsslstatus;
@@ -3242,6 +3243,9 @@ pgstat_read_current_status(void)
32423243
localappname= (char*)
32433244
MemoryContextAlloc(pgStatLocalContext,
32443245
NAMEDATALEN*NumBackendStatSlots);
3246+
localclienthostname= (char*)
3247+
MemoryContextAlloc(pgStatLocalContext,
3248+
NAMEDATALEN*NumBackendStatSlots);
32453249
localactivity= (char*)
32463250
MemoryContextAlloc(pgStatLocalContext,
32473251
pgstat_track_activity_query_size*NumBackendStatSlots);
@@ -3282,6 +3286,8 @@ pgstat_read_current_status(void)
32823286
*/
32833287
strcpy(localappname, (char*)beentry->st_appname);
32843288
localentry->backendStatus.st_appname=localappname;
3289+
strcpy(localclienthostname, (char*)beentry->st_clienthostname);
3290+
localentry->backendStatus.st_clienthostname=localclienthostname;
32853291
strcpy(localactivity, (char*)beentry->st_activity_raw);
32863292
localentry->backendStatus.st_activity_raw=localactivity;
32873293
localentry->backendStatus.st_ssl=beentry->st_ssl;
@@ -3313,6 +3319,7 @@ pgstat_read_current_status(void)
33133319

33143320
localentry++;
33153321
localappname+=NAMEDATALEN;
3322+
localclienthostname+=NAMEDATALEN;
33163323
localactivity+=pgstat_track_activity_query_size;
33173324
#ifdefUSE_SSL
33183325
localsslstatus++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp