MVCC vacuum error

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "pgsql-hackers" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: MVCC vacuum error
Date: 1999-05-08 08:57:23
Message-ID: 001701be9930$c9cd2fa0$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all,

I got some errors when testing vacuum with other concurrent
sessions. The following patch would fix some of the cases such that

1.ERROR : moving chain: failed to add item with len = ......
2.ERROR : Cannot insert a duplicate key into a unique index

Another bug seems to remain unsolved.

VACUUM shows

NOTICE :NUMBER OF INDEX' TUPLES (...) IS NOT THE SAME
AS HEAP' (...)

and after vacuum other sessions show

ERROR : Cannot insert a duplicate key into a unique index

AFAIC when moving update chain of tuples,vpd_offsets is maintained
only for one page,even if tuples in chain exist in plural pages.
So there seems to be cases that some index tuples remain alive
which point out invalid(or nonexistent by truncation) tids after vacuum.

Thanks.

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

*** backend/commands/vacuum.c.orig Tue Apr 13 16:01:16 1999
--- backend/commands/vacuum.c Sat May 8 17:23:50 1999
***************
*** 1336,1342 ****
*/
ToPage = BufferGetPage(cur_buffer);
/* if this page was not used before - clean it */
! if (!PageIsEmpty(ToPage) && vtmove[i].cleanVpd)
vc_vacpage(ToPage, vtmove[ti].vpd);
heap_copytuple_with_tuple(&tuple, &newtup);
RelationInvalidateHeapTuple(onerel, &tuple);
--- 1336,1342 ----
*/
ToPage = BufferGetPage(cur_buffer);
/* if this page was not used before - clean it */
! if (!PageIsEmpty(ToPage) && vtmove[ti].cleanVpd)
vc_vacpage(ToPage, vtmove[ti].vpd);
heap_copytuple_with_tuple(&tuple, &newtup);
RelationInvalidateHeapTuple(onerel, &tuple);
***************
*** 1355,1361 ****
newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup.t_data);
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
! ItemPointerSet(&(newtup.t_self), vtmove[i].vpd->vpd_blkno, newoff);
/*
* Set t_ctid pointing to itself for last tuple in
* chain and to next tuple in chain otherwise.
--- 1355,1361 ----
newitemid = PageGetItemId(ToPage, newoff);
pfree(newtup.t_data);
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
! ItemPointerSet(&(newtup.t_self), vtmove[ti].vpd->vpd_blkno, newoff);
/*
* Set t_ctid pointing to itself for last tuple in
* chain and to next tuple in chain otherwise.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chris Bitmead 1999-05-08 09:12:20 Date/Time Flaw in pg_dump ?
Previous Message Thomas Lockhart 1999-05-08 02:47:58 Re: [HACKERS] NUMERIC type conversions leave much to be desired