Re: pg_stat_transaction patch
Joel Jacobson <joel@gluefinance.com>
From: Joel Jacobson <joel@gluefinance.com>
To: Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2010-05-20T03:17:07Z
Lists: pgsql-hackers
Attachments
- pg_stat_transaction-1.31.tar.gz (application/x-gzip)
Hajimemashite Takahiro,
Thanks for your feedback.
I applied all the changes on 9.0beta manually and then it compiled without
any assertion failures.
I also changed the oids to a different unused range, since the ones I used
before had been taken in 9.0beta1.
There are still some problems though. I get 0 back from the functions
supposed to return the number of inserts/updates for the current
transaction.
I suspect it is because get_tabstat_entry for some reason returns NULL, in
for example pg_stat_get_transaction_tuples_inserted(PG_FUNCTION_ARGS).
Does the function look valid? If you can find the error in it, the other
functions probably have the same problem.
It is strange though the function "pg_stat_get_transaction_numscans" works
fine, and it looks like it works the same way.
I added run.out843 and run.out90b1, showing the output from both patched
versions.
run.out843 is the intended output, while run.out90b1 gives 0 on the columns
n_tup_ins and n_tup_upd (and probably n_tup_del etc also).
I hope someone can help locating the problem.
Thanks.
Best regards,
Joel
2010/5/7 Takahiro Itagaki <itagaki.takahiro@oss.ntt.co.jp>
>
> Joel Jacobson <joel@gluefinance.com> wrote:
>
> > I propose a set of new statistics functions and system views.
> >
> > I need these functions in order to do automated testing of our system,
> > consisting of hundreds of stored procedures in plpgsql.
> > My plan is to develop some additional functions to pgTAP, benefiting from
> > the new system tables I've added.
>
> I ported your patch into 9.0beta, but it doesn't work well.
> I had two assertion failures from the run.sql:
>
> TRAP: FailedAssertion("!(entry->trans == ((void *)0))", File: "pgstat.c",
> Line: 715)
> TRAP: FailedAssertion("!(tabstat->trans == trans)", File: "pgstat.c", Line:
> 1756)
>
> Also, pg_stat_transaction_functions returned no rows from the test case
> even
> after I removed those assertions. There are no rows in your test/run.out,
> too.
>
> I like your idea itself, but more works are required for the
> implementation.
>
> Regards,
> ---
> Takahiro Itagaki
> NTT Open Source Software Center
>
>
--
Best regards,
Joel Jacobson
Glue Finance
E: jj@gluefinance.com
T: +46 70 360 38 01
Postal address:
Glue Finance AB
Box 549
114 11 Stockholm
Sweden
Visiting address:
Glue Finance AB
Birger Jarlsgatan 14
114 34 Stockholm
Sweden