Re: Bug: Unreferenced temp tables disables vacuum to update xid

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: andrew(at)supernews(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug: Unreferenced temp tables disables vacuum to update xid
Date: 2008-01-14 23:16:08
Message-ID: 8131.1200352568@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Hmm ... that would be strange. Off-the-cuff idea: we introduced code to
> advance relfrozenxid in CLUSTER, TRUNCATE and table-rewriting forms of
> ALTER TABLE. Perhaps the problem is that we're neglecting to update it
> for the toast table there. AFAIR I analyzed the cases and they were all
> handled, but perhaps I forgot something.

I found a smoking gun ...

regression=# create table foo (f1 serial primary key, f2 text);
NOTICE: CREATE TABLE will create implicit sequence "foo_f1_seq" for serial column "foo.f1"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
CREATE TABLE
regression=# insert into foo values(1,repeat('xyzzy',100000));
INSERT 0 1
regression=# insert into foo values(2,repeat('xqzzy',100000));
INSERT 0 1
regression=# select relname, relkind, relfrozenxid from pg_class order by oid desc limit 6;
relname | relkind | relfrozenxid
-----------------------+---------+--------------
foo_pkey | i | 0
pg_toast_707220_index | i | 0
pg_toast_707220 | t | 119421
foo | r | 119421
foo_f1_seq | S | 0
xmlview5 | v | 0
(6 rows)

regression=# cluster foo_pkey on foo;
CLUSTER
regression=# select relname, relkind, relfrozenxid from pg_class order by oid desc limit 6;
relname | relkind | relfrozenxid
-----------------------+---------+--------------
pg_toast_707231_index | i | 0
pg_toast_707231 | t | 119424
foo_pkey | i | 0
foo | r | 4195086720
foo_f1_seq | S | 0
xmlview5 | v | 0
(6 rows)

So something is out of whack in CLUSTER. However it only seems to be
broken in HEAD, so I'm not sure this helps to explain the original
report. (Speculation: this is related to the rewrite to make CLUSTER
MVCC-safe?)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-01-14 23:38:02 Re: Bug: Unreferenced temp tables disables vacuum to update xid
Previous Message Tom Lane 2008-01-14 22:48:04 Re: to_char incompatibility