@ -13,7 +13,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $ PostgreSQL : pgsql / src / backend / commands / vacuum . c , v 1.376 2008 / 08 / 13 00 : 07 : 50 alvherre Exp $
* $ PostgreSQL : pgsql / src / backend / commands / vacuum . c , v 1.377 2008 / 09 / 11 14 : 01 : 09 alvherre Exp $
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
*/
@ -790,14 +790,12 @@ vac_update_datfrozenxid(void)
bool dirty = false ;
bool dirty = false ;
/*
/*
* Initialize the " min " calculation with RecentGlobalXmin . Any
* Initialize the " min " calculation with GetOldestXmin , which is a
* not - yet - committed pg_class entries for new tables must have
* reasonable approximation to the minimum relfrozenxid for not - yet -
* relfrozenxid at least this high , because any other open xact must have
* committed pg_class entries for new tables ; see AddNewRelationTuple ( ) .
* RecentXmin > = its PGPROC . xmin > = our RecentGlobalXmin ; see
* Se we cannot produce a wrong minimum by starting with this .
* AddNewRelationTuple ( ) . So we cannot produce a wrong minimum by
* starting with this .
*/
*/
newFrozenXid = RecentGlobalXmin ;
newFrozenXid = GetOldestXmin ( true , true ) ;
/*
/*
* We must seqscan pg_class to find the minimum Xid , because there is no
* We must seqscan pg_class to find the minimum Xid , because there is no
@ -990,18 +988,16 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
/* Begin a transaction for vacuuming this relation */
/* Begin a transaction for vacuuming this relation */
StartTransactionCommand ( ) ;
StartTransactionCommand ( ) ;
if ( vacstmt - > full )
/*
{
* Functions in indexes may want a snapshot set . Also , setting
/* functions in indexes may want a snapshot set */
* a snapshot ensures that RecentGlobalXmin is kept truly recent .
PushActiveSnapshot ( GetTransactionSnapshot ( ) ) ;
*/
}
PushActiveSnapshot ( GetTransactionSnapshot ( ) ) ;
else
if ( ! vacstmt - > full )
{
{
/*
/*
* During a lazy VACUUM we do not run any user - supplied functions , and
* In lazy vacuum , we can set the PROC_IN_VACUUM flag , which lets other
* so it should be safe to not create a transaction snapshot .
*
* We can furthermore set the PROC_IN_VACUUM flag , which lets other
* concurrent VACUUMs know that they can ignore this one while
* concurrent VACUUMs know that they can ignore this one while
* determining their OldestXmin . ( The reason we don ' t set it during a
* determining their OldestXmin . ( The reason we don ' t set it during a
* full VACUUM is exactly that we may have to run user - defined
* full VACUUM is exactly that we may have to run user - defined
@ -1050,8 +1046,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
if ( ! onerel )
if ( ! onerel )
{
{
if ( vacstmt - > full )
PopActiveSnapshot ( ) ;
PopActiveSnapshot ( ) ;
CommitTransactionCommand ( ) ;
CommitTransactionCommand ( ) ;
return ;
return ;
}
}
@ -1082,8 +1077,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
( errmsg ( " skipping \" %s \" --- only table or database owner can vacuum it " ,
( errmsg ( " skipping \" %s \" --- only table or database owner can vacuum it " ,
RelationGetRelationName ( onerel ) ) ) ) ;
RelationGetRelationName ( onerel ) ) ) ) ;
relation_close ( onerel , lmode ) ;
relation_close ( onerel , lmode ) ;
if ( vacstmt - > full )
PopActiveSnapshot ( ) ;
PopActiveSnapshot ( ) ;
CommitTransactionCommand ( ) ;
CommitTransactionCommand ( ) ;
return ;
return ;
}
}
@ -1099,8 +1093,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
( errmsg ( " skipping \" %s \" --- cannot vacuum indexes, views, or special system tables " ,
( errmsg ( " skipping \" %s \" --- cannot vacuum indexes, views, or special system tables " ,
RelationGetRelationName ( onerel ) ) ) ) ;
RelationGetRelationName ( onerel ) ) ) ) ;
relation_close ( onerel , lmode ) ;
relation_close ( onerel , lmode ) ;
if ( vacstmt - > full )
PopActiveSnapshot ( ) ;
PopActiveSnapshot ( ) ;
CommitTransactionCommand ( ) ;
CommitTransactionCommand ( ) ;
return ;
return ;
}
}
@ -1115,8 +1108,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
if ( isOtherTempNamespace ( RelationGetNamespace ( onerel ) ) )
if ( isOtherTempNamespace ( RelationGetNamespace ( onerel ) ) )
{
{
relation_close ( onerel , lmode ) ;
relation_close ( onerel , lmode ) ;
if ( vacstmt - > full )
PopActiveSnapshot ( ) ;
PopActiveSnapshot ( ) ;
CommitTransactionCommand ( ) ;
CommitTransactionCommand ( ) ;
return ;
return ;
}
}
@ -1168,8 +1160,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
/*
/*
* Complete the transaction and free all temporary memory used .
* Complete the transaction and free all temporary memory used .
*/
*/
if ( vacstmt - > full )
PopActiveSnapshot ( ) ;
PopActiveSnapshot ( ) ;
CommitTransactionCommand ( ) ;
CommitTransactionCommand ( ) ;
/*
/*