7
7
*
8
8
*
9
9
* 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 $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -285,6 +285,9 @@ vc_getrels(NameData *VacRelP)
285
285
286
286
if (NameStr (* VacRelP ))
287
287
{
288
+ /* we could use the cache here, but it is clearer to use
289
+ * scankeys for both vacuum cases, bjm 2000/01/19
290
+ */
288
291
ScanKeyEntryInitialize (& key ,0x0 ,Anum_pg_class_relname ,
289
292
F_NAMEEQ ,
290
293
PointerGetDatum (NameStr (* VacRelP )));
@@ -766,7 +769,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
766
769
}
767
770
else if (!TransactionIdIsInProgress (tuple .t_data -> t_xmin ))
768
771
{
769
-
770
772
/*
771
773
* Not Aborted, Not Committed, Not in Progress -
772
774
* so it's from crashed process. - vadim 11/26/96
@@ -817,7 +819,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
817
819
}
818
820
else if (!TransactionIdIsInProgress (tuple .t_data -> t_xmax ))
819
821
{
820
-
821
822
/*
822
823
* Not Aborted, Not Committed, Not in Progress - so it
823
824
* from crashed process. - vadim 06/02/97
@@ -920,7 +921,8 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
920
921
}
921
922
else
922
923
dobufrel = true;
923
- if (tempPage != (Page )NULL )
924
+
925
+ if (tempPage != (Page )NULL )
924
926
{/* Some tuples are gone */
925
927
PageRepairFragmentation (tempPage );
926
928
vpc -> vpd_free = ((PageHeader )tempPage )-> pd_upper - ((PageHeader )tempPage )-> pd_lower ;
@@ -1266,7 +1268,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
1266
1268
* This means that in the middle of chain there was
1267
1269
* tuple updated by older (than XmaxRecent) xaction
1268
1270
* 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
1270
1272
* that this should be handled in vc_scanheap(), but
1271
1273
* it's not implemented at the moment and so we
1272
1274
* just stop shrinking here.
@@ -1307,9 +1309,10 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
1307
1309
if (vc_enough_space (fraged_pages -> vpl_pagedesc [i ],tlen ))
1308
1310
break ;
1309
1311
}
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
+ {
1313
1316
for (i = 0 ;i < num_vtmove ;i ++ )
1314
1317
{
1315
1318
Assert (vtmove [i ].vpd -> vpd_offsets_used > 0 );
@@ -1341,16 +1344,12 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
1341
1344
free_vtmove -- ;
1342
1345
num_vtmove ++ ;
1343
1346
1344
- /*
1345
- * All done ?
1346
- */
1347
+ /* All done ? */
1347
1348
if (!(tp .t_data -> t_infomask & HEAP_UPDATED )||
1348
1349
tp .t_data -> t_xmin < XmaxRecent )
1349
1350
break ;
1350
1351
1351
- /*
1352
- * Well, try to find tuple with old row version
1353
- */
1352
+ /* Well, try to find tuple with old row version */
1354
1353
for (;;)
1355
1354
{
1356
1355
Buffer Pbuf ;
@@ -1384,9 +1383,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
1384
1383
/*
1385
1384
* Read above about cases when !ItemIdIsUsed(Citemid)
1386
1385
* (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
1388
1387
* 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
1390
1389
* caused this problem, we stop shrinking here.
1391
1390
* I could try to find real parent row but want
1392
1391
* 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)",
1660
1659
}
1661
1660
}
1662
1661
1663
- }/* walk along page */
1662
+ }/* walk along page */
1664
1663
1665
1664
if (offnum < maxoff && keep_tuples > 0 )
1666
1665
{
@@ -1683,9 +1682,9 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
1683
1682
elog (ERROR ,"HEAP_MOVED_IN was not expected (2)" );
1684
1683
if (tuple .t_data -> t_infomask & HEAP_MOVED_OFF )
1685
1684
{
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 */
1689
1688
Assert (vpc -> vpd_offsets_free > 0 );
1690
1689
for (i = 0 ;i < vpc -> vpd_offsets_free ;i ++ )
1691
1690
{
@@ -1831,9 +1830,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
1831
1830
vacrelstats -> num_tuples ,keep_tuples );
1832
1831
}
1833
1832
1834
- /*
1835
- * clean moved tuples from last page in Nvpl list
1836
- */
1833
+ /* clean moved tuples from last page in Nvpl list */
1837
1834
if (vpc -> vpd_blkno == blkno - 1 && vpc -> vpd_offsets_free > 0 )
1838
1835
{
1839
1836
buf = ReadBuffer (onerel ,vpc -> vpd_blkno );