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

Commitd02974e

Browse files
committed
Properly set base backup backends to active in pg_stat_activity
When walsenders were included in pg_stat_activity, only the onesactually streaming WAL were listed as active when they were active. Inparticular, the connections sending base backups were listed as beingidle. Which means that a regular pg_basebackup would show up with oneactive and one idle connection, when both were active.This patch updates to set all walsenders to active when they are(including those doing very fast things like IDENTIFY_SYSTEM), and thenback to idle. Details about exactly what they are doing is available inpg_stat_replication.Patch by me, review by Michael Paquier and David Steele.
1 parent48c9f49 commitd02974e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/backend/replication/walsender.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,9 @@ exec_replication_command(const char *cmd_string)
15041504
initStringInfo(&reply_message);
15051505
initStringInfo(&tmpbuf);
15061506

1507+
/* Report to pgstat that this process is running */
1508+
pgstat_report_activity(STATE_RUNNING,NULL);
1509+
15071510
switch (cmd_node->type)
15081511
{
15091512
caseT_IdentifySystemCmd:
@@ -1555,6 +1558,9 @@ exec_replication_command(const char *cmd_string)
15551558
ereport(ERROR,
15561559
(errmsg("cannot execute SQL commands in WAL sender for physical replication")));
15571560

1561+
/* Report to pgstat that this process is now idle */
1562+
pgstat_report_activity(STATE_IDLE,NULL);
1563+
15581564
/* Tell the caller that this wasn't a WalSender command. */
15591565
return false;
15601566

@@ -1570,6 +1576,9 @@ exec_replication_command(const char *cmd_string)
15701576
/* Send CommandComplete message */
15711577
EndCommand("SELECT",DestRemote);
15721578

1579+
/* Report to pgstat that this process is now idle */
1580+
pgstat_report_activity(STATE_IDLE,NULL);
1581+
15731582
return true;
15741583
}
15751584

@@ -2089,9 +2098,6 @@ WalSndLoop(WalSndSendDataCallback send_data)
20892098
last_reply_timestamp=GetCurrentTimestamp();
20902099
waiting_for_ping_response= false;
20912100

2092-
/* Report to pgstat that this process is running */
2093-
pgstat_report_activity(STATE_RUNNING,NULL);
2094-
20952101
/*
20962102
* Loop until we reach the end of this timeline or the client requests to
20972103
* stop streaming.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp