MVCC vacuum error

Started by Hiroshi Inoueover 26 years ago2 messages
#1Hiroshi Inoue
Inoue@tpf.co.jp

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@tpf.co.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.
#2Vadim Mikheev
vadim@krs.ru
In reply to: Hiroshi Inoue (#1)
Re: [HACKERS] MVCC vacuum error

Hiroshi Inoue wrote:

Hello all,

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

...

Thanks Hiroshi!
I still hadn't time to test vacuum being busy with locking -:(

Applyed & committed.

Vadim