pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: xact_start for walsender & logical decoding not updated
Date: Tue, 10 Dec 2019 12:59:03 +0100
Message-ID: <20191210115903.x5j3rfxtr3notsut@development> (raw)
In-Reply-To: <20191210.094217.2248726849034272968.horikyota.ntt@gmail.com>
References: <20191209234409.exe7osmyalwkt5j4@development>
	<20191210.094217.2248726849034272968.horikyota.ntt@gmail.com>

On Tue, Dec 10, 2019 at 09:42:17AM +0900, Kyotaro Horiguchi wrote:
>At Tue, 10 Dec 2019 00:44:09 +0100, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote in
>> Hi,
>>
>> I think there's a minor bug in pg_stat_activity tracking of walsender
>> processes. The issue is that xact_start is only updated at the very
>> beginning when the walsender starts (so it's almost exactly equal to
>> backend_start) and then just flips between NULL and that value.
>>
>> Reproducing this is trivial - just create a publication/subscription
>> with the built-in logical replication, and run arbitrary workload.
>> You'll see that the xact_start value never changes.
>>
>> I think the right fix is calling SetCurrentStatementStartTimestamp()
>> right before StartTransactionCommand() in ReorderBufferCommit, per the
>> attached patch.
>
>I'm not sure how much xact_start for walsender is useful and we really
>is not running a statement there.  Also autovac launcher starts
>transaction without a valid statement timestamp perhaps for the same
>reason.
>

Maybe, but then maybe we should change it so that we don't report any
timestamps for such processes.

>However, if we want to show something meaningful there, I think
>commit_time might be more informative there.  If we use
>GetCurrentTimestamp(), StartTransaction() already has the same feature
>for autonomous transactions. I suppose we should do them a unified
>way.
>

I don't think so. We have this information from the apply side, and this
is really about the *new* transaction started in reorderbuffer.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services 





view thread (18+ messages)  latest in thread

Message-ID: <20191210115903.x5j3rfxtr3notsut@development>
Permalink:  ../20191210115903.x5j3rfxtr3notsut@development/
Also on:    postgresql.org/message-id/20191210115903.x5j3rfxtr3notsut@development

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, horikyota.ntt@gmail.com
  Subject: Re: xact_start for walsender & logical decoding not updated
  In-Reply-To: <20191210115903.x5j3rfxtr3notsut@development>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox