Re: Could not open file "pg_clog/...."

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Markus Wollny <Markus(dot)Wollny(at)computec(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Could not open file "pg_clog/...."
Date: 2009-05-12 18:51:44
Message-ID: 20090512185144.GI4050@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Markus Wollny wrote:

> magazine=# vacuum analyze pcaction.article;
> PANIC: corrupted item pointer: 5
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
> The connection to the server was lost. Attempting reset: Failed.

This error comes from this piece of PageRepairFragmentation:

/* Need to compact the page the hard way */
itemidbase = (itemIdSort) palloc(sizeof(itemIdSortData) * nstorage);
itemidptr = itemidbase;
totallen = 0;
for (i = 0; i < nline; i++)
{
lp = PageGetItemId(page, i + 1);
if (ItemIdHasStorage(lp))
{
itemidptr->offsetindex = i;
itemidptr->itemoff = ItemIdGetOffset(lp);
if (itemidptr->itemoff < (int) pd_upper ||
itemidptr->itemoff >= (int) pd_special)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg("corrupted item pointer: %u",
itemidptr->itemoff)));
itemidptr->alignedlen = MAXALIGN(ItemIdGetLength(lp));
totallen += itemidptr->alignedlen;
itemidptr++;
}
}

What it means, AFAICT is that the page is corrupted beyond recovery. If you
want to salvage the rest of the data on the table, you could zero out this
page, for which you'll obviously need to know what page it was. It's not a
trivial patch to add that info to the error message, because
PageRepairFragmentation does not receive it.

I think it is worth our trouble to report block numbers on this kind of errors;
and in fact I had started on a patch to add errcontext() to vacuum and analyze
calls, but never finished it.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message WP Perquin 2009-05-12 19:01:09 Re: regexp_matches problem
Previous Message Francisco Figueiredo Jr. 2009-05-12 15:27:15 Re: Difference between "in (...)" and "= any(...)" queries when using arrays