Skip to content

Commit a1999a0

Browse files
committed
Sanitize the term "combo CID" in code comments
Combo CIDs were referred in the code comments using different terms across various places of the code, so unify a bit the term used with what is currently in use in some of the READMEs. Author: "Hou, Zhijie" Discussion: https://postgr.es/m/1d42865c91404f46af4562532fdbea31@G08CNEXMBPEKD05.g08.fujitsu.local
1 parent 438fc4a commit a1999a0

File tree

9 files changed

+55
-55
lines changed

9 files changed

+55
-55
lines changed

src/backend/access/heap/heapam.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
21572157
int bufflags = 0;
21582158

21592159
/*
2160-
* If this is a catalog, we need to transmit combocids to properly
2160+
* If this is a catalog, we need to transmit combo CIDs to properly
21612161
* decode, so log that as well.
21622162
*/
21632163
if (RelationIsAccessibleInLogicalDecoding(relation))
@@ -2437,7 +2437,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
24372437
RelationPutHeapTuple(relation, buffer, heaptuples[ndone], false);
24382438

24392439
/*
2440-
* For logical decoding we need combocids to properly decode the
2440+
* For logical decoding we need combo CIDs to properly decode the
24412441
* catalog.
24422442
*/
24432443
if (needwal && need_cids)
@@ -2453,7 +2453,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
24532453
RelationPutHeapTuple(relation, buffer, heaptup, false);
24542454

24552455
/*
2456-
* For logical decoding we need combocids to properly decode the
2456+
* For logical decoding we need combo CIDs to properly decode the
24572457
* catalog.
24582458
*/
24592459
if (needwal && need_cids)
@@ -2733,7 +2733,7 @@ xmax_infomask_changed(uint16 new_infomask, uint16 old_infomask)
27332733
*
27342734
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
27352735
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
2736-
* only for TM_SelfModified, since we cannot obtain cmax from a combocid
2736+
* only for TM_SelfModified, since we cannot obtain cmax from a combo CID
27372737
* generated by another transaction).
27382738
*/
27392739
TM_Result
@@ -2761,8 +2761,8 @@ heap_delete(Relation relation, ItemPointer tid,
27612761
Assert(ItemPointerIsValid(tid));
27622762

27632763
/*
2764-
* Forbid this during a parallel operation, lest it allocate a combocid.
2765-
* Other workers might need that combocid for visibility checks, and we
2764+
* Forbid this during a parallel operation, lest it allocate a combo CID.
2765+
* Other workers might need that combo CID for visibility checks, and we
27662766
* have no provision for broadcasting it to them.
27672767
*/
27682768
if (IsInParallelMode())
@@ -2963,7 +2963,7 @@ heap_delete(Relation relation, ItemPointer tid,
29632963
*/
29642964
CheckForSerializableConflictIn(relation, tid, BufferGetBlockNumber(buffer));
29652965

2966-
/* replace cid with a combo cid if necessary */
2966+
/* replace cid with a combo CID if necessary */
29672967
HeapTupleHeaderAdjustCmax(tp.t_data, &cid, &iscombo);
29682968

29692969
/*
@@ -3035,7 +3035,7 @@ heap_delete(Relation relation, ItemPointer tid,
30353035
xl_heap_header xlhdr;
30363036
XLogRecPtr recptr;
30373037

3038-
/* For logical decode we need combocids to properly decode the catalog */
3038+
/* For logical decode we need combo CIDs to properly decode the catalog */
30393039
if (RelationIsAccessibleInLogicalDecoding(relation))
30403040
log_heap_new_cid(relation, &tp);
30413041

@@ -3183,7 +3183,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
31833183
*
31843184
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
31853185
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
3186-
* only for TM_SelfModified, since we cannot obtain cmax from a combocid
3186+
* only for TM_SelfModified, since we cannot obtain cmax from a combo CID
31873187
* generated by another transaction).
31883188
*/
31893189
TM_Result
@@ -3232,8 +3232,8 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
32323232
Assert(ItemPointerIsValid(otid));
32333233

32343234
/*
3235-
* Forbid this during a parallel operation, lest it allocate a combocid.
3236-
* Other workers might need that combocid for visibility checks, and we
3235+
* Forbid this during a parallel operation, lest it allocate a combo CID.
3236+
* Other workers might need that combo CID for visibility checks, and we
32373237
* have no provision for broadcasting it to them.
32383238
*/
32393239
if (IsInParallelMode())
@@ -3671,7 +3671,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
36713671
HeapTupleHeaderSetXmax(newtup->t_data, xmax_new_tuple);
36723672

36733673
/*
3674-
* Replace cid with a combo cid if necessary. Note that we already put
3674+
* Replace cid with a combo CID if necessary. Note that we already put
36753675
* the plain cid into the new tuple.
36763676
*/
36773677
HeapTupleHeaderAdjustCmax(oldtup.t_data, &cid, &iscombo);
@@ -3987,7 +3987,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
39873987
XLogRecPtr recptr;
39883988

39893989
/*
3990-
* For logical decoding we need combocids to properly decode the
3990+
* For logical decoding we need combo CIDs to properly decode the
39913991
* catalog.
39923992
*/
39933993
if (RelationIsAccessibleInLogicalDecoding(relation))
@@ -4259,7 +4259,7 @@ get_mxact_status_for_lock(LockTupleMode mode, bool is_update)
42594259
* In the failure cases other than TM_Invisible, the routine fills
42604260
* *tmfd with the tuple's t_ctid, t_xmax (resolving a possible MultiXact,
42614261
* if necessary), and t_cmax (the last only for TM_SelfModified,
4262-
* since we cannot obtain cmax from a combocid generated by another
4262+
* since we cannot obtain cmax from a combo CID generated by another
42634263
* transaction).
42644264
* See comments for struct TM_FailureData for additional info.
42654265
*
@@ -5901,7 +5901,7 @@ heap_abort_speculative(Relation relation, ItemPointer tid)
59015901

