RE: [HACKERS] Reproducible vacuum complaint!

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] Reproducible vacuum complaint!
Date: 1999-11-22 00:29:17
Message-ID: 000201bf3480$9c2fcda0$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: owner-pgsql-hackers(at)postgreSQL(dot)org
> [mailto:owner-pgsql-hackers(at)postgreSQL(dot)org]On Behalf Of Tom Lane
> Sent: Monday, November 22, 1999 8:00 AM
> To: pgsql-hackers(at)postgreSQL(dot)org
> Subject: [HACKERS] Reproducible vacuum complaint!
>
>
> I have devised a simple manual way of reproducing that peculiar VACUUM
> notice that Oleg has been complaining about, but didn't have a reliable
> way of triggering on-demand. It looks like it is caused by some sort of
> bug in the transaction commit logic --- or maybe just VACUUM's piece of
> it, but anyway there is something mucho bad going on here.
>
> Setup:
>
> create table hits (msg_id int, nhits int);
> create index hits_pkey on hits(msg_id);
> insert into hits values(42,0);
> insert into hits values(43,0);
>
> Given this setup, you can do
>
> drop index hits_pkey;
> update hits set nhits = nhits+1 where msg_id = 42;
> create index hits_pkey on hits(msg_id);
> vacuum analyze hits;
>
> all day with no problem.
>
> BUT: start up another psql, and in that other psql begin a transaction
> block and touch anything at all --- doesn't have to be the table under
> test:
>
> begin;
> select * from int4_tbl;
>
> Now, *without committing* that other transaction, go back to the first
> psql and try again:
>
> drop index hits_pkey;
> update hits set nhits = nhits+1 where msg_id = 42;
> create index hits_pkey on hits(msg_id);
> vacuum analyze hits;
> NOTICE: Index hits_pkey: NUMBER OF INDEX' TUPLES (2) IS NOT THE
> SAME AS HEAP' (3).
> Try recreating the index.
>

Hmm,if "select * .." runs in SERIALIZABLE isolation level,the transaction
would see an old "msg_id=42" tuple(not new one). So vacuum doesn't
vanish the old "msg_id=42" tuple. Vacuum takes all running transactions
into account. But AFAIK,there's no other such stuff.
CREATE INDEX may be another one which should take all running
transactions into account.

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1999-11-22 02:40:26 RE: [HACKERS] New regression driver
Previous Message Tom Lane 1999-11-21 23:00:29 Reproducible vacuum complaint!