From: | "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | "Stephen Birch" <sbirch(at)ironmountainsystems(dot)com> |
Cc: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgreSQL(dot)org>, "The Hermit Hacker" <scrappy(at)hub(dot)org> |
Subject: | RE: [HACKERS] Re:HEAP_MOVED_IN during vacuum - test case |
Date: | 2000-01-10 03:03:23 |
Message-ID: | 000301bf5b17$41f342a0$2801007e@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 Stephen Birch
>
> I have now created a test case that demonstrate the HEAP_MOVED_IN during
> vacuum problem. Since the tar ball is 182k - I put it on an ftp site
> instead of mailing it.
>
> You can grab it from the following location:
>
> http://www.ironmountainsystems.com/heap_moved_in/
>
The following patch seems to fix your case.
However I'm not sure it's a right solution.
Regards.
Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp
Index: commands/vacuum.c
===================================================================
RCS file: /home/cvs/pgcurrent/backend/commands/vacuum.c,v
retrieving revision 1.18
diff -c -r1.18 vacuum.c
*** commands/vacuum.c 2000/01/05 03:05:35 1.18
--- commands/vacuum.c 2000/01/10 02:39:35
***************
*** 1049,1054 ****
--- 1049,1055 ----
*idcur;
int last_fraged_block,
last_vacuum_block,
+ last_movedin_block,
i = 0;
Size tuple_len;
int num_moved,
***************
*** 1084,1089 ****
--- 1085,1091 ----
vacuumed_pages = vacuum_pages->vpl_num_pages -
vacuum_pages->vpl_empty_end_pages;
last_vacuum_page = vacuum_pages->vpl_pagedesc[vacuumed_pages - 1];
last_vacuum_block = last_vacuum_page->vpd_blkno;
+ last_movedin_block = 0;
Assert(last_vacuum_block >= last_fraged_block);
cur_buffer = InvalidBuffer;
num_moved = 0;
***************
*** 1097,1102 ****
--- 1099,1107 ----
/* if it's reapped page and it was used by me - quit */
if (blkno == last_fraged_block && last_fraged_page->vpd_offsets_used >
0)
break;
+ /* couldn't shrink any more if this block has MOVED_INd tuples - quit */
+ if (blkno == last_movedin_block)
+ break;
buf = ReadBuffer(onerel, blkno);
page = BufferGetPage(buf);
***************
*** 1477,1482 ****
--- 1482,1489 ----
newtup.t_datamcxt = NULL;
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
ItemPointerSet(&(newtup.t_self), vtmove[ti].vpd->vpd_blkno, newoff);
+ if (vtmove[i].vpd->vpd_blkno > last_movedin_block)
+ last_movedin_block = vtmove[i].vpd->vpd_blkno;
/*
* Set t_ctid pointing to itself for last tuple in
***************
*** 1610,1615 ****
--- 1617,1624 ----
newtup.t_data = (HeapTupleHeader) PageGetItem(ToPage, newitemid);
ItemPointerSet(&(newtup.t_data->t_ctid), cur_page->vpd_blkno, newoff);
newtup.t_self = newtup.t_data->t_ctid;
+ if (cur_page->vpd_blkno > last_movedin_block)
+ last_movedin_block = cur_page->vpd_blkno;
/*
* Mark old tuple as moved_off by vacuum and store vacuum XID
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-01-10 04:21:59 | Re: Postgres Features for 7.X |
Previous Message | Tom Lane | 2000-01-09 21:33:21 | Re: [HACKERS] Re:HEAP_MOVED_IN during vacuum - test case |