pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: maxim.boguk@gmail.com, pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #10123: Weird entries in pg_stat_activity
Date: Thu, 24 Apr 2014 19:46:41 +0200
Message-ID: <20140424174641.GC32057@awork2.anarazel.de> (raw)
In-Reply-To: <474.1398357435@sss.pgh.pa.us>
References: <20140424101827.2714.39486@wrigleys.postgresql.org>
	<CABUevEySW0ZrVbMzygnXGJ=E2UAewZu498bUN3VdjO1vjcd8xQ@mail.gmail.com>
	<20140424104442.GC16111@awork2.anarazel.de>
	<474.1398357435@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2014-04-24 12:37:15 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > I think there's a pgstat_report_xact_timestamp(0) missing from
> > xact.c:PrepareTransaction(). There's no point in reporting a prepared
> > xact's starttime in a backend that's not associated with it anymore.
> 
> > Maxim, are you using prepared transactions?
> 
> Even if he were, that wouldn't explain this report, because the displayed
> latest-query would have to have been a PREPARE TRANSACTION, no?

Right. I think there's some other contents that could potentially end up
there, but surely not the SELECT Maxim is reporting. Especially not as
there seem to be several minutes inbetween the pg_stat_get_activity call
and the last state change...

> However, regardless of exactly what's going on here, I think you're
> probably right that PrepareTransaction ought to do
> pgstat_report_xact_timestamp(0) once it exits the transaction state
> locally.  The definition of that field is that it's null whenever the
> session isn't inside a transaction, and once we do PREPARE, we aren't.

Thanks for fixing it.

I don't really have a clue what's going on here. I don't believe
pgstat.c's changecount thing is 100% safe, but that doesn't explain the
problem here.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (17+ messages)  latest in thread

Message-ID: <20140424174641.GC32057@awork2.anarazel.de>
Permalink:  ../20140424174641.GC32057@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20140424174641.GC32057@awork2.anarazel.de

 · 

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-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, magnus@hagander.net
  Subject: Re: BUG #10123: Weird entries in pg_stat_activity
  In-Reply-To: <20140424174641.GC32057@awork2.anarazel.de>

* 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