Re: pg_stat_transaction patch

From: Joel Jacobson <joel(at)gluefinance(dot)com>
To: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_stat_transaction patch
Date: 2010-05-20 03:17:07
Message-ID: AANLkTillSDUyGlUMCJ4MF9b7yAcQ9M3tzFZImYoSRoJU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>

>
> Joel Jacobson <joel(at)gluefinance(dot)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(at)gluefinance(dot)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

Attachment Content-Type Size
pg_stat_transaction-1.31.tar.gz application/x-gzip 11.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2010-05-20 03:20:08 Re: Synchronous replication patch built on SR
Previous Message Fujii Masao 2010-05-20 02:22:13 Re: Stefan's bug (was: max_standby_delay considered harmful)