Identify walsenders in pg_stat_activity
authorSimon Riggs <[email protected]>
Mon, 12 Sep 2016 07:57:14 +0000 (08:57 +0100)
committerSimon Riggs <[email protected]>
Mon, 12 Sep 2016 07:57:14 +0000 (08:57 +0100)
Following 8299471c37fff0b walsender procs are now visible in pg_stat_activity.
Set query to â€˜walsender’ for walsender procs to allow them to be identified.

Discussion:CAB7nPqS8c76KPSufK_HSDeYrbtg+zZ7D0EEkjeM6txSEuCB_jA@mail.gmail.com

Michael Paquier, issue raised by Fujii Masao, reviewed by Tom Lane

src/backend/replication/walsender.c

index 1ea2a5cfdf1225d1ab781a227a713c8f96ad6f62..c7743da034ac332c69d5ade737c3d07516370056 100644 (file)
@@ -1806,6 +1806,9 @@ WalSndLoop(WalSndSendDataCallback send_data)
        last_reply_timestamp = GetCurrentTimestamp();
        waiting_for_ping_response = false;
 
+       /* Report to pgstat that this process is a WAL sender */
+       pgstat_report_activity(STATE_RUNNING, "walsender");
+
        /*
         * Loop until we reach the end of this timeline or the client requests to
         * stop streaming.