Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3451faa

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 374652f commit 3451faa

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
@@ -5118,8 +5118,8 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
51185118

51195119
/*
51205120
* Note that this code handles IS_MULTI Xmax values, too, but only to mark
5121-
* the tuple frozen if the updating Xid in the mxact is below the freeze
5122-
* cutoff; it doesn't remove dead members of a very old multixact.
5121+
* the tuple as not updated if the multixact is below the cutoff Multixact
5122+
* given; it doesn't remove dead members of a very old multixact.
51235123
*/
51245124
xid = HeapTupleHeaderGetRawXmax(tuple);
51255125
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
@@ -68,7 +68,7 @@ static void rebuild_relation(Relation OldHeap, Oid indexOid,
6868
static void copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
6969
int freeze_min_age, int freeze_table_age, bool verbose,
7070
bool *pSwapToastByContent, TransactionId *pFreezeXid,
71-
MultiXactId *pFreezeMulti);
71+
MultiXactId *pCutoffMulti);
7272
static List *get_tables_to_cluster(MemoryContext cluster_context);
7373
static void reform_and_rewrite_tuple(HeapTuple tuple,
7474
TupleDesc oldTupDesc, TupleDesc newTupDesc,
@@ -570,7 +570,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
570570
bool is_system_catalog;
571571
bool swap_toast_by_content;
572572
TransactionId frozenXid;
573-
MultiXactId frozenMulti;
573+
MultiXactId cutoffMulti;
574574

575575
/* Mark the correct index as clustered */
576576
if (OidIsValid(indexOid))
@@ -588,15 +588,15 @@ rebuild_relation(Relation OldHeap, Oid indexOid,
588588
/* Copy the heap data into the new table in the desired order */
589589
copy_heap_data(OIDNewHeap, tableOid, indexOid,
590590
freeze_min_age, freeze_table_age, verbose,
591-
&swap_toast_by_content, &frozenXid, &frozenMulti);
591+
&swap_toast_by_content, &frozenXid, &cutoffMulti);
592592

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

602602

@@ -725,12 +725,13 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
725725
* There are two output parameters:
726726
* *pSwapToastByContent is set true if toast tables must be swapped by content.
727727
* *pFreezeXid receives the TransactionId used as freeze cutoff point.
728+
* *pCutoffMulti receives the MultiXactId used as a cutoff point.
728729
*/
729730
static void
730731
copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
731732
int freeze_min_age, int freeze_table_age, bool verbose,
732733
bool *pSwapToastByContent, TransactionId *pFreezeXid,
733-
MultiXactId *pFreezeMulti)
734+
MultiXactId *pCutoffMulti)
734735
{
735736
Relation NewHeap,
736737
OldHeap,
@@ -746,7 +747,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
746747
bool is_system_catalog;
747748
TransactionId OldestXmin;
748749
TransactionId FreezeXid;
749-
MultiXactId MultiXactFrzLimit;
750+
MultiXactId MultiXactCutoff;
750751
RewriteState rwstate;
751752
bool use_sort;
752753
Tuplesortstate *tuplesort;
@@ -847,7 +848,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
847848
*/
848849
vacuum_set_xid_limits(freeze_min_age, freeze_table_age,
849850
OldHeap->rd_rel->relisshared,
850-
&OldestXmin, &FreezeXid, NULL, &MultiXactFrzLimit);
851+
&OldestXmin, &FreezeXid, NULL, &MultiXactCutoff);
851852

852853
/*
853854
* 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,
858859

859860
/* return selected values to caller */
860861
*pFreezeXid = FreezeXid;
861-
*pFreezeMulti = MultiXactFrzLimit;
862+
*pCutoffMulti = MultiXactCutoff;
862863

863864
/* Remember if it's a system catalog */
864865
is_system_catalog = IsSystemRelation(OldHeap);
865866

866867
/* Initialize the rewrite operation */
867868
rwstate = begin_heap_rewrite(NewHeap, OldestXmin, FreezeXid,
868-
MultiXactFrzLimit, use_wal);
869+
MultiXactCutoff, use_wal);
869870

870871
/*
871872
* 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,
11241125
bool swap_toast_by_content,
11251126
bool is_internal,
11261127
TransactionId frozenXid,
1127-
MultiXactId frozenMulti,
1128+
MultiXactId cutoffMulti,
11281129
Oid *mapped_tables)
11291130
{
11301131
Relation relRelation;
@@ -1237,8 +1238,8 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
12371238
{
12381239
Assert(TransactionIdIsNormal(frozenXid));
12391240
relform1->relfrozenxid = frozenXid;
1240-
Assert(MultiXactIdIsValid(frozenMulti));
1241-
relform1->relminmxid = frozenMulti;
1241+
Assert(MultiXactIdIsValid(cutoffMulti));
1242+
relform1->relminmxid = cutoffMulti;
12421243
}
12431244

12441245
/* 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,
13121313
swap_toast_by_content,
13131314
is_internal,
13141315
frozenXid,
1315-
frozenMulti,
1316+
cutoffMulti,
13161317
mapped_tables);
13171318
}
13181319
else
@@ -1443,7 +1444,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
14431444
bool check_constraints,
14441445
bool is_internal,
14451446
TransactionId frozenXid,
1446-
MultiXactId frozenMulti)
1447+
MultiXactId cutoffMulti)
14471448
{
14481449
ObjectAddress object;
14491450
Oid mapped_tables[4];
@@ -1460,7 +1461,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
14601461
swap_relation_files(OIDOldHeap, OIDNewHeap,
14611462
(OIDOldHeap == RelationRelationId),
14621463
swap_toast_by_content, is_internal,
1463-
frozenXid, frozenMulti, mapped_tables);
1464+
frozenXid, cutoffMulti, mapped_tables);
14641465

14651466
/*
14661467
* 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
@@ -1691,7 +1691,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
16911691
/* limit of frozen XIDs */
16921692
if (dbFrozenXidP)
16931693
*dbFrozenXidP = dbform->datfrozenxid;
1694-
/* limit of frozen Multixacts */
1694+
/* minimum MultixactId */
16951695
if (dbMinMultiP)
16961696
*dbMinMultiP = dbform->datminmxid;
16971697
/* 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)