59025902
/*
59035903
* No need to check for serializable conflicts here. There is never a
5904-
* need for a combocid, either. No need to extract replica identity, or
5904+
* need for a combo CID, either. No need to extract replica identity, or
59055905
* do anything special with infomask bits.
59065906
*/
59075907

@@ -8345,7 +8345,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
83458345

83468346
/*
83478347
* If the tuple got inserted & deleted in the same TX we definitely have a
8348-
* combocid, set cmin and cmax.
8348+
* combo CID, set cmin and cmax.
83498349
*/
83508350
if (hdr->t_infomask & HEAP_COMBOCID)
83518351
{
@@ -8355,7 +8355,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
83558355
xlrec.cmax = HeapTupleHeaderGetCmax(hdr);
83568356
xlrec.combocid = HeapTupleHeaderGetRawCommandId(hdr);
83578357
}
8358-
/* No combocid, so only cmin or cmax can be set by this TX */
8358+
/* No combo CID, so only cmin or cmax can be set by this TX */
83598359
else
83608360
{
83618361
/*

src/backend/access/heap/heapam_visibility.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,29 +1608,29 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
16081608

16091609
/*
16101610
* another transaction might have (tried to) delete this tuple or
1611-
* cmin/cmax was stored in a combocid. So we need to lookup the actual
1611+
* cmin/cmax was stored in a combo CID. So we need to lookup the actual
16121612
* values externally.
16131613
*/
16141614
resolved = ResolveCminCmaxDuringDecoding(HistoricSnapshotGetTupleCids(), snapshot,
16151615
htup, buffer,
16161616
&cmin, &cmax);
16171617

16181618
/*
1619-
* If we haven't resolved the combocid to cmin/cmax, that means we
1620-
* have not decoded the combocid yet. That means the cmin is
1619+
* If we haven't resolved the combo CID to cmin/cmax, that means we
1620+
* have not decoded the combo CID yet. That means the cmin is
16211621
* definitely in the future, and we're not supposed to see the tuple
16221622
* yet.
16231623
*
16241624
* XXX This only applies to decoding of in-progress transactions. In
16251625
* regular logical decoding we only execute this code at commit time,
1626-
* at which point we should have seen all relevant combocids. So
1626+
* at which point we should have seen all relevant combo CIDs. So
16271627
* ideally, we should error out in this case but in practice, this
16281628
* won't happen. If we are too worried about this then we can add an
16291629
* elog inside ResolveCminCmaxDuringDecoding.
16301630
*
1631-
* XXX For the streaming case, we can track the largest combocid
1631+
* XXX For the streaming case, we can track the largest combo CID
16321632
* assigned, and error out based on this (when unable to resolve
1633-
* combocid below that observed maximum value).
1633+
* combo CID below that observed maximum value).
16341634
*/
16351635
if (!resolved)
16361636
return false;
@@ -1704,21 +1704,21 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
17041704
&cmin, &cmax);
17051705

17061706
/*
1707-
* If we haven't resolved the combocid to cmin/cmax, that means we
1708-
* have not decoded the combocid yet. That means the cmax is
1707+
* If we haven't resolved the combo CID to cmin/cmax, that means we
1708+
* have not decoded the combo CID yet. That means the cmax is
17091709
* definitely in the future, and we're still supposed to see the
17101710
* tuple.
17111711
*
17121712
* XXX This only applies to decoding of in-progress transactions. In
17131713
* regular logical decoding we only execute this code at commit time,
1714-
* at which point we should have seen all relevant combocids. So
1714+
* at which point we should have seen all relevant combo CIDs. So
17151715
* ideally, we should error out in this case but in practice, this
17161716
* won't happen. If we are too worried about this then we can add an
17171717
* elog inside ResolveCminCmaxDuringDecoding.
17181718
*
1719-
* XXX For the streaming case, we can track the largest combocid
1719+
* XXX For the streaming case, we can track the largest combo CID
17201720
* assigned, and error out based on this (when unable to resolve
1721-
* combocid below that observed maximum value).
1721+
* combo CID below that observed maximum value).
17221722
*/
17231723
if (!resolved || cmax == InvalidCommandId)
17241724
return true;

src/backend/executor/execMain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
149149
* planned to non-temporary tables. EXPLAIN is considered read-only.
150150
*
151151
* Don't allow writes in parallel mode. Supporting UPDATE and DELETE
152-
* would require (a) storing the combocid hash in shared memory, rather
152+
* would require (a) storing the combo CID hash in shared memory, rather
153153
* than synchronizing it just once at the start of parallelism, and (b) an
154154
* alternative to heap_update()'s reliance on xmax for mutual exclusion.
155155
* INSERT may have no such troubles, but we forbid it to simplify the

src/backend/replication/logical/reorderbuffer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4736,19 +4736,19 @@ ReorderBufferToastReset(ReorderBuffer *rb, ReorderBufferTXN *txn)
47364736
* always rely on stored cmin/cmax values because of two scenarios:
47374737
*
47384738
* * A tuple got changed multiple times during a single transaction and thus
4739-
* has got a combocid. Combocid's are only valid for the duration of a
4739+
* has got a combo CID. Combo CIDs are only valid for the duration of a
47404740
* single transaction.
4741-
* * A tuple with a cmin but no cmax (and thus no combocid) got
4741+
* * A tuple with a cmin but no cmax (and thus no combo CID) got
47424742
* deleted/updated in another transaction than the one which created it
4743-
* which we are looking at right now. As only one of cmin, cmax or combocid
4743+
* which we are looking at right now. As only one of cmin, cmax or combo CID
47444744
* is actually stored in the heap we don't have access to the value we
47454745
* need anymore.
47464746
*
47474747
* To resolve those problems we have a per-transaction hash of (cmin,
47484748
* cmax) tuples keyed by (relfilenode, ctid) which contains the actual
4749-
* (cmin, cmax) values. That also takes care of combocids by simply
4749+
* (cmin, cmax) values. That also takes care of combo CIDs by simply
47504750
* not caring about them at all. As we have the real cmin/cmax values
4751-
* combocids aren't interesting.
4751+
* combo CIDs aren't interesting.
47524752
*
47534753
* As we only care about catalog tuples here the overhead of this
47544754
* hashtable should be acceptable.
@@ -4995,7 +4995,7 @@ UpdateLogicalMappings(HTAB *tuplecid_data, Oid relid, Snapshot snapshot)
49954995

