Re: ERROR: attempted to delete invisible tuple

From: Bryan Murphy <bmurphy1976(at)gmail(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: attempted to delete invisible tuple
Date: 2009-08-17 16:47:07
Message-ID: 7fd310d10908170947r3e6679fauf4d6cae915187f38@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 17, 2009 at 11:35 AM, Greg Stark <gsstark(at)mit(dot)edu> wrote:

> On Mon, Aug 17, 2009 at 4:23 PM, Bryan Murphy<bmurphy1976(at)gmail(dot)com>
> wrote:
> > I've identified 82 bad records. When I try to query for the records,
> > we get the following:
> > ERROR: missing chunk number 0 for toast value 25692661 in
> pg_toast_25497233
> > That's fine. I've run into that in a few other tables and have just been
> > deleting the offending records. However, in this particular table, when
> I
> > try and delete the records, I get the following error message:
> > ERROR: attempted to delete invisible tuple
> > I'm at a loss what to do next.
>
> Can you select xmin,xmax,ctid from the bad tuples?
>
> And also the output of pg_resetxlog -n. I suspect you may have failed
> to restore properly and have tuples from the "future" in your
> database. Perhaps you're missing at the last WAL file in your
> recovery?
>
> If that's the case you may be able to get out of it with pg_resetxlog
> and then cleaning up but it would be good to see the data first before
> changing things.

Here's the xmin/xmax/ctid for three problematic records:

prodpublic=# select xmin,xmax,ctid from items_extended where id in
('34537ed90d7546d78f2c172fc8eed687', '3e1d99b7124742b7aaf2f869f7637b0e',
'499b464f141a48619c5ce0475cbe9150');
xmin | xmax | ctid
-----------+-----------+------------
262232659 | 308810030 | (689496,3)
262629744 | 308810034 | (692765,1)
262643188 | 308810035 | (692920,9)
(3 rows)

I have not yet run pg_resetxlog.

Thanks,
Bryan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bryan Murphy 2009-08-17 17:07:59 Re: ERROR: attempted to delete invisible tuple
Previous Message Alvaro Herrera 2009-08-17 16:45:23 Re: ERROR: XLogFlush: request AF/5703EDC8 is not satisfied --- flushed only to AF/50F15ABC