@ -69,7 +69,7 @@ static void rebuild_relation(Relation OldHeap, Oid indexOid,
static void copy_heap_data ( Oid OIDNewHeap , Oid OIDOldHeap , Oid OIDOldIndex ,
int freeze_min_age , int freeze_table_age , bool verbose ,
bool * pSwapToastByContent , TransactionId * pFreezeXid ,
MultiXactId * pFreeze Multi ) ;
MultiXactId * pCutoff Multi ) ;
static List * get_tables_to_cluster ( MemoryContext cluster_context ) ;
static void reform_and_rewrite_tuple ( HeapTuple tuple ,
TupleDesc oldTupDesc , TupleDesc newTupDesc ,
@ -566,7 +566,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
bool is_system_catalog ;
bool swap_toast_by_content ;
TransactionId frozenXid ;
MultiXactId frozen Multi;
MultiXactId cutoff Multi;
/* Mark the correct index as clustered */
if ( OidIsValid ( indexOid ) )
@ -585,7 +585,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
/* Copy the heap data into the new table in the desired order */
copy_heap_data ( OIDNewHeap , tableOid , indexOid ,
freeze_min_age , freeze_table_age , verbose ,
& swap_toast_by_content , & frozenXid , & frozen Multi) ;
& swap_toast_by_content , & frozenXid , & cutoff Multi) ;
/*
* Swap the physical files of the target and transient tables , then
@ -593,7 +593,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
*/
finish_heap_swap ( tableOid , OIDNewHeap , is_system_catalog ,
swap_toast_by_content , false , true ,
frozenXid , frozen Multi) ;
frozenXid , cutoff Multi) ;
}
@ -736,12 +736,13 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, bool forcetemp,
* There are two output parameters :
* * pSwapToastByContent is set true if toast tables must be swapped by content .
* * pFreezeXid receives the TransactionId used as freeze cutoff point .
* * pCutoffMulti receives the MultiXactId used as a cutoff point .
*/
static void
copy_heap_data ( Oid OIDNewHeap , Oid OIDOldHeap , Oid OIDOldIndex ,
int freeze_min_age , int freeze_table_age , bool verbose ,
bool * pSwapToastByContent , TransactionId * pFreezeXid ,
MultiXactId * pFreeze Multi )
MultiXactId * pCutoff Multi )
{
Relation NewHeap ,
OldHeap ,
@ -757,7 +758,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
bool is_system_catalog ;
TransactionId OldestXmin ;
TransactionId FreezeXid ;
MultiXactId MultiXactFrzLimit ;
MultiXactId MultiXactCutoff ;
RewriteState rwstate ;
bool use_sort ;
Tuplesortstate * tuplesort ;
@ -858,7 +859,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
*/
vacuum_set_xid_limits ( freeze_min_age , freeze_table_age ,
OldHeap - > rd_rel - > relisshared ,
& OldestXmin , & FreezeXid , NULL , & MultiXactFrzLimit ) ;
& OldestXmin , & FreezeXid , NULL , & MultiXactCutoff ) ;
/*
* FreezeXid will become the table ' s new relfrozenxid , and that mustn ' t go
@ -869,14 +870,14 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
/* return selected values to caller */
* pFreezeXid = FreezeXid ;
* pFreezeMulti = MultiXactFrzLimit ;
* pCutoffMulti = MultiXactCutoff ;
/* Remember if it's a system catalog */
is_system_catalog = IsSystemRelation ( OldHeap ) ;
/* Initialize the rewrite operation */
rwstate = begin_heap_rewrite ( NewHeap , OldestXmin , FreezeXid ,
MultiXactFrzLimit , use_wal ) ;
MultiXactCutoff , use_wal ) ;
/*
* Decide whether to use an indexscan or seqscan - and - optional - sort to scan
@ -1135,7 +1136,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
bool swap_toast_by_content ,
bool is_internal ,
TransactionId frozenXid ,
MultiXactId frozen Multi,
MultiXactId cutoff Multi,
Oid * mapped_tables )
{
Relation relRelation ;
@ -1246,8 +1247,8 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
{
Assert ( TransactionIdIsNormal ( frozenXid ) ) ;
relform1 - > relfrozenxid = frozenXid ;
Assert ( MultiXactIdIsValid ( frozen Multi) ) ;
relform1 - > relminmxid = frozen Multi;
Assert ( MultiXactIdIsValid ( cutoff Multi) ) ;
relform1 - > relminmxid = cutoff Multi;
}
/* swap size statistics too, since new rel has freshly-updated stats */
@ -1321,7 +1322,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
swap_toast_by_content ,
is_internal ,
frozenXid ,
frozen Multi,
cutoff Multi,
mapped_tables ) ;
}
else
@ -1464,7 +1465,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
bool check_constraints ,
bool is_internal ,
TransactionId frozenXid ,
MultiXactId frozen Multi)
MultiXactId cutoff Multi)
{
ObjectAddress object ;
Oid mapped_tables [ 4 ] ;
@ -1481,7 +1482,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
swap_relation_files ( OIDOldHeap , OIDNewHeap ,
( OIDOldHeap = = RelationRelationId ) ,
swap_toast_by_content , is_internal ,
frozenXid , frozen Multi, mapped_tables ) ;
frozenXid , cutoff Multi, mapped_tables ) ;
/*
* If it ' s a system catalog , queue an sinval message to flush all