Re: pageinspect patch, for showing tuple data - Mailing list pgsql-hackers

From Nikolay Shaplov
Subject Re: pageinspect patch, for showing tuple data
Date
Msg-id 5084877.zDfmfEiX1x@nataraj-amd64
Whole thread Raw
In response to Re: pageinspect patch, for showing tuple data  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
В письме от 3 августа 2015 14:30:46 пользователь Michael Paquier написал:
> On Mon, Aug 3, 2015 at 1:03 AM, Nikolay Shaplov
>
> <n.shaplov@postgrespro.ru> wrote:
> > Hi!
> >
> > I've created a patch for pageinspect that allows to see data stored in the
> > tuple.
> >
> > This patch has two main purposes:
> >
> > 1. Practical: Make manual DB recovery more simple
>
> To what are you referring to in this case? Manual manipulation of
> on-disk data manually?
Yes, when DB is broken for example

>
> > b) I have plenty of sanity check while reading parsing that tuple, for
> > this
> > function I've changed error level from ERROR to WARNING. This function
> > will
> > allow to write proper tests that all these checks work as they were
> > designed (I hope to write these tests sooner or later)
>
> +                ereport(inter_call_data->error_level,
> +                        (errcode(ERRCODE_DATA_CORRUPTED),
> +                            errmsg("Data corruption: Iterating over
> tuple data reached out of actual tuple size")));
> I don't think that the possibility to raise a WARNING is a good thing
> in those code paths. If data is corrupted this may crash, and I am not
> sure that anybody would want that even for educational purposes.
Hm... I considered _heap_page_items really very dangerous function, with big
red "Do not call it if you not sure what are you doing" warning. Reading data
with not proper attribute descriptor is dangerous any way. But when I wrote
that code, I did not have that checks at first, and it was really interesting
to subst one data with another and see what will happen. And I thought that
may be other explorers will like to do the same. And it is really possible
only in warning mode. So I left warnings only in _heap_page_items, and set
errors for all other cases.


--
Nikolay Shaplov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: [PATCH] Microvacuum for gist.
Next
From: Amit Kapila
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file