49964996
/*
49974997
* Lookup cmin/cmax of a tuple, during logical decoding where we can't rely on
4998-
* combocids.
4998+
* combo CIDs.
49994999
*/
50005000
bool
50015001
ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data,

src/backend/replication/logical/snapbuild.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* catalog in a transaction. During normal operation this is achieved by using
4343
* CommandIds/cmin/cmax. The problem with that however is that for space
4444
* efficiency reasons only one value of that is stored
45-
* (cf. combocid.c). Since ComboCids are only available in memory we log
45+
* (cf. combocid.c). Since combo CIDs are only available in memory we log
4646
* additional information which allows us to get the original (cmin, cmax)
4747
* pair during visibility checks. Check the reorderbuffer.c's comment above
4848
* ResolveCminCmaxDuringDecoding() for details.
@@ -739,7 +739,7 @@ SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, XLogRecPtr lsn)
739739
}
740740

741741
/*
742-
* Do CommandId/ComboCid handling after reading an xl_heap_new_cid record.
742+
* Do CommandId/combo CID handling after reading an xl_heap_new_cid record.
743743
* This implies that a transaction has done some form of write to system
744744
* catalogs.
745745
*/

src/backend/utils/time/combocid.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* real cmin and cmax using a backend-private array, which is managed by
1515
* this module.
1616
*
17-
* To allow reusing existing combo cids, we also keep a hash table that
18-
* maps cmin,cmax pairs to combo cids. This keeps the data structure size
17+
* To allow reusing existing combo CIDs, we also keep a hash table that
18+
* maps cmin,cmax pairs to combo CIDs. This keeps the data structure size
1919
* reasonable in most cases, since the number of unique pairs used by any
2020
* one transaction is likely to be small.
2121
*
@@ -49,7 +49,7 @@
4949
#include "utils/hsearch.h"
5050
#include "utils/memutils.h"
5151

52-
/* Hash table to lookup combo cids by cmin and cmax */
52+
/* Hash table to lookup combo CIDs by cmin and cmax */
5353
static HTAB *comboHash = NULL;
5454

5555
/* Key and entry structures for the hash table */
@@ -75,7 +75,7 @@ typedef ComboCidEntryData *ComboCidEntry;
7575

7676
/*
7777
* An array of cmin,cmax pairs, indexed by combo command id.
78-
* To convert a combo cid to cmin and cmax, you do a simple array lookup.
78+
* To convert a combo CID to cmin and cmax, you do a simple array lookup.
7979
*/
8080
static ComboCidKey comboCids = NULL;
8181
static int usedComboCids = 0; /* number of elements in comboCids */
@@ -259,11 +259,11 @@ GetComboCommandId(CommandId cmin, CommandId cmax)
259259

260260
if (found)
261261
{
262-
/* Reuse an existing combo cid */
262+
/* Reuse an existing combo CID */
263263
return entry->combocid;
264264
}
265265

266-
/* We have to create a new combo cid; we already made room in the array */
266+
/* We have to create a new combo CID; we already made room in the array */
267267
combocid = usedComboCids;
268268

269269
comboCids[combocid].cmin = cmin;
@@ -290,7 +290,7 @@ GetRealCmax(CommandId combocid)
290290
}
291291

292292
/*
293-
* Estimate the amount of space required to serialize the current ComboCID
293+
* Estimate the amount of space required to serialize the current combo CID
294294
* state.
295295
*/
296296
Size
@@ -301,14 +301,14 @@ EstimateComboCIDStateSpace(void)
301301
/* Add space required for saving usedComboCids */
302302
size = sizeof(int);
303303

304-
/* Add space required for saving the combocids key */
304+
/* Add space required for saving ComboCidKeyData */
305305
size = add_size(size, mul_size(sizeof(ComboCidKeyData), usedComboCids));
306306

307307
return size;
308308
}
309309

310310
/*
311-
* Serialize the ComboCID state into the memory, beginning at start_address.
311+
* Serialize the combo CID state into the memory, beginning at start_address.
312312
* maxsize should be at least as large as the value returned by
313313
* EstimateComboCIDStateSpace.
314314
*/
@@ -317,7 +317,7 @@ SerializeComboCIDState(Size maxsize, char *start_address)
317317
{
318318
char *endptr;
319319

320-
/* First, we store the number of currently-existing ComboCIDs. */
320+
/* First, we store the number of currently-existing combo CIDs. */
321321
*(int *) start_address = usedComboCids;
322322

323323
/* If maxsize is too small, throw an error. */
@@ -333,9 +333,9 @@ SerializeComboCIDState(Size maxsize, char *start_address)
333333
}
334334

335335
/*
336-
* Read the ComboCID state at the specified address and initialize this
337-
* backend with the same ComboCIDs. This is only valid in a backend that
338-
* currently has no ComboCIDs (and only makes sense if the transaction state
336+
* Read the combo CID state at the specified address and initialize this
337+
* backend with the same combo CIDs. This is only valid in a backend that
338+
* currently has no combo CIDs (and only makes sense if the transaction state
339339
* is serialized and restored as well).
340340
*/
341341
void
@@ -348,11 +348,11 @@ RestoreComboCIDState(char *comboCIDstate)
348348

349349
Assert(!comboCids && !comboHash);
350350

351-
/* First, we retrieve the number of ComboCIDs that were serialized. */
351+
/* First, we retrieve the number of combo CIDs that were serialized. */
352352
num_elements = *(int *) comboCIDstate;
353353
keydata = (ComboCidKeyData *) (comboCIDstate + sizeof(int));
354354

355-
/* Use GetComboCommandId to restore each ComboCID. */
355+
/* Use GetComboCommandId to restore each combo CID. */
356356
for (i = 0; i < num_elements; i++)
357357
{
358358
cid = GetComboCommandId(keydata[i].cmin, keydata[i].cmax);

src/include/access/htup_details.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ struct HeapTupleHeaderData
191191
#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */
192192
#define HEAP_HASOID_OLD 0x0008 /* has an object-id field */
193193
#define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */
194-
#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */
194+
#define HEAP_COMBOCID 0x0020 /* t_cid is a combo CID */
195195
#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */
196196
#define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */
197197

src/test/regress/expected/combocid.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ SELECT ctid,cmin,* FROM combocidtest;
5151
(0,2) | 1 | 2
5252
(2 rows)
5353

54-
-- Test combo cids with portals
54+
-- Test combo CIDs with portals
5555
BEGIN;
5656
INSERT INTO combocidtest VALUES (333);
5757
DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest;

src/test/regress/sql/combocid.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ COMMIT;
3939
-- combo data is not there anymore, but should still see tuples
4040
SELECT ctid,cmin,* FROM combocidtest;
4141

42-
-- Test combo cids with portals
42+
-- Test combo CIDs with portals
4343
BEGIN;
4444

4545
INSERT INTO combocidtest VALUES (333);

0 commit comments

Comments
 (0)