Re: Patch to send transaction commit/rollback stats to the stats collector unconditionally.

From: Gurjeet Singh <gurjeet(at)singh(dot)im>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch to send transaction commit/rollback stats to the stats collector unconditionally.
Date: 2014-07-02 21:00:45
Message-ID: CABwTF4UHeP3k6EE9F=qcxTAL4dJPHuPY5VWbjoZguTVZcbkoVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 2, 2014 at 3:49 PM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> In preparing to push the patch, I noticed I hadn't responded to this:
>
> Gurjeet Singh <gurjeet(at)singh(dot)im> wrote:
>> Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
>>> I have reviewed this patch, and think we should do what the patch
>>> is trying to do, but I don't think the submitted patch would
>>> actually work.
>>
>> Just curious, why do you think it won't work.
>
> Because you didn't touch this part of the function:
>
> /*
> * Send partial messages. If force is true, make sure that any pending
> * xact commit/abort gets counted, even if no table stats to send.
> */
> if (regular_msg.m_nentries > 0 ||
> (force && (pgStatXactCommit > 0 || pgStatXactRollback > 0)))
> pgstat_send_tabstat(&regular_msg);
>
> The statistics would not actually be sent unless a table had been
> accessed or it was forced because the connection was closing.

I sure did! In fact that was the one and only line of code that was
changed. It effectively bypassed the 'force' check if there were any
transaction stats to report.

/*
- * Send partial messages. If force is true, make sure that any pending
- * xact commit/abort gets counted, even if no table stats to send.
+ * Send partial messages. Make sure that any pending xact
commit/abort gets
+ * counted, even if no table stats to send.
*/
if (regular_msg.m_nentries > 0 ||
- (force && (pgStatXactCommit > 0 || pgStatXactRollback > 0)))
+ force || (pgStatXactCommit > 0 || pgStatXactRollback > 0))
pgstat_send_tabstat(&regular_msg);
if (shared_msg.m_nentries > 0)
pgstat_send_tabstat(&shared_msg);

Best regards,
--
Gurjeet Singh http://gurjeet.singh.im/

EDB : www.EnterpriseDB.com : The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2014-07-02 21:14:38 Re: Patch to send transaction commit/rollback stats to the stats collector unconditionally.
Previous Message Tom Lane 2014-07-02 20:52:43 Re: Audit of logout