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

Commit89c2ab3

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 parent93e60b9 commit89c2ab3

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
@@ -3220,6 +3220,7 @@ pgstat_read_current_status(void)
32203220
LocalPgBackendStatus*localtable;
32213221
LocalPgBackendStatus*localentry;
32223222
char*localappname,
3223+
*localclienthostname,
32233224
*localactivity;
32243225
#ifdefUSE_SSL
32253226
PgBackendSSLStatus*localsslstatus;
@@ -3238,6 +3239,9 @@ pgstat_read_current_status(void)
32383239
localappname= (char*)
32393240
MemoryContextAlloc(pgStatLocalContext,
32403241
NAMEDATALEN*NumBackendStatSlots);
3242+
localclienthostname= (char*)
3243+
MemoryContextAlloc(pgStatLocalContext,
3244+
NAMEDATALEN*NumBackendStatSlots);
32413245
localactivity= (char*)
32423246
MemoryContextAlloc(pgStatLocalContext,
32433247
pgstat_track_activity_query_size*NumBackendStatSlots);
@@ -3278,6 +3282,8 @@ pgstat_read_current_status(void)
32783282
*/
32793283
strcpy(localappname, (char*)beentry->st_appname);
32803284
localentry->backendStatus.st_appname=localappname;
3285+
strcpy(localclienthostname, (char*)beentry->st_clienthostname);
3286+
localentry->backendStatus.st_clienthostname=localclienthostname;
32813287
strcpy(localactivity, (char*)beentry->st_activity);
32823288
localentry->backendStatus.st_activity=localactivity;
32833289
localentry->backendStatus.st_ssl=beentry->st_ssl;
@@ -3309,6 +3315,7 @@ pgstat_read_current_status(void)
33093315

33103316
localentry++;
33113317
localappname+=NAMEDATALEN;
3318+
localclienthostname+=NAMEDATALEN;
33123319
localactivity+=pgstat_track_activity_query_size;
33133320
#ifdefUSE_SSL
33143321
localsslstatus++;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp