mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +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:
parent
374652fb6d
commit
3451faaec8
@ -5118,8 +5118,8 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that this code handles IS_MULTI Xmax values, too, but only to mark
|
* Note that this code handles IS_MULTI Xmax values, too, but only to mark
|
||||||
* the tuple frozen if the updating Xid in the mxact is below the freeze
|
* the tuple as not updated if the multixact is below the cutoff Multixact
|
||||||
* cutoff; it doesn't remove dead members of a very old multixact.
|
* given; it doesn't remove dead members of a very old multixact.
|
||||||
*/
|
*/
|
||||||
xid = HeapTupleHeaderGetRawXmax(tuple);
|
xid = HeapTupleHeaderGetRawXmax(tuple);
|
||||||
if ((tuple->t_infomask & HEAP_XMAX_IS_MULTI) ?
|
if ((tuple->t_infomask & HEAP_XMAX_IS_MULTI) ?
|
||||||
|
@ -129,8 +129,8 @@ typedef struct RewriteStateData
|
|||||||
* determine tuple visibility */
|
* determine tuple visibility */
|
||||||
TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff
|
TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff
|
||||||
* point */
|
* point */
|
||||||
MultiXactId rs_freeze_multi;/* MultiXactId that will be used as freeze
|
MultiXactId rs_cutoff_multi;/* MultiXactId that will be used as cutoff
|
||||||
* cutoff point for multixacts */
|
* point for multixacts */
|
||||||
MemoryContext rs_cxt; /* for hash tables and entries and tuples in
|
MemoryContext rs_cxt; /* for hash tables and entries and tuples in
|
||||||
* them */
|
* them */
|
||||||
HTAB *rs_unresolved_tups; /* unmatched A tuples */
|
HTAB *rs_unresolved_tups; /* unmatched A tuples */
|
||||||
@ -180,7 +180,7 @@ static void raw_heap_insert(RewriteState state, HeapTuple tup);
|
|||||||
* new_heap new, locked heap relation to insert tuples to
|
* new_heap new, locked heap relation to insert tuples to
|
||||||
* oldest_xmin xid used by the caller to determine which tuples are dead
|
* oldest_xmin xid used by the caller to determine which tuples are dead
|
||||||
* freeze_xid xid before which tuples will be frozen
|
* freeze_xid xid before which tuples will be frozen
|
||||||
* freeze_multi multixact before which multis will be frozen
|
* min_multi multixact before which multis will be removed
|
||||||
* use_wal should the inserts to the new heap be WAL-logged?
|
* use_wal should the inserts to the new heap be WAL-logged?
|
||||||
*
|
*
|
||||||
* Returns an opaque RewriteState, allocated in current memory context,
|
* Returns an opaque RewriteState, allocated in current memory context,
|
||||||
@ -188,7 +188,7 @@ static void raw_heap_insert(RewriteState state, HeapTuple tup);
|
|||||||
*/
|
*/
|
||||||
RewriteState
|
RewriteState
|
||||||
begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
|
begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
|
||||||
TransactionId freeze_xid, MultiXactId freeze_multi,
|
TransactionId freeze_xid, MultiXactId cutoff_multi,
|
||||||
bool use_wal)
|
bool use_wal)
|
||||||
{
|
{
|
||||||
RewriteState state;
|
RewriteState state;
|
||||||
@ -218,7 +218,7 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
|
|||||||
state->rs_use_wal = use_wal;
|
state->rs_use_wal = use_wal;
|
||||||
state->rs_oldest_xmin = oldest_xmin;
|
state->rs_oldest_xmin = oldest_xmin;
|
||||||
state->rs_freeze_xid = freeze_xid;
|
state->rs_freeze_xid = freeze_xid;
|
||||||
state->rs_freeze_multi = freeze_multi;
|
state->rs_cutoff_multi = cutoff_multi;
|
||||||
state->rs_cxt = rw_cxt;
|
state->rs_cxt = rw_cxt;
|
||||||
|
|
||||||
/* Initialize hash tables used to track update chains */
|
/* Initialize hash tables used to track update chains */
|
||||||
@ -347,7 +347,7 @@ rewrite_heap_tuple(RewriteState state,
|
|||||||
* very-old xmin or xmax, so that future VACUUM effort can be saved.
|
* very-old xmin or xmax, so that future VACUUM effort can be saved.
|
||||||
*/
|
*/
|
||||||
heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid,
|
heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid,
|
||||||
state->rs_freeze_multi);
|
state->rs_cutoff_multi);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invalid ctid means that ctid should point to the tuple itself. We'll
|
* Invalid ctid means that ctid should point to the tuple itself. We'll
|
||||||
|
@ -1069,7 +1069,7 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
|
|||||||
* We check known limits on MultiXact before resorting to the SLRU area.
|
* We check known limits on MultiXact before resorting to the SLRU area.
|
||||||
*
|
*
|
||||||
* An ID older than MultiXactState->oldestMultiXactId cannot possibly be
|
* An ID older than MultiXactState->oldestMultiXactId cannot possibly be
|
||||||
* useful; it should have already been frozen by vacuum. We've truncated
|
* useful; it should have already been removed by vacuum. We've truncated
|
||||||
* the on-disk structures anyway. Returning the wrong values could lead
|
* the on-disk structures anyway. Returning the wrong values could lead
|
||||||
* to an incorrect visibility result. However, to support pg_upgrade we
|
* to an incorrect visibility result. However, to support pg_upgrade we
|
||||||
* need to allow an empty set to be returned regardless, if the caller is
|
* need to allow an empty set to be returned regardless, if the caller is
|
||||||
|
@ -68,7 +68,7 @@ static void rebuild_relation(Relation OldHeap, Oid indexOid,
|
|||||||
static void copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
static void copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||||
int freeze_min_age, int freeze_table_age, bool verbose,
|
int freeze_min_age, int freeze_table_age, bool verbose,
|
||||||
bool *pSwapToastByContent, TransactionId *pFreezeXid,
|
bool *pSwapToastByContent, TransactionId *pFreezeXid,
|
||||||
MultiXactId *pFreezeMulti);
|
MultiXactId *pCutoffMulti);
|
||||||
static List *get_tables_to_cluster(MemoryContext cluster_context);
|
static List *get_tables_to_cluster(MemoryContext cluster_context);
|
||||||
static void reform_and_rewrite_tuple(HeapTuple tuple,
|
static void reform_and_rewrite_tuple(HeapTuple tuple,
|
||||||
TupleDesc oldTupDesc, TupleDesc newTupDesc,
|
TupleDesc oldTupDesc, TupleDesc newTupDesc,
|
||||||
@ -570,7 +570,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
|
|||||||
bool is_system_catalog;
|
bool is_system_catalog;
|
||||||
bool swap_toast_by_content;
|
bool swap_toast_by_content;
|
||||||
TransactionId frozenXid;
|
TransactionId frozenXid;
|
||||||
MultiXactId frozenMulti;
|
MultiXactId cutoffMulti;
|
||||||
|
|
||||||
/* Mark the correct index as clustered */
|
/* Mark the correct index as clustered */
|
||||||
if (OidIsValid(indexOid))
|
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 the heap data into the new table in the desired order */
|
||||||
copy_heap_data(OIDNewHeap, tableOid, indexOid,
|
copy_heap_data(OIDNewHeap, tableOid, indexOid,
|
||||||
freeze_min_age, freeze_table_age, verbose,
|
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
|
* 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,
|
finish_heap_swap(tableOid, OIDNewHeap, is_system_catalog,
|
||||||
swap_toast_by_content, false, true,
|
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:
|
* There are two output parameters:
|
||||||
* *pSwapToastByContent is set true if toast tables must be swapped by content.
|
* *pSwapToastByContent is set true if toast tables must be swapped by content.
|
||||||
* *pFreezeXid receives the TransactionId used as freeze cutoff point.
|
* *pFreezeXid receives the TransactionId used as freeze cutoff point.
|
||||||
|
* *pCutoffMulti receives the MultiXactId used as a cutoff point.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||||
int freeze_min_age, int freeze_table_age, bool verbose,
|
int freeze_min_age, int freeze_table_age, bool verbose,
|
||||||
bool *pSwapToastByContent, TransactionId *pFreezeXid,
|
bool *pSwapToastByContent, TransactionId *pFreezeXid,
|
||||||
MultiXactId *pFreezeMulti)
|
MultiXactId *pCutoffMulti)
|
||||||
{
|
{
|
||||||
Relation NewHeap,
|
Relation NewHeap,
|
||||||
OldHeap,
|
OldHeap,
|
||||||
@ -746,7 +747,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
|||||||
bool is_system_catalog;
|
bool is_system_catalog;
|
||||||
TransactionId OldestXmin;
|
TransactionId OldestXmin;
|
||||||
TransactionId FreezeXid;
|
TransactionId FreezeXid;
|
||||||
MultiXactId MultiXactFrzLimit;
|
MultiXactId MultiXactCutoff;
|
||||||
RewriteState rwstate;
|
RewriteState rwstate;
|
||||||
bool use_sort;
|
bool use_sort;
|
||||||
Tuplesortstate *tuplesort;
|
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,
|
vacuum_set_xid_limits(freeze_min_age, freeze_table_age,
|
||||||
OldHeap->rd_rel->relisshared,
|
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
|
* 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 */
|
/* return selected values to caller */
|
||||||
*pFreezeXid = FreezeXid;
|
*pFreezeXid = FreezeXid;
|
||||||
*pFreezeMulti = MultiXactFrzLimit;
|
*pCutoffMulti = MultiXactCutoff;
|
||||||
|
|
||||||
/* Remember if it's a system catalog */
|
/* Remember if it's a system catalog */
|
||||||
is_system_catalog = IsSystemRelation(OldHeap);
|
is_system_catalog = IsSystemRelation(OldHeap);
|
||||||
|
|
||||||
/* Initialize the rewrite operation */
|
/* Initialize the rewrite operation */
|
||||||
rwstate = begin_heap_rewrite(NewHeap, OldestXmin, FreezeXid,
|
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
|
* 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 swap_toast_by_content,
|
||||||
bool is_internal,
|
bool is_internal,
|
||||||
TransactionId frozenXid,
|
TransactionId frozenXid,
|
||||||
MultiXactId frozenMulti,
|
MultiXactId cutoffMulti,
|
||||||
Oid *mapped_tables)
|
Oid *mapped_tables)
|
||||||
{
|
{
|
||||||
Relation relRelation;
|
Relation relRelation;
|
||||||
@ -1237,8 +1238,8 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
|||||||
{
|
{
|
||||||
Assert(TransactionIdIsNormal(frozenXid));
|
Assert(TransactionIdIsNormal(frozenXid));
|
||||||
relform1->relfrozenxid = frozenXid;
|
relform1->relfrozenxid = frozenXid;
|
||||||
Assert(MultiXactIdIsValid(frozenMulti));
|
Assert(MultiXactIdIsValid(cutoffMulti));
|
||||||
relform1->relminmxid = frozenMulti;
|
relform1->relminmxid = cutoffMulti;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* swap size statistics too, since new rel has freshly-updated stats */
|
/* 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,
|
swap_toast_by_content,
|
||||||
is_internal,
|
is_internal,
|
||||||
frozenXid,
|
frozenXid,
|
||||||
frozenMulti,
|
cutoffMulti,
|
||||||
mapped_tables);
|
mapped_tables);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1443,7 +1444,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
|||||||
bool check_constraints,
|
bool check_constraints,
|
||||||
bool is_internal,
|
bool is_internal,
|
||||||
TransactionId frozenXid,
|
TransactionId frozenXid,
|
||||||
MultiXactId frozenMulti)
|
MultiXactId cutoffMulti)
|
||||||
{
|
{
|
||||||
ObjectAddress object;
|
ObjectAddress object;
|
||||||
Oid mapped_tables[4];
|
Oid mapped_tables[4];
|
||||||
@ -1460,7 +1461,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
|||||||
swap_relation_files(OIDOldHeap, OIDNewHeap,
|
swap_relation_files(OIDOldHeap, OIDNewHeap,
|
||||||
(OIDOldHeap == RelationRelationId),
|
(OIDOldHeap == RelationRelationId),
|
||||||
swap_toast_by_content, is_internal,
|
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
|
* 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 */
|
/* limit of frozen XIDs */
|
||||||
if (dbFrozenXidP)
|
if (dbFrozenXidP)
|
||||||
*dbFrozenXidP = dbform->datfrozenxid;
|
*dbFrozenXidP = dbform->datfrozenxid;
|
||||||
/* limit of frozen Multixacts */
|
/* minimum MultixactId */
|
||||||
if (dbMinMultiP)
|
if (dbMinMultiP)
|
||||||
*dbMinMultiP = dbform->datminmxid;
|
*dbMinMultiP = dbform->datminmxid;
|
||||||
/* default tablespace for this database */
|
/* default tablespace for this database */
|
||||||
|
@ -64,7 +64,7 @@ static BufferAccessStrategy vac_strategy;
|
|||||||
|
|
||||||
/* non-export function prototypes */
|
/* non-export function prototypes */
|
||||||
static List *get_rel_oids(Oid relid, const RangeVar *vacrel);
|
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,
|
static bool vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast,
|
||||||
bool for_wraparound);
|
bool for_wraparound);
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
|||||||
TransactionId *oldestXmin,
|
TransactionId *oldestXmin,
|
||||||
TransactionId *freezeLimit,
|
TransactionId *freezeLimit,
|
||||||
TransactionId *freezeTableLimit,
|
TransactionId *freezeTableLimit,
|
||||||
MultiXactId *multiXactFrzLimit)
|
MultiXactId *multiXactCutoff)
|
||||||
{
|
{
|
||||||
int freezemin;
|
int freezemin;
|
||||||
TransactionId limit;
|
TransactionId limit;
|
||||||
@ -469,7 +469,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
|||||||
*freezeTableLimit = limit;
|
*freezeTableLimit = limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiXactFrzLimit != NULL)
|
if (multiXactCutoff != NULL)
|
||||||
{
|
{
|
||||||
MultiXactId mxLimit;
|
MultiXactId mxLimit;
|
||||||
|
|
||||||
@ -481,7 +481,7 @@ vacuum_set_xid_limits(int freeze_min_age,
|
|||||||
if (mxLimit < FirstMultiXactId)
|
if (mxLimit < FirstMultiXactId)
|
||||||
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
|
* Update pg_database's datfrozenxid entry for our database to be the
|
||||||
* minimum of the pg_class.relfrozenxid values.
|
* minimum of the pg_class.relfrozenxid values.
|
||||||
*
|
*
|
||||||
* Similarly, update our datfrozenmulti to be the minimum of the
|
* Similarly, update our datminmxid to be the minimum of the
|
||||||
* pg_class.relfrozenmulti values.
|
* pg_class.relminmxid values.
|
||||||
*
|
*
|
||||||
* If we are able to advance either pg_database value, also try to
|
* If we are able to advance either pg_database value, also try to
|
||||||
* truncate pg_clog and pg_multixact.
|
* truncate pg_clog and pg_multixact.
|
||||||
@ -711,7 +711,7 @@ vac_update_datfrozenxid(void)
|
|||||||
SysScanDesc scan;
|
SysScanDesc scan;
|
||||||
HeapTuple classTup;
|
HeapTuple classTup;
|
||||||
TransactionId newFrozenXid;
|
TransactionId newFrozenXid;
|
||||||
MultiXactId newFrozenMulti;
|
MultiXactId newMinMulti;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -726,7 +726,7 @@ vac_update_datfrozenxid(void)
|
|||||||
* Similarly, initialize the MultiXact "min" with the value that would be
|
* Similarly, initialize the MultiXact "min" with the value that would be
|
||||||
* used on pg_class for new tables. See AddNewRelationTuple().
|
* 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
|
* 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))
|
if (TransactionIdPrecedes(classForm->relfrozenxid, newFrozenXid))
|
||||||
newFrozenXid = classForm->relfrozenxid;
|
newFrozenXid = classForm->relfrozenxid;
|
||||||
|
|
||||||
if (MultiXactIdPrecedes(classForm->relminmxid, newFrozenMulti))
|
if (MultiXactIdPrecedes(classForm->relminmxid, newMinMulti))
|
||||||
newFrozenMulti = classForm->relminmxid;
|
newMinMulti = classForm->relminmxid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we're done with pg_class */
|
/* we're done with pg_class */
|
||||||
@ -765,7 +765,7 @@ vac_update_datfrozenxid(void)
|
|||||||
heap_close(relation, AccessShareLock);
|
heap_close(relation, AccessShareLock);
|
||||||
|
|
||||||
Assert(TransactionIdIsNormal(newFrozenXid));
|
Assert(TransactionIdIsNormal(newFrozenXid));
|
||||||
Assert(MultiXactIdIsValid(newFrozenMulti));
|
Assert(MultiXactIdIsValid(newMinMulti));
|
||||||
|
|
||||||
/* Now fetch the pg_database tuple we need to update. */
|
/* Now fetch the pg_database tuple we need to update. */
|
||||||
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
|
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
|
||||||
@ -787,9 +787,9 @@ vac_update_datfrozenxid(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ditto */
|
/* ditto */
|
||||||
if (MultiXactIdPrecedes(dbform->datminmxid, newFrozenMulti))
|
if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti))
|
||||||
{
|
{
|
||||||
dbform->datminmxid = newFrozenMulti;
|
dbform->datminmxid = newMinMulti;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +805,7 @@ vac_update_datfrozenxid(void)
|
|||||||
* this action will update that too.
|
* this action will update that too.
|
||||||
*/
|
*/
|
||||||
if (dirty || ForceTransactionIdLimitUpdate())
|
if (dirty || ForceTransactionIdLimitUpdate())
|
||||||
vac_truncate_clog(newFrozenXid, newFrozenMulti);
|
vac_truncate_clog(newFrozenXid, newMinMulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -824,19 +824,19 @@ vac_update_datfrozenxid(void)
|
|||||||
* info is stale.
|
* info is stale.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
vac_truncate_clog(TransactionId frozenXID, MultiXactId minMulti)
|
||||||
{
|
{
|
||||||
TransactionId myXID = GetCurrentTransactionId();
|
TransactionId myXID = GetCurrentTransactionId();
|
||||||
Relation relation;
|
Relation relation;
|
||||||
HeapScanDesc scan;
|
HeapScanDesc scan;
|
||||||
HeapTuple tuple;
|
HeapTuple tuple;
|
||||||
Oid oldestxid_datoid;
|
Oid oldestxid_datoid;
|
||||||
Oid oldestmulti_datoid;
|
Oid minmulti_datoid;
|
||||||
bool frozenAlreadyWrapped = false;
|
bool frozenAlreadyWrapped = false;
|
||||||
|
|
||||||
/* init oldest datoids to sync with my frozen values */
|
/* init oldest datoids to sync with my frozen values */
|
||||||
oldestxid_datoid = MyDatabaseId;
|
oldestxid_datoid = MyDatabaseId;
|
||||||
oldestmulti_datoid = MyDatabaseId;
|
minmulti_datoid = MyDatabaseId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan pg_database to compute the minimum datfrozenxid
|
* Scan pg_database to compute the minimum datfrozenxid
|
||||||
@ -869,10 +869,10 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
|||||||
oldestxid_datoid = HeapTupleGetOid(tuple);
|
oldestxid_datoid = HeapTupleGetOid(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MultiXactIdPrecedes(dbform->datminmxid, frozenMulti))
|
if (MultiXactIdPrecedes(dbform->datminmxid, minMulti))
|
||||||
{
|
{
|
||||||
frozenMulti = dbform->datminmxid;
|
minMulti = dbform->datminmxid;
|
||||||
oldestmulti_datoid = HeapTupleGetOid(tuple);
|
minmulti_datoid = HeapTupleGetOid(tuple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,7 +896,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
|||||||
|
|
||||||
/* Truncate CLOG and Multi to the oldest computed value */
|
/* Truncate CLOG and Multi to the oldest computed value */
|
||||||
TruncateCLOG(frozenXID);
|
TruncateCLOG(frozenXID);
|
||||||
TruncateMultiXact(frozenMulti);
|
TruncateMultiXact(minMulti);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the wrap limit for GetNewTransactionId and creation of new
|
* Update the wrap limit for GetNewTransactionId and creation of new
|
||||||
@ -905,7 +905,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
|
|||||||
* signalling twice?
|
* signalling twice?
|
||||||
*/
|
*/
|
||||||
SetTransactionIdLimit(frozenXID, oldestxid_datoid);
|
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 OldestXmin;
|
||||||
static TransactionId FreezeLimit;
|
static TransactionId FreezeLimit;
|
||||||
static MultiXactId MultiXactFrzLimit;
|
static MultiXactId MultiXactCutoff;
|
||||||
|
|
||||||
static BufferAccessStrategy vac_strategy;
|
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,
|
vacuum_set_xid_limits(vacstmt->freeze_min_age, vacstmt->freeze_table_age,
|
||||||
onerel->rd_rel->relisshared,
|
onerel->rd_rel->relisshared,
|
||||||
&OldestXmin, &FreezeLimit, &freezeTableLimit,
|
&OldestXmin, &FreezeLimit, &freezeTableLimit,
|
||||||
&MultiXactFrzLimit);
|
&MultiXactCutoff);
|
||||||
scan_all = TransactionIdPrecedesOrEquals(onerel->rd_rel->relfrozenxid,
|
scan_all = TransactionIdPrecedesOrEquals(onerel->rd_rel->relfrozenxid,
|
||||||
freezeTableLimit);
|
freezeTableLimit);
|
||||||
|
|
||||||
@ -273,7 +273,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
|
|||||||
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
||||||
new_frozen_xid = InvalidTransactionId;
|
new_frozen_xid = InvalidTransactionId;
|
||||||
|
|
||||||
new_min_multi = MultiXactFrzLimit;
|
new_min_multi = MultiXactCutoff;
|
||||||
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
if (vacrelstats->scanned_pages < vacrelstats->rel_pages)
|
||||||
new_min_multi = InvalidMultiXactId;
|
new_min_multi = InvalidMultiXactId;
|
||||||
|
|
||||||
@ -867,7 +867,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
|||||||
* freezing. Note we already have exclusive buffer lock.
|
* freezing. Note we already have exclusive buffer lock.
|
||||||
*/
|
*/
|
||||||
if (heap_freeze_tuple(tuple.t_data, FreezeLimit,
|
if (heap_freeze_tuple(tuple.t_data, FreezeLimit,
|
||||||
MultiXactFrzLimit))
|
MultiXactCutoff))
|
||||||
frozen[nfrozen++] = offnum;
|
frozen[nfrozen++] = offnum;
|
||||||
}
|
}
|
||||||
} /* scan along page */
|
} /* scan along page */
|
||||||
@ -885,7 +885,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
|||||||
XLogRecPtr recptr;
|
XLogRecPtr recptr;
|
||||||
|
|
||||||
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
|
recptr = log_heap_freeze(onerel, buf, FreezeLimit,
|
||||||
MultiXactFrzLimit, frozen, nfrozen);
|
MultiXactCutoff, frozen, nfrozen);
|
||||||
PageSetLSN(page, recptr);
|
PageSetLSN(page, recptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1230,7 +1230,7 @@ lazy_check_needs_freeze(Buffer buf)
|
|||||||
tupleheader = (HeapTupleHeader) PageGetItem(page, itemid);
|
tupleheader = (HeapTupleHeader) PageGetItem(page, itemid);
|
||||||
|
|
||||||
if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
|
if (heap_tuple_needs_freeze(tupleheader, FreezeLimit,
|
||||||
MultiXactFrzLimit, buf))
|
MultiXactCutoff, buf))
|
||||||
return true;
|
return true;
|
||||||
} /* scan along page */
|
} /* scan along page */
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ typedef struct avw_dbase
|
|||||||
Oid adw_datid;
|
Oid adw_datid;
|
||||||
char *adw_name;
|
char *adw_name;
|
||||||
TransactionId adw_frozenxid;
|
TransactionId adw_frozenxid;
|
||||||
MultiXactId adw_frozenmulti;
|
MultiXactId adw_minmulti;
|
||||||
PgStat_StatDBEntry *adw_entry;
|
PgStat_StatDBEntry *adw_entry;
|
||||||
} avw_dbase;
|
} avw_dbase;
|
||||||
|
|
||||||
@ -1176,11 +1176,10 @@ do_start_worker(void)
|
|||||||
}
|
}
|
||||||
else if (for_xid_wrap)
|
else if (for_xid_wrap)
|
||||||
continue; /* ignore not-at-risk DBs */
|
continue; /* ignore not-at-risk DBs */
|
||||||
else if (MultiXactIdPrecedes(tmp->adw_frozenmulti, multiForceLimit))
|
else if (MultiXactIdPrecedes(tmp->adw_minmulti, multiForceLimit))
|
||||||
{
|
{
|
||||||
if (avdb == NULL ||
|
if (avdb == NULL ||
|
||||||
MultiXactIdPrecedes(tmp->adw_frozenmulti,
|
MultiXactIdPrecedes(tmp->adw_minmulti, avdb->adw_minmulti))
|
||||||
avdb->adw_frozenmulti))
|
|
||||||
avdb = tmp;
|
avdb = tmp;
|
||||||
for_multi_wrap = true;
|
for_multi_wrap = true;
|
||||||
continue;
|
continue;
|
||||||
@ -1876,7 +1875,7 @@ get_database_list(void)
|
|||||||
avdb->adw_datid = HeapTupleGetOid(tup);
|
avdb->adw_datid = HeapTupleGetOid(tup);
|
||||||
avdb->adw_name = pstrdup(NameStr(pgdatabase->datname));
|
avdb->adw_name = pstrdup(NameStr(pgdatabase->datname));
|
||||||
avdb->adw_frozenxid = pgdatabase->datfrozenxid;
|
avdb->adw_frozenxid = pgdatabase->datfrozenxid;
|
||||||
avdb->adw_frozenmulti = pgdatabase->datminmxid;
|
avdb->adw_minmulti = pgdatabase->datminmxid;
|
||||||
/* this gets set later: */
|
/* this gets set later: */
|
||||||
avdb->adw_entry = NULL;
|
avdb->adw_entry = NULL;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ typedef struct RewriteStateData *RewriteState;
|
|||||||
|
|
||||||
extern RewriteState begin_heap_rewrite(Relation NewHeap,
|
extern RewriteState begin_heap_rewrite(Relation NewHeap,
|
||||||
TransactionId OldestXmin, TransactionId FreezeXid,
|
TransactionId OldestXmin, TransactionId FreezeXid,
|
||||||
MultiXactId MultiXactFrzLimit, bool use_wal);
|
MultiXactId MultiXactCutoff, bool use_wal);
|
||||||
extern void end_heap_rewrite(RewriteState state);
|
extern void end_heap_rewrite(RewriteState state);
|
||||||
extern void rewrite_heap_tuple(RewriteState state, HeapTuple oldTuple,
|
extern void rewrite_heap_tuple(RewriteState state, HeapTuple oldTuple,
|
||||||
HeapTuple newTuple);
|
HeapTuple newTuple);
|
||||||
|
@ -32,6 +32,6 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
|||||||
bool check_constraints,
|
bool check_constraints,
|
||||||
bool is_internal,
|
bool is_internal,
|
||||||
TransactionId frozenXid,
|
TransactionId frozenXid,
|
||||||
MultiXactId frozenMulti);
|
MultiXactId minMulti);
|
||||||
|
|
||||||
#endif /* CLUSTER_H */
|
#endif /* CLUSTER_H */
|
||||||
|
@ -160,7 +160,7 @@ extern void vacuum_set_xid_limits(int freeze_min_age, int freeze_table_age,
|
|||||||
TransactionId *oldestXmin,
|
TransactionId *oldestXmin,
|
||||||
TransactionId *freezeLimit,
|
TransactionId *freezeLimit,
|
||||||
TransactionId *freezeTableLimit,
|
TransactionId *freezeTableLimit,
|
||||||
MultiXactId *multiXactFrzLimit);
|
MultiXactId *multiXactCutoff);
|
||||||
extern void vac_update_datfrozenxid(void);
|
extern void vac_update_datfrozenxid(void);
|
||||||
extern void vacuum_delay_point(void);
|
extern void vacuum_delay_point(void);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user