mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-07 06:39:23 +02:00
pg_stat_activity: show NULL stmt start time for walsenders
Returning a non-NULL time is pointless, sinc a walsender is not a process that would be running normal transactions anyway, but the code was unintentionally exposing the process start time intermittently, which was not only bogus but it also confused monitoring systems looking for idle transactions. Fix by avoiding all updates in walsenders. Backpatch to 11, where walsenders started appearing in pg_stat_activity. Reported-by: Tomas Vondra Discussion: https://postgr.es/m/20191209234409.exe7osmyalwkt5j4@development
This commit is contained in:
parent
b89845267a
commit
fce9ba8192
@ -817,6 +817,13 @@ GetCurrentTransactionStopTimestamp(void)
|
|||||||
void
|
void
|
||||||
SetCurrentStatementStartTimestamp(void)
|
SetCurrentStatementStartTimestamp(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Skip if on a walsender; this is not needed, and it confuses monitoring
|
||||||
|
* if we publish non-NULL values.
|
||||||
|
*/
|
||||||
|
if (am_walsender)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!IsParallelWorker())
|
if (!IsParallelWorker())
|
||||||
stmtStartTimestamp = GetCurrentTimestamp();
|
stmtStartTimestamp = GetCurrentTimestamp();
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user