Re: pageinspect patch, for showing tuple data

From: Nikolay Shaplov <n(dot)shaplov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pageinspect patch, for showing tuple data
Date: 2015-08-03 11:01:51
Message-ID: 5084877.zDfmfEiX1x@nataraj-amd64
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

В письме от 3 августа 2015 14:30:46 пользователь Michael Paquier написал:
> On Mon, Aug 3, 2015 at 1:03 AM, Nikolay Shaplov
>
> <n(dot)shaplov(at)postgrespro(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2015-08-03 11:55:42 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file
Previous Message Alexander Korotkov 2015-08-03 09:51:49 Re: [PATCH] Microvacuum for gist.