mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Rename various "freeze multixact" variables
It seems to make more sense to use "cutoff multixact" terminology throughout the backend code; "freeze" is associated with replacing of an Xid with FrozenTransactionId, which is not what we do for MultiXactIds. Andres Freund Some adjustments by Álvaro Herrera
This commit is contained in:
@@ -68,7 +68,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 *pFreezeMulti);
|
||||
MultiXactId *pCutoffMulti);
|
||||
static List *get_tables_to_cluster(MemoryContext cluster_context);
|
||||
static void reform_and_rewrite_tuple(HeapTuple tuple,
|
||||
TupleDesc oldTupDesc, TupleDesc newTupDesc,
|
||||
@@ -570,7 +570,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
|
||||
bool is_system_catalog;
|
||||
bool swap_toast_by_content;
|
||||
TransactionId frozenXid;
|
||||
MultiXactId frozenMulti;
|
||||
MultiXactId cutoffMulti;
|
||||
|
||||
/* Mark the correct index as clustered */
|
||||
if (OidIsValid(indexOid))
|
||||
@@ -588,7 +588,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, &frozenMulti);
|
||||
&swap_toast_by_content, &frozenXid, &cutoffMulti);
|
||||
|
||||
/*
|
||||
* Swap the physical files of the target and transient tables, then
|
||||
@@ -596,7 +596,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
|
||||
*/
|
||||
finish_heap_swap(tableOid, OIDNewHeap, is_system_catalog,
|
||||
swap_toast_by_content, false, true,
|
||||
frozenXid, frozenMulti);
|
||||
frozenXid, cutoffMulti);
|
||||
}
|
||||
|
||||
|
||||
@@ -725,12 +725,13 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
|
||||
* 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 *pFreezeMulti)
|
||||
MultiXactId *pCutoffMulti)
|
||||
{
|
||||
Relation NewHeap,
|
||||
OldHeap,
|
||||
@@ -746,7 +747,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;
|
||||
@@ -847,7 +848,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
|
||||
@@ -858,14 +859,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
|
||||
@@ -1124,7 +1125,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
||||
bool swap_toast_by_content,
|
||||
bool is_internal,
|
||||
TransactionId frozenXid,
|
||||
MultiXactId frozenMulti,
|
||||
MultiXactId cutoffMulti,
|
||||
Oid *mapped_tables)
|
||||
{
|
||||
Relation relRelation;
|
||||
@@ -1237,8 +1238,8 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
||||
{
|
||||
Assert(TransactionIdIsNormal(frozenXid));
|
||||
relform1->relfrozenxid = frozenXid;
|
||||
Assert(MultiXactIdIsValid(frozenMulti));
|
||||
relform1->relminmxid = frozenMulti;
|
||||
Assert(MultiXactIdIsValid(cutoffMulti));
|
||||
relform1->relminmxid = cutoffMulti;
|
||||
}
|
||||
|
||||
/* swap size statistics too, since new rel has freshly-updated stats */
|
||||
@@ -1312,7 +1313,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
||||
swap_toast_by_content,
|
||||
is_internal,
|
||||
frozenXid,
|
||||
frozenMulti,
|
||||
cutoffMulti,
|
||||
mapped_tables);
|
||||
}
|
||||
else
|
||||
@@ -1443,7 +1444,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
||||
bool check_constraints,
|
||||
bool is_internal,
|
||||
TransactionId frozenXid,
|
||||
MultiXactId frozenMulti)
|
||||
MultiXactId cutoffMulti)
|
||||
{
|
||||
ObjectAddress object;
|
||||
Oid mapped_tables[4];
|
||||
@@ -1460,7 +1461,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
||||
swap_relation_files(OIDOldHeap, OIDNewHeap,
|
||||
(OIDOldHeap == RelationRelationId),
|
||||
swap_toast_by_content, is_internal,
|
||||
frozenXid, frozenMulti, mapped_tables);
|
||||
frozenXid, cutoffMulti, mapped_tables);
|
||||
|
||||
/*
|
||||
* If it's a system catalog, queue an sinval message to flush all
|
||||
|
@@ -1691,7 +1691,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
|
||||
/* limit of frozen XIDs */
|
||||
if (dbFrozenXidP)
|
||||
*dbFrozenXidP = dbform->datfrozenxid;
|
||||
/* limit of frozen Multixacts */
|
||||
/* minimum MultixactId */
|
||||
if (dbMinMultiP)
|
||||
*dbMinMultiP = dbform->datminmxid;
|
||||
/* default tablespace for this database */
|
||||
|
@@ -64,7 +64,7 @@ static BufferAccessStrategy vac_strategy;
|
||||
|
||||
/* non-export function prototypes */
|
||||
static List *get_rel_oids(Oid relid, const RangeVar *vacrel);
|
||||
static void vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti);
|
||||
static void vac_truncate_clog(TransactionId frozenXID, MultiXactId minMulti);
|
||||
static bool vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast,
|
||||
bool for_wraparound);
|
||||
|
||||
@@ -384,7 +384,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
||||
TransactionId *oldestXmin,
|
||||
TransactionId *freezeLimit,
|
||||
TransactionId *freezeTableLimit,
|
||||
MultiXactId *multiXactFrzLimit)
|
||||
MultiXactId *multiXactCutoff)
|
||||
{
|
||||
int freezemin;
|
||||
TransactionId limit;
|
||||
@@ -469,7 +469,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
||||
*freezeTableLimit = limit;
|
||||
}
|
||||
|
||||
if (multiXactFrzLimit != NULL)
|
||||
if (multiXactCutoff != NULL)
|
||||
{
|
||||
MultiXactId mxLimit;
|
||||
|
||||
@@ -481,7 +481,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
||||
if (mxLimit < FirstMultiXactId)
|
||||
mxLimit = FirstMultiXactId;
|
||||
|
||||
*multiXactFrzLimit = mxLimit;
|
||||
*multiXactCutoff = mxLimit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,8 +690,8 @@ vac_update_relstats(Relation relation,
|
||||
* Update pg_database's datfrozenxid entry for our database to be the
|
||||
* minimum of the pg_class.relfrozenxid values.
|
||||
*
|
||||
* Similarly, update our datfrozenmulti to be the minimum of the
|
||||
* pg_class.relfrozenmulti values.
|
||||
* Similarly, update our datminmxid to be the minimum of the
|
||||
* pg_class.relminmxid values.
|
||||
*
|
||||
* If we are able to advance either pg_database value, also try to
|
||||
* truncate pg_clog and pg_multixact.
|
||||
@@ -711,7 +711,7 @@ vac_update_datfrozenxid(void)
|
||||
SysScanDesc scan;
|
||||
HeapTuple classTup;
|
||||
TransactionId newFrozenXid;
|
||||
MultiXactId newFrozenMulti;
|
||||
MultiXactId newMinMulti;
|
||||
bool dirty = false;
|
||||
|
||||
/*
|
||||
@@ -726,7 +726,7 @@ vac_update_datfrozenxid(void)
|
||||
* Similarly, initialize the MultiXact "min" with the value that would be
|
||||
* used on pg_class for new tables. See AddNewRelationTuple().
|
||||
*/
|
||||
newFrozenMulti = GetOldestMultiXactId();
|
||||
newMinMulti = GetOldestMultiXactId();
|
||||
|
||||
/*
|
||||
* We must seqscan pg_class to find the minimum Xid, because there is no
|
||||
@@ -756,8 +756,8 @@ vac_update_datfrozenxid(void)
|
||||
if (TransactionIdPrecedes(classForm->relfrozenxid, newFrozenXid))
|
||||
newFrozenXid = classForm->relfrozenxid;
|
||||
|
||||
if (MultiXactIdPrecedes(classForm->relminmxid, newFrozenMulti))
|
||||
newFrozenMulti = classForm->relminmxid;
|
||||
if (MultiXactIdPrecedes(classForm->relminmxid, newMinMulti))
|
||||
newMinMulti = classForm->relminmxid;
|
||||
}
|
||||
|
||||
/* we're done with pg_class */
|
||||
@@ -765,7 +765,7 @@ vac_update_datfrozenxid(void)
|
||||
heap_close(relation, AccessShareLock);
|
||||
|
||||
Assert(TransactionIdIsNormal(newFrozenXid));
|
||||
Assert(MultiXactIdIsValid(newFrozenMulti));
|
||||
Assert(MultiXactIdIsValid(newMinMulti));
|
||||
|
||||
/* Now fetch the pg_database tuple we need to update. */
|
||||
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
|
||||
@@ -787,9 +787,9 @@ vac_update_datfrozenxid(void)
|
||||
}
|
||||
|
||||
/* ditto */
|
||||
if (MultiXactIdPrecedes(dbform->datminmxid, newFrozenMulti))
|
||||
if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti))
|
||||
{
|
||||
dbform->datminmxid = newFrozenMulti;
|
||||
dbform->datminmxid = newMinMulti;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ vac_update_datfrozenxid(void)
|
||||
* this action will update that too.
|
||||
*/
|
||||
if (dirty || ForceTransactionIdLimitUpdate())
|
||||
vac_truncate_clog(newFrozenXid, newFrozenMulti);
|
||||
vac_truncate_clog(newFrozenXid, newMinMulti);
|
||||
}
|
||||
|
||||
|
||||
@@ -824,19 +824,19 @@ vac_update_datfrozenxid(void)
|
||||
* info is stale.
|
||||
*/
|
||||
static void
|
||||
vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
||||
vac_truncate_clog(TransactionId frozenXID, MultiXactId minMulti)
|
||||
{
|
||||
TransactionId myXID = GetCurrentTransactionId();
|
||||
Relation relation;
|
||||
HeapScanDesc scan;
|
||||
HeapTuple tuple;
|
||||
Oid oldestxid_datoid;
|
||||
Oid oldestmulti_datoid;
|
||||
Oid minmulti_datoid;
|
||||
bool frozenAlreadyWrapped = false;
|
||||
|
||||
/* init oldest datoids to sync with my frozen values */
|
||||
oldestxid_datoid = MyDatabaseId;
|
||||
oldestmulti_datoid = MyDatabaseId;
|
||||
minmulti_datoid = MyDatabaseId;
|
||||
|
||||
/*
|
||||
* Scan pg_database to compute the minimum datfrozenxid
|
||||
@@ -869,10 +869,10 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
||||
oldestxid_datoid = HeapTupleGetOid(tuple);
|
||||
}
|
||||
|
||||
if (MultiXactIdPrecedes(dbform->datminmxid, frozenMulti))
|
||||
if (MultiXactIdPrecedes(dbform->datminmxid, minMulti))
|
||||
{
|
||||
frozenMulti = dbform->datminmxid;
|
||||
oldestmulti_datoid = HeapTupleGetOid(tuple);
|
||||
minMulti = dbform->datminmxid;
|
||||
minmulti_datoid = HeapTupleGetOid(tuple);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
||||
|
||||
/* Truncate CLOG and Multi to the oldest computed value */
|
||||
TruncateCLOG(frozenXID);
|
||||
TruncateMultiXact(frozenMulti);
|
||||
TruncateMultiXact(minMulti);
|
||||
|
||||
/*
|
||||
* Update the wrap limit for GetNewTransactionId and creation of new
|
||||
@@ -905,7 +905,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
||||
* signalling twice?
|
||||
*/
|
||||
SetTransactionIdLimit(frozenXID, oldestxid_datoid);
|
||||
MultiXactAdvanceOldest(frozenMulti, oldestmulti_datoid);
|
||||
MultiXactAdvanceOldest(minMulti, minmulti_datoid);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -125,7 +125,7 @@ static int elevel = -1;
|
||||
|
||||
static TransactionId OldestXmin;
|
||||
static TransactionId FreezeLimit;
|
||||
static MultiXactId MultiXactFrzLimit;
|
||||
static MultiXactId MultiXactCutoff;
|
||||
|
||||
static BufferAccessStrategy vac_strategy;
|
||||
|
||||
@@ -203,7 +203,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
|
||||
vacuum_set_xid_limits(vacstmt->freeze_min_age, vacstmt->freeze_table_age,
|
||||
onerel->rd_rel->relisshared,
|
||||
&OldestXmin, &FreezeLimit, &freezeTableLimit,
|
||||
&MultiXactFrzLimit);
|
||||
&MultiXactCutoff);
|
||||
scan_all = TransactionIdPrecedesOrEquals(onerel->rd_rel->relfrozenxid,
|
||||
freezeTableLimit);
|
||||
|
||||
@@ -273,7 +273,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
|
||||
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
||||
new_frozen_xid = InvalidTransactionId;
|
||||
|
||||
new_min_multi = MultiXactFrzLimit;
|
||||
new_min_multi = MultiXactCutoff;
|
||||
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
||||
new_min_multi = InvalidMultiXactId;
|
||||
|
||||
@@ -867,7 +867,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
||||
* freezing. Note we already have exclusive buffer lock.
|
||||
*/
|
||||
if (heap_freeze_tuple(tuple.t_data, FreezeLimit,
|
||||
MultiXactFrzLimit))
|
||||
MultiXactCutoff))
|
||||
frozen[nfrozen++] = offnum;
|
||||
}
|
||||
} /* scan along page */
|
||||
@@ -885,7 +885,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
||||
XLogRecPtr recptr;
|
||||
|
||||
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
|
||||
MultiXactFrzLimit, frozen, nfrozen);
|
||||
MultiXactCutoff, frozen, nfrozen);
|
||||
PageSetLSN(page, recptr);
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1230,7 @@ lazy_check_needs_freeze(Buffer buf)
|
||||
tupleheader = (HeapTupleHeader) PageGetItem(page, itemid);
|
||||
|
||||
if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
|
||||
MultiXactFrzLimit, buf))
|
||||
MultiXactCutoff, buf))
|
||||
return true;
|
||||
} /* scan along page */
|
||||
|
||||
|
Reference in New Issue
Block a user