Commit 08fb7375 authored by Bruce Momjian's avatar Bruce Momjian

Update vacuum comments.

parent 2317e714
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.135 2000/01/15 22:43:22 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.136 2000/01/19 22:23:00 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -285,6 +285,9 @@ vc_getrels(NameData *VacRelP) ...@@ -285,6 +285,9 @@ vc_getrels(NameData *VacRelP)
if (NameStr(*VacRelP)) if (NameStr(*VacRelP))
{ {
/* we could use the cache here, but it is clearer to use
* scankeys for both vacuum cases, bjm 2000/01/19
*/
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname, ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname,
F_NAMEEQ, F_NAMEEQ,
PointerGetDatum(NameStr(*VacRelP))); PointerGetDatum(NameStr(*VacRelP)));
...@@ -766,7 +769,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, ...@@ -766,7 +769,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
} }
else if (!TransactionIdIsInProgress(tuple.t_data->t_xmin)) else if (!TransactionIdIsInProgress(tuple.t_data->t_xmin))
{ {
/* /*
* Not Aborted, Not Committed, Not in Progress - * Not Aborted, Not Committed, Not in Progress -
* so it's from crashed process. - vadim 11/26/96 * so it's from crashed process. - vadim 11/26/96
...@@ -817,7 +819,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, ...@@ -817,7 +819,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
} }
else if (!TransactionIdIsInProgress(tuple.t_data->t_xmax)) else if (!TransactionIdIsInProgress(tuple.t_data->t_xmax))
{ {
/* /*
* Not Aborted, Not Committed, Not in Progress - so it * Not Aborted, Not Committed, Not in Progress - so it
* from crashed process. - vadim 06/02/97 * from crashed process. - vadim 06/02/97
...@@ -920,6 +921,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel, ...@@ -920,6 +921,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
} }
else else
dobufrel = true; dobufrel = true;
if (tempPage != (Page) NULL) if (tempPage != (Page) NULL)
{ /* Some tuples are gone */ { /* Some tuples are gone */
PageRepairFragmentation(tempPage); PageRepairFragmentation(tempPage);
...@@ -1307,8 +1309,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1307,8 +1309,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
if (vc_enough_space(fraged_pages->vpl_pagedesc[i], tlen)) if (vc_enough_space(fraged_pages->vpl_pagedesc[i], tlen))
break; break;
} }
if (i == num_fraged_pages) /* can't move item
* anywhere */ /* can't move item anywhere */
if (i == num_fraged_pages)
{ {
for (i = 0; i < num_vtmove; i++) for (i = 0; i < num_vtmove; i++)
{ {
...@@ -1341,16 +1344,12 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel, ...@@ -1341,16 +1344,12 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
free_vtmove--; free_vtmove--;
num_vtmove++; num_vtmove++;
/* /* All done ? */
* All done ?
*/
if (!(tp.t_data->t_infomask & HEAP_UPDATED) || if (!(tp.t_data->t_infomask & HEAP_UPDATED) ||
tp.t_data->t_xmin < XmaxRecent) tp.t_data->t_xmin < XmaxRecent)
break; break;
/* /* Well, try to find tuple with old row version */
* Well, try to find tuple with old row version
*/
for (;;) for (;;)
{ {
Buffer Pbuf; Buffer Pbuf;
...@@ -1683,8 +1682,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1683,8 +1682,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
elog(ERROR, "HEAP_MOVED_IN was not expected (2)"); elog(ERROR, "HEAP_MOVED_IN was not expected (2)");
if (tuple.t_data->t_infomask & HEAP_MOVED_OFF) if (tuple.t_data->t_infomask & HEAP_MOVED_OFF)
{ {
if (chain_tuple_moved) /* some chains was moved /* some chains was moved while */
* while */ if (chain_tuple_moved)
{ /* cleaning this page */ { /* cleaning this page */
Assert(vpc->vpd_offsets_free > 0); Assert(vpc->vpd_offsets_free > 0);
for (i = 0; i < vpc->vpd_offsets_free; i++) for (i = 0; i < vpc->vpd_offsets_free; i++)
...@@ -1831,9 +1830,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1831,9 +1830,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
vacrelstats->num_tuples, keep_tuples); vacrelstats->num_tuples, keep_tuples);
} }
/* /* clean moved tuples from last page in Nvpl list */
* clean moved tuples from last page in Nvpl list
*/
if (vpc->vpd_blkno == blkno - 1 && vpc->vpd_offsets_free > 0) if (vpc->vpd_blkno == blkno - 1 && vpc->vpd_offsets_free > 0)
{ {
buf = ReadBuffer(onerel, vpc->vpd_blkno); buf = ReadBuffer(onerel, vpc->vpd_blkno);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment