77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.135 2000/01/15 22:43:22 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.136 2000/01/19 22:23:00 momjian Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -285,6 +285,9 @@ vc_getrels(NameData *VacRelP)
285285
286286if (NameStr (* VacRelP ))
287287{
288+ /* we could use the cache here, but it is clearer to use
289+ * scankeys for both vacuum cases, bjm 2000/01/19
290+ */
288291ScanKeyEntryInitialize (& key ,0x0 ,Anum_pg_class_relname ,
289292F_NAMEEQ ,
290293PointerGetDatum (NameStr (* VacRelP )));
@@ -766,7 +769,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
766769}
767770else if (!TransactionIdIsInProgress (tuple .t_data -> t_xmin ))
768771{
769-
770772/*
771773 * Not Aborted, Not Committed, Not in Progress -
772774 * so it's from crashed process. - vadim 11/26/96
@@ -817,7 +819,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
817819}
818820else if (!TransactionIdIsInProgress (tuple .t_data -> t_xmax ))
819821{
820-
821822/*
822823 * Not Aborted, Not Committed, Not in Progress - so it
823824 * from crashed process. - vadim 06/02/97
@@ -920,7 +921,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
920921}
921922else
922923dobufrel = true;
923- if (tempPage != (Page )NULL )
924+
925+ if (tempPage != (Page )NULL )
924926{/* Some tuples are gone */
925927PageRepairFragmentation (tempPage );
926928vpc -> vpd_free = ((PageHeader )tempPage )-> pd_upper - ((PageHeader )tempPage )-> pd_lower ;
@@ -1266,7 +1268,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
12661268 * This means that in the middle of chain there was
12671269 * tuple updated by older (than XmaxRecent) xaction
12681270 * and this tuple is already deleted by me. Actually,
1269- * upper part of chain should be removed and seems
1271+ * upper part of chain should be removed and seems
12701272 * that this should be handled in vc_scanheap(), but
12711273 * it's not implemented at the moment and so we
12721274 * just stop shrinking here.
@@ -1307,9 +1309,10 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
13071309if (vc_enough_space (fraged_pages -> vpl_pagedesc [i ],tlen ))
13081310break ;
13091311}
1310- if (i == num_fraged_pages )/* can't move item
1311- * anywhere */
1312- {
1312+
1313+ /* can't move item anywhere */
1314+ if (i == num_fraged_pages )
1315+ {
13131316for (i = 0 ;i < num_vtmove ;i ++ )
13141317{
13151318Assert (vtmove [i ].vpd -> vpd_offsets_used > 0 );
@@ -1341,16 +1344,12 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
13411344free_vtmove -- ;
13421345num_vtmove ++ ;
13431346
1344- /*
1345- * All done ?
1346- */
1347+ /* All done ? */
13471348if (!(tp .t_data -> t_infomask & HEAP_UPDATED )||
13481349tp .t_data -> t_xmin < XmaxRecent )
13491350break ;
13501351
1351- /*
1352- * Well, try to find tuple with old row version
1353- */
1352+ /* Well, try to find tuple with old row version */
13541353for (;;)
13551354{
13561355Buffer Pbuf ;
@@ -1384,9 +1383,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
13841383/*
13851384 * Read above about cases when !ItemIdIsUsed(Citemid)
13861385 * (child item is removed)... Due to the fact that
1387- * at the moment we don't remove unuseful part of
1386+ * at the moment we don't remove unuseful part of
13881387 * update-chain, it's possible to get too old
1389- * parent row here. Like as in the case which
1388+ * parent row here. Like as in the case which
13901389 * caused this problem, we stop shrinking here.
13911390 * I could try to find real parent row but want
13921391 * not to do it because of real solution will
@@ -1660,7 +1659,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
16601659}
16611660}
16621661
1663- }/* walk along page */
1662+ }/* walk along page */
16641663
16651664if (offnum < maxoff && keep_tuples > 0 )
16661665{
@@ -1683,9 +1682,9 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
16831682elog (ERROR ,"HEAP_MOVED_IN was not expected (2)" );
16841683if (tuple .t_data -> t_infomask & HEAP_MOVED_OFF )
16851684{
1686- if ( chain_tuple_moved ) /* some chains was moved
1687- * while */
1688- {/* cleaning this page */
1685+ /* some chains was moved while */
1686+ if ( chain_tuple_moved )
1687+ {/* cleaning this page */
16891688Assert (vpc -> vpd_offsets_free > 0 );
16901689for (i = 0 ;i < vpc -> vpd_offsets_free ;i ++ )
16911690{
@@ -1831,9 +1830,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
18311830vacrelstats -> num_tuples ,keep_tuples );
18321831}
18331832
1834- /*
1835- * clean moved tuples from last page in Nvpl list
1836- */
1833+ /* clean moved tuples from last page in Nvpl list */
18371834if (vpc -> vpd_blkno == blkno - 1 && vpc -> vpd_offsets_free > 0 )
18381835{
18391836buf = ReadBuffer (onerel ,vpc -> vpd_blkno );