From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: autovacuum and TOAST tables |
Date: | 2008-08-14 18:07:03 |
Message-ID: | 20080814180703.GD4232@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Tom Lane wrote:
> I wrote:
> > Hmm, we could probably fix that if we made the cluster operation swap
> > the physical storage of the two toast tables, rather than swapping the
> > tables altogether. I agree it's not critical but it could be confusing.
>
> On second thought, I think it *could* lead to a visible failure.
> Suppose the OID counter wraps around and the OID that had been used for
> the temporary CLUSTER table gets assigned to a new table. If that table
> needs a toast table, it'll try to create one using the name that is
> already in use. We have defenses against picking an OID that's in use,
> but none for toast table names. So I think it's indeed worth fixing.
My first attempt at a fix, which was simply swapping relfilenode for the
TOAST tables (and its indexes) after the data has been copied, does not
work, apparently because the TOAST pointers have the toast table ID
embedded. Since we're intending to keep the pg_class entry for the old
TOAST table, the OID in the toast links is no longer valid.
I'm not sure what can be done about this ... Obviously we cannot just
swap the toast table before starting to move the data, because then we
cannot read the original data.
I wonder if we can get away with simply renaming the new toast table and
index after the data has been copied.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-08-14 18:15:22 | Re: autovacuum and TOAST tables |
Previous Message | Simon Riggs | 2008-08-14 17:50:09 | Re: IN vs EXISTS equivalence |