Re: ERROR: missing chunk number 0 for toast value

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Rushabh Lathia <rushabh(dot)lathia(at)enterprisedb(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: ERROR: missing chunk number 0 for toast value
Date: 2014-01-02 20:19:14
Message-ID: 20140102201914.GA31635@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-01-02 15:00:58 -0500, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> > On 2014-01-02 21:21:15 +0200, Heikki Linnakangas wrote:
> >> I don't see any other realistic way to fix this, however, so maybe we
> >> should just bite the bullet and do it anyway.
>
> > We could remember the subtransaction a variable was created in and error
> > out if it the creating subtransaction aborted and it's not a
> > pass-by-value datum or similar.
>
> That would still result in throwing an error, though, so it isn't likely
> to make the OP happy.

Yea, it would give a better error message which might help diagnose the
issue, but not more. We could disallow accessing such variables
generally unless they explicitly had been detoasted, that would make
people notice the problem more easily.

I shortly wondered if we couldn't "just" iterate over plpgsql variables
and detoast them on subabort if created in the aborted xact, but that
doesn't really work because we're in an aborted transaction where it
might not be safe to access relations... Theoretically the subabort
could be split into two phases allowing it by only releasing the lock
after safely switching to the upper transaction but that sounds like a
hammer too big for the problem.

> I was wondering if we could somehow arrange to not
> release the subtransaction's AccessShareLock on the table, as long as it
> was protecting toasted references someplace.

Sounds fairly ugly...

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-01-02 21:01:10 Re: CLUSTER FREEZE
Previous Message Andres Freund 2014-01-02 20:09:52 Re: preserving forensic information when we freeze