Re: Diagnostic functions

Lists: pgsql-patches
From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Diagnostic functions
Date: 2007-05-02 10:29:51
Message-ID: 4638681F.1090708@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Here's an update of Simon's Heap Page Diagnostic Functions. I now
consider it ready to commit.

The new functions are all under new contrib module,
contrib/pgdiagnostics. I also moved bt_metap, bt_page_items and
bt_page_stats from pgstattuple to the new module.

I copied the bt_* functions almost unmodified. I didn't try to harmonize
the user interface or return values with the new heap page functions,
though that might we worth doing in the future.

I added input value checking to the new functions so that they should
handle invalid data gracefully. All the new functions are nevertheless
superuser-only, just to err on the safe side.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
pgdiagnostics.patch text/x-diff 53.6 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-patches(at)postgresql(dot)org
Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Subject: Re: Diagnostic functions
Date: 2007-05-05 14:02:10
Message-ID: 200705051602.10847.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Heikki Linnakangas wrote:
> Here's an update of Simon's Heap Page Diagnostic Functions. I now
> consider it ready to commit.

How is this better than pg_filedump?

"diagnostics" is an awfully general name, too.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-07 09:49:13
Message-ID: 463EF619.20703@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Peter Eisentraut wrote:
> Heikki Linnakangas wrote:
>> Here's an update of Simon's Heap Page Diagnostic Functions. I now
>> consider it ready to commit.
>
> How is this better than pg_filedump?

It's handy to be able to inspect pages from within a live database. The
new functions work through shared_buffers, so you can see changes
without having to issue a checkpoint to flush them to disk. pg_filedump
takes a filename as argument, the new function takes relation name.

Having them as functions also allows you to do more advanced queries
like "... WHERE (t_infomask & 1) <> 0 " to show tuples with a null bitmap.

> "diagnostics" is an awfully general name, too.

We already played the name game on hackers. My original suggestion was
"pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
others. I'm still open to suggestions, though. Have any?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-07 15:16:28
Message-ID: 200705071716.28795.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Am Montag, 7. Mai 2007 11:49 schrieb Heikki Linnakangas:
> It's handy to be able to inspect pages from within a live database.

How reliable is it to inspect pages from within a database if you presumably
suspect that database to be broken?

> We already played the name game on hackers. My original suggestion was
> "pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
> others. I'm still open to suggestions, though. Have any?

Something involving "page" would at least explain what you can diagnose.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/


From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-07 21:31:55
Message-ID: 463F9ACB.4060502@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Peter Eisentraut wrote:
> Am Montag, 7. Mai 2007 11:49 schrieb Heikki Linnakangas:
>> It's handy to be able to inspect pages from within a live database.
>
> How reliable is it to inspect pages from within a database if you presumably
> suspect that database to be broken?

As long as the page header is valid, the functions should be able to
deal with it (as in not crashing).

I found them extremely useful when I was developing the MVCC-safe
CLUSTER patch. The index functions in pgstattuple were very useful when
I worked on clustered indexes. In fact I reinvented the wheel and wrote
a function of my own that did essentially the same thing as
bt_page_items, before Bruce pointed out that such a thing already exists.

>> We already played the name game on hackers. My original suggestion was
>> "pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
>> others. I'm still open to suggestions, though. Have any?
>
> Something involving "page" would at least explain what you can diagnose.

Well, how about "pageinspect" then?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-11 17:15:48
Message-ID: 200705111715.l4BHFmT24705@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Heikki Linnakangas wrote:
> >> We already played the name game on hackers. My original suggestion was
> >> "pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
> >> others. I'm still open to suggestions, though. Have any?
> >
> > Something involving "page" would at least explain what you can diagnose.
>
> Well, how about "pageinspect" then?

Sounds good to me.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-17 17:02:44
Message-ID: 464C8AB4.8040303@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Bruce Momjian wrote:
> Heikki Linnakangas wrote:
>>>> We already played the name game on hackers. My original suggestion was
>>>> "pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
>>>> others. I'm still open to suggestions, though. Have any?
>>> Something involving "page" would at least explain what you can diagnose.
>> Well, how about "pageinspect" then?
>
> Sounds good to me.

Ok, here's an updated patch. It's the same as the last one, except for
the name.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
pageinspect.patch text/x-diff 54.0 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: Diagnostic functions
Date: 2007-05-17 19:11:29
Message-ID: 200705171911.l4HJBTp15838@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Applied. I also updated /contrib/README. Thanks.

---------------------------------------------------------------------------

Heikki Linnakangas wrote:
> Bruce Momjian wrote:
> > Heikki Linnakangas wrote:
> >>>> We already played the name game on hackers. My original suggestion was
> >>>> "pgforensics". "pgdiagfuncs" and "pginspect" were also suggested, among
> >>>> others. I'm still open to suggestions, though. Have any?
> >>> Something involving "page" would at least explain what you can diagnose.
> >> Well, how about "pageinspect" then?
> >
> > Sounds good to me.
>
> Ok, here's an updated patch. It's the same as the last one, except for
> the name.
>
> --
> Heikki Linnakangas
> EnterpriseDB http://www.enterprisedb.com

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +