Skip to content

Commit dd778e9

Browse files
committed
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
1 parent 0892ecb commit dd778e9

File tree

11 files changed

+61
-61
lines changed

11 files changed

+61
-61
lines changed

src/backend/access/heap/heapam.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,8 +5135,8 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
51355135

51365136
/*
51375137
* Note that this code handles IS_MULTI Xmax values, too, but only to mark
5138-
* the tuple frozen if the updating Xid in the mxact is below the freeze
5139-
* cutoff; it doesn't remove dead members of a very old multixact.
5138+
* the tuple as not updated if the multixact is below the cutoff Multixact
5139+
* given; it doesn't remove dead members of a very old multixact.
51405140
*/
51415141
xid = HeapTupleHeaderGetRawXmax(tuple);
51425142
if ((tuple->t_infomask & HEAP_XMAX_IS_MULTI) ?

src/backend/access/heap/rewriteheap.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ typedef struct RewriteStateData
129129
* determine tuple visibility */
130130
TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff
131131
* point */
132-
MultiXactId rs_freeze_multi;/* MultiXactId that will be used as freeze
133-
* cutoff point for multixacts */
132+
MultiXactId rs_cutoff_multi;/* MultiXactId that will be used as cutoff
133+
* point for multixacts */
134134
MemoryContext rs_cxt; /* for hash tables and entries and tuples in
135135
* them */
136136
HTAB *rs_unresolved_tups; /* unmatched A tuples */
@@ -180,15 +180,15 @@ static void raw_heap_insert(RewriteState state, HeapTuple tup);
180180
* new_heap new, locked heap relation to insert tuples to
181181
* oldest_xmin xid used by the caller to determine which tuples are dead
182182
* freeze_xid xid before which tuples will be frozen
183-
* freeze_multi multixact before which multis will be frozen
183+
* min_multi multixact before which multis will be removed
184184
* use_wal should the inserts to the new heap be WAL-logged?
185185
*
186186
* Returns an opaque RewriteState, allocated in current memory context,
187187
* to be used in subsequent calls to the other functions.
188188
*/
189189
RewriteState
190190
begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
191-
TransactionId freeze_xid, MultiXactId freeze_multi,
191+
TransactionId freeze_xid, MultiXactId cutoff_multi,
192192
bool use_wal)
193193
{
194194
RewriteState state;
@@ -218,7 +218,7 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
218218
state->rs_use_wal = use_wal;
219219
state->rs_oldest_xmin = oldest_xmin;
220220
state->rs_freeze_xid = freeze_xid;
221-
state->rs_freeze_multi = freeze_multi;
221+
state->rs_cutoff_multi = cutoff_multi;
222222
state->rs_cxt = rw_cxt;
223223

224224
/* Initialize hash tables used to track update chains */
@@ -347,7 +347,7 @@ rewrite_heap_tuple(RewriteState state,
347347
* very-old xmin or xmax, so that future VACUUM effort can be saved.
348348
*/
349349
heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid,
350-
state->rs_freeze_multi);
350+
state->rs_cutoff_multi);
351351

352352
/*
353353
* Invalid ctid means that ctid should point to the tuple itself. We'll

src/backend/access/transam/multixact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members,
10691069
* We check known limits on MultiXact before resorting to the SLRU area.
10701070
*
10711071
* An ID older than MultiXactState->oldestMultiXactId cannot possibly be
1072-
* useful; it should have already been frozen by vacuum. We've truncated
1072+
* useful; it should have already been removed by vacuum. We've truncated
10731073
* the on-disk structures anyway. Returning the wrong values could lead
10741074
* to an incorrect visibility result. However, to support pg_upgrade we
10751075
* need to allow an empty set to be returned regardless, if the caller is

src/backend/commands/cluster.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void rebuild_relation(Relation OldHeap, Oid indexOid,
6969
static void copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
7070
int freeze_min_age, int freeze_table_age, bool verbose,
7171
bool *pSwapToastByContent, TransactionId *pFreezeXid,
72-
MultiXactId *pFreezeMulti);
72+
MultiXactId *pCutoffMulti);
7373
static List *get_tables_to_cluster(MemoryContext cluster_context);
7474
static void reform_and_rewrite_tuple(HeapTuple tuple,
7575
TupleDesc oldTupDesc, TupleDesc newTupDesc,
@@ -566,7 +566,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
566566
bool is_system_catalog;
567567
bool swap_toast_by_content;
568568
TransactionId frozenXid;
569-
MultiXactId frozenMulti;
569+
MultiXactId cutoffMulti;
570570

571571
/* Mark the correct index as clustered */
572572
if (OidIsValid(indexOid))
@@ -585,15 +585,15 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
585585
/* Copy the heap data into the new table in the desired order */
586586
copy_heap_data(OIDNewHeap, tableOid, indexOid,
587587
freeze_min_age, freeze_table_age, verbose,
588-
&swap_toast_by_content, &frozenXid, &frozenMulti);
588+
&swap_toast_by_content, &frozenXid, &cutoffMulti);
589589

590590
/*
591591
* Swap the physical files of the target and transient tables, then
592592
* rebuild the target's indexes and throw away the transient table.
593593
*/
594594
finish_heap_swap(tableOid, OIDNewHeap, is_system_catalog,
595595
swap_toast_by_content, false, true,
596-
frozenXid, frozenMulti);
596+
frozenXid, cutoffMulti);
597597
}
598598

599599

@@ -736,12 +736,13 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, bool forcetemp,
736736
* There are two output parameters:
737737
* *pSwapToastByContent is set true if toast tables must be swapped by content.
738738
* *pFreezeXid receives the TransactionId used as freeze cutoff point.
739+
* *pCutoffMulti receives the MultiXactId used as a cutoff point.
739740
*/
740741
static void
741742
copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
742743
int freeze_min_age, int freeze_table_age, bool verbose,
743744
bool *pSwapToastByContent, TransactionId *pFreezeXid,
744-
MultiXactId *pFreezeMulti)
745+
MultiXactId *pCutoffMulti)
745746
{
746747
Relation NewHeap,
747748
OldHeap,
@@ -757,7 +758,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
757758
bool is_system_catalog;
758759
TransactionId OldestXmin;
759760
TransactionId FreezeXid;
760-
MultiXactId MultiXactFrzLimit;
761+
MultiXactId MultiXactCutoff;
761762
RewriteState rwstate;
762763
bool use_sort;
763764
Tuplesortstate *tuplesort;
@@ -858,7 +859,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
858859
*/
859860
vacuum_set_xid_limits(freeze_min_age, freeze_table_age,
860861
OldHeap->rd_rel->relisshared,
861-
&OldestXmin, &FreezeXid, NULL, &MultiXactFrzLimit);
862+
&OldestXmin, &FreezeXid, NULL, &MultiXactCutoff);
862863

863864
/*
864865
* 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,
869870

870871
/* return selected values to caller */
871872
*pFreezeXid = FreezeXid;
872-
*pFreezeMulti = MultiXactFrzLimit;
873+
*pCutoffMulti = MultiXactCutoff;
873874

874875
/* Remember if it's a system catalog */
875876
is_system_catalog = IsSystemRelation(OldHeap);
876877

877878
/* Initialize the rewrite operation */
878879
rwstate = begin_heap_rewrite(NewHeap, OldestXmin, FreezeXid,
879-
MultiXactFrzLimit, use_wal);
880+
MultiXactCutoff, use_wal);
880881

881882
/*
882883
* 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,
11351136
bool swap_toast_by_content,
11361137
bool is_internal,
11371138
TransactionId frozenXid,
1138-
MultiXactId frozenMulti,
1139+
MultiXactId cutoffMulti,
11391140
Oid *mapped_tables)
11401141
{
11411142
Relation relRelation;
@@ -1246,8 +1247,8 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
12461247
{
12471248
Assert(TransactionIdIsNormal(frozenXid));
12481249
relform1->relfrozenxid = frozenXid;
1249-
Assert(MultiXactIdIsValid(frozenMulti));
1250-
relform1->relminmxid = frozenMulti;
1250+
Assert(MultiXactIdIsValid(cutoffMulti));
1251+
relform1->relminmxid = cutoffMulti;
12511252
}
12521253

12531254
/* 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,
13211322
swap_toast_by_content,
13221323
is_internal,
13231324
frozenXid,
1324-
frozenMulti,
1325+
cutoffMulti,
13251326
mapped_tables);
13261327
}
13271328
else
@@ -1464,7 +1465,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
14641465
bool check_constraints,
14651466
bool is_internal,
14661467
TransactionId frozenXid,
1467-
MultiXactId frozenMulti)
1468+
MultiXactId cutoffMulti)
14681469
{
14691470
ObjectAddress object;
14701471
Oid mapped_tables[4];
@@ -1481,7 +1482,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
14811482
swap_relation_files(OIDOldHeap, OIDNewHeap,
14821483
(OIDOldHeap == RelationRelationId),
14831484
swap_toast_by_content, is_internal,
1484-
frozenXid, frozenMulti, mapped_tables);
1485+
frozenXid, cutoffMulti, mapped_tables);
14851486

14861487
/*
14871488
* If it's a system catalog, queue an sinval message to flush all

src/backend/commands/dbcommands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
16641664
/* limit of frozen XIDs */
16651665
if (dbFrozenXidP)
16661666
*dbFrozenXidP = dbform->datfrozenxid;
1667-
/* limit of frozen Multixacts */
1667+
/* minimum MultixactId */
16681668
if (dbMinMultiP)
16691669
*dbMinMultiP = dbform->datminmxid;
16701670
/* default tablespace for this database */

src/backend/commands/vacuum.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static BufferAccessStrategy vac_strategy;
6464

6565
/* non-export function prototypes */
6666
static List *get_rel_oids(Oid relid, const RangeVar *vacrel);
67-
static void vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti);
67+
static void vac_truncate_clog(TransactionId frozenXID, MultiXactId minMulti);
6868
static bool vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast,
6969
bool for_wraparound);
7070

@@ -384,7 +384,7 @@ vacuum_set_xid_limits(int freeze_min_age,
384384
TransactionId *oldestXmin,
385385
TransactionId *freezeLimit,
386386
TransactionId *freezeTableLimit,
387-
MultiXactId *multiXactFrzLimit)
387+
MultiXactId *multiXactCutoff)
388388
{
389389
int freezemin;
390390
TransactionId limit;
@@ -469,7 +469,7 @@ vacuum_set_xid_limits(int freeze_min_age,
469469
*freezeTableLimit = limit;
470470
}
471471

472-
if (multiXactFrzLimit != NULL)
472+
if (multiXactCutoff != NULL)
473473
{
474474
MultiXactId mxLimit;
475475

@@ -481,7 +481,7 @@ vacuum_set_xid_limits(int freeze_min_age,
481481
if (mxLimit < FirstMultiXactId)
482482
mxLimit = FirstMultiXactId;
483483

484-
*multiXactFrzLimit = mxLimit;
484+
*multiXactCutoff = mxLimit;
485485
}
486486
}
487487

@@ -690,8 +690,8 @@ vac_update_relstats(Relation relation,
690690
* Update pg_database's datfrozenxid entry for our database to be the
691691
* minimum of the pg_class.relfrozenxid values.
692692
*
693-
* Similarly, update our datfrozenmulti to be the minimum of the
694-
* pg_class.relfrozenmulti values.
693+
* Similarly, update our datminmxid to be the minimum of the
694+
* pg_class.relminmxid values.
695695
*
696696
* If we are able to advance either pg_database value, also try to
697697
* truncate pg_clog and pg_multixact.
@@ -711,7 +711,7 @@ vac_update_datfrozenxid(void)
711711
SysScanDesc scan;
712712
HeapTuple classTup;
713713
TransactionId newFrozenXid;
714-
MultiXactId newFrozenMulti;
714+
MultiXactId newMinMulti;
715715
bool dirty = false;
716716

717717
/*
@@ -726,7 +726,7 @@ vac_update_datfrozenxid(void)
726726
* Similarly, initialize the MultiXact "min" with the value that would be
727727
* used on pg_class for new tables. See AddNewRelationTuple().
728728
*/
729-
newFrozenMulti = GetOldestMultiXactId();
729+
newMinMulti = GetOldestMultiXactId();
730730

731731
/*
732732
* We must seqscan pg_class to find the minimum Xid, because there is no
@@ -756,16 +756,16 @@ vac_update_datfrozenxid(void)
756756
if (TransactionIdPrecedes(classForm->relfrozenxid, newFrozenXid))
757757
newFrozenXid = classForm->relfrozenxid;
758758

759-
if (MultiXactIdPrecedes(classForm->relminmxid, newFrozenMulti))
760-
newFrozenMulti = classForm->relminmxid;
759+
if (MultiXactIdPrecedes(classForm->relminmxid, newMinMulti))
760+
newMinMulti = classForm->relminmxid;
761761
}
762762

763763
/* we're done with pg_class */
764764
systable_endscan(scan);
765765
heap_close(relation, AccessShareLock);
766766

767767
Assert(TransactionIdIsNormal(newFrozenXid));
768-
Assert(MultiXactIdIsValid(newFrozenMulti));
768+
Assert(MultiXactIdIsValid(newMinMulti));
769769

770770
/* Now fetch the pg_database tuple we need to update. */
771771
relation = heap_open(DatabaseRelationId, RowExclusiveLock);
@@ -787,9 +787,9 @@ vac_update_datfrozenxid(void)
787787
}
788788

789789
/* ditto */
790-
if (MultiXactIdPrecedes(dbform->datminmxid, newFrozenMulti))
790+
if (MultiXactIdPrecedes(dbform->datminmxid, newMinMulti))
791791
{
792-
dbform->datminmxid = newFrozenMulti;
792+
dbform->datminmxid = newMinMulti;
793793
dirty = true;
794794
}
795795

@@ -805,7 +805,7 @@ vac_update_datfrozenxid(void)
805805
* this action will update that too.
806806
*/
807807
if (dirty || ForceTransactionIdLimitUpdate())
808-
vac_truncate_clog(newFrozenXid, newFrozenMulti);
808+
vac_truncate_clog(newFrozenXid, newMinMulti);
809809
}
810810

811811

@@ -824,19 +824,19 @@ vac_update_datfrozenxid(void)
824824
* info is stale.
825825
*/
826826
static void
827-
vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
827+
vac_truncate_clog(TransactionId frozenXID, MultiXactId minMulti)
828828
{
829829
TransactionId myXID = GetCurrentTransactionId();
830830
Relation relation;
831831
HeapScanDesc scan;
832832
HeapTuple tuple;
833833
Oid oldestxid_datoid;
834-
Oid oldestmulti_datoid;
834+
Oid minmulti_datoid;
835835
bool frozenAlreadyWrapped = false;
836836

837837
/* init oldest datoids to sync with my frozen values */
838838
oldestxid_datoid = MyDatabaseId;
839-
oldestmulti_datoid = MyDatabaseId;
839+
minmulti_datoid = MyDatabaseId;
840840

841841
/*
842842
* Scan pg_database to compute the minimum datfrozenxid
@@ -869,10 +869,10 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
869869
oldestxid_datoid = HeapTupleGetOid(tuple);
870870
}
871871

872-
if (MultiXactIdPrecedes(dbform->datminmxid, frozenMulti))
872+
if (MultiXactIdPrecedes(dbform->datminmxid, minMulti))
873873
{
874-
frozenMulti = dbform->datminmxid;
875-
oldestmulti_datoid = HeapTupleGetOid(tuple);
874+
minMulti = dbform->datminmxid;
875+
minmulti_datoid = HeapTupleGetOid(tuple);
876876
}
877877
}
878878

@@ -896,7 +896,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
896896

897897
/* Truncate CLOG and Multi to the oldest computed value */
898898
TruncateCLOG(frozenXID);
899-
TruncateMultiXact(frozenMulti);
899+
TruncateMultiXact(minMulti);
900900

901901
/*
902902
* Update the wrap limit for GetNewTransactionId and creation of new
@@ -905,7 +905,7 @@ vac_truncate_clog(TransactionId frozenXID, MultiXactId frozenMulti)
905905
* signalling twice?
906906
*/
907907
SetTransactionIdLimit(frozenXID, oldestxid_datoid);
908-
MultiXactAdvanceOldest(frozenMulti, oldestmulti_datoid);
908+
MultiXactAdvanceOldest(minMulti, minmulti_datoid);
909909
}
910910

911911

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy