Commit a1999a01 authored by Michael Paquier's avatar Michael Paquier

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
parent 438fc4a3
......@@ -2157,7 +2157,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
int bufflags = 0;
/*
* If this is a catalog, we need to transmit combocids to properly
* If this is a catalog, we need to transmit combo CIDs to properly
* decode, so log that as well.
*/
if (RelationIsAccessibleInLogicalDecoding(relation))
......@@ -2437,7 +2437,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
RelationPutHeapTuple(relation, buffer, heaptuples[ndone], false);
/*
* For logical decoding we need combocids to properly decode the
* For logical decoding we need combo CIDs to properly decode the
* catalog.
*/
if (needwal && need_cids)
......@@ -2453,7 +2453,7 @@ heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples,
RelationPutHeapTuple(relation, buffer, heaptup, false);
/*
* For logical decoding we need combocids to properly decode the
* For logical decoding we need combo CIDs to properly decode the
* catalog.
*/
if (needwal && need_cids)
......@@ -2733,7 +2733,7 @@ xmax_infomask_changed(uint16 new_infomask, uint16 old_infomask)
*
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
* only for TM_SelfModified, since we cannot obtain cmax from a combocid
* only for TM_SelfModified, since we cannot obtain cmax from a combo CID
* generated by another transaction).
*/
TM_Result
......@@ -2761,8 +2761,8 @@ heap_delete(Relation relation, ItemPointer tid,
Assert(ItemPointerIsValid(tid));
/*
* Forbid this during a parallel operation, lest it allocate a combocid.
* Other workers might need that combocid for visibility checks, and we
* Forbid this during a parallel operation, lest it allocate a combo CID.
* Other workers might need that combo CID for visibility checks, and we
* have no provision for broadcasting it to them.
*/
if (IsInParallelMode())
......@@ -2963,7 +2963,7 @@ l1:
*/
CheckForSerializableConflictIn(relation, tid, BufferGetBlockNumber(buffer));
/* replace cid with a combo cid if necessary */
/* replace cid with a combo CID if necessary */
HeapTupleHeaderAdjustCmax(tp.t_data, &cid, &iscombo);
/*
......@@ -3035,7 +3035,7 @@ l1:
xl_heap_header xlhdr;
XLogRecPtr recptr;
/* For logical decode we need combocids to properly decode the catalog */
/* For logical decode we need combo CIDs to properly decode the catalog */
if (RelationIsAccessibleInLogicalDecoding(relation))
log_heap_new_cid(relation, &tp);
......@@ -3183,7 +3183,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
*
* In the failure cases, the routine fills *tmfd with the tuple's t_ctid,
* t_xmax (resolving a possible MultiXact, if necessary), and t_cmax (the last
* only for TM_SelfModified, since we cannot obtain cmax from a combocid
* only for TM_SelfModified, since we cannot obtain cmax from a combo CID
* generated by another transaction).
*/
TM_Result
......@@ -3232,8 +3232,8 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
Assert(ItemPointerIsValid(otid));
/*
* Forbid this during a parallel operation, lest it allocate a combocid.
* Other workers might need that combocid for visibility checks, and we
* Forbid this during a parallel operation, lest it allocate a combo CID.
* Other workers might need that combo CID for visibility checks, and we
* have no provision for broadcasting it to them.
*/
if (IsInParallelMode())
......@@ -3671,7 +3671,7 @@ l2:
HeapTupleHeaderSetXmax(newtup->t_data, xmax_new_tuple);
/*
* Replace cid with a combo cid if necessary. Note that we already put
* Replace cid with a combo CID if necessary. Note that we already put
* the plain cid into the new tuple.
*/
HeapTupleHeaderAdjustCmax(oldtup.t_data, &cid, &iscombo);
......@@ -3987,7 +3987,7 @@ l2:
XLogRecPtr recptr;
/*
* For logical decoding we need combocids to properly decode the
* For logical decoding we need combo CIDs to properly decode the
* catalog.
*/
if (RelationIsAccessibleInLogicalDecoding(relation))
......@@ -4259,7 +4259,7 @@ get_mxact_status_for_lock(LockTupleMode mode, bool is_update)
* In the failure cases other than TM_Invisible, the routine fills
* *tmfd with the tuple's t_ctid, t_xmax (resolving a possible MultiXact,
* if necessary), and t_cmax (the last only for TM_SelfModified,
* since we cannot obtain cmax from a combocid generated by another
* since we cannot obtain cmax from a combo CID generated by another
* transaction).
* See comments for struct TM_FailureData for additional info.
*
......@@ -5901,7 +5901,7 @@ heap_abort_speculative(Relation relation, ItemPointer tid)
/*
* No need to check for serializable conflicts here. There is never a
* need for a combocid, either. No need to extract replica identity, or
* need for a combo CID, either. No need to extract replica identity, or
* do anything special with infomask bits.
*/
......@@ -8345,7 +8345,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
/*
* If the tuple got inserted & deleted in the same TX we definitely have a
* combocid, set cmin and cmax.
* combo CID, set cmin and cmax.
*/
if (hdr->t_infomask & HEAP_COMBOCID)
{
......@@ -8355,7 +8355,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
xlrec.cmax = HeapTupleHeaderGetCmax(hdr);
xlrec.combocid = HeapTupleHeaderGetRawCommandId(hdr);
}
/* No combocid, so only cmin or cmax can be set by this TX */
/* No combo CID, so only cmin or cmax can be set by this TX */
else
{
/*
......
......@@ -1608,7 +1608,7 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
/*
* another transaction might have (tried to) delete this tuple or
* cmin/cmax was stored in a combocid. So we need to lookup the actual
* cmin/cmax was stored in a combo CID. So we need to lookup the actual
* values externally.
*/
resolved = ResolveCminCmaxDuringDecoding(HistoricSnapshotGetTupleCids(), snapshot,
......@@ -1616,21 +1616,21 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
&cmin, &cmax);
/*
* If we haven't resolved the combocid to cmin/cmax, that means we
* have not decoded the combocid yet. That means the cmin is
* If we haven't resolved the combo CID to cmin/cmax, that means we
* have not decoded the combo CID yet. That means the cmin is
* definitely in the future, and we're not supposed to see the tuple
* yet.
*
* XXX This only applies to decoding of in-progress transactions. In
* regular logical decoding we only execute this code at commit time,
* at which point we should have seen all relevant combocids. So
* at which point we should have seen all relevant combo CIDs. So
* ideally, we should error out in this case but in practice, this
* won't happen. If we are too worried about this then we can add an
* elog inside ResolveCminCmaxDuringDecoding.
*
* XXX For the streaming case, we can track the largest combocid
* XXX For the streaming case, we can track the largest combo CID
* assigned, and error out based on this (when unable to resolve
* combocid below that observed maximum value).
* combo CID below that observed maximum value).
*/
if (!resolved)
return false;
......@@ -1704,21 +1704,21 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
&cmin, &cmax);
/*
* If we haven't resolved the combocid to cmin/cmax, that means we
* have not decoded the combocid yet. That means the cmax is
* If we haven't resolved the combo CID to cmin/cmax, that means we
* have not decoded the combo CID yet. That means the cmax is
* definitely in the future, and we're still supposed to see the
* tuple.
*
* XXX This only applies to decoding of in-progress transactions. In
* regular logical decoding we only execute this code at commit time,
* at which point we should have seen all relevant combocids. So
* at which point we should have seen all relevant combo CIDs. So
* ideally, we should error out in this case but in practice, this
* won't happen. If we are too worried about this then we can add an
* elog inside ResolveCminCmaxDuringDecoding.
*
* XXX For the streaming case, we can track the largest combocid
* XXX For the streaming case, we can track the largest combo CID
* assigned, and error out based on this (when unable to resolve
* combocid below that observed maximum value).
* combo CID below that observed maximum value).
*/
if (!resolved || cmax == InvalidCommandId)
return true;
......
......@@ -149,7 +149,7 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
* planned to non-temporary tables. EXPLAIN is considered read-only.
*
* Don't allow writes in parallel mode. Supporting UPDATE and DELETE
* would require (a) storing the combocid hash in shared memory, rather
* would require (a) storing the combo CID hash in shared memory, rather
* than synchronizing it just once at the start of parallelism, and (b) an
* alternative to heap_update()'s reliance on xmax for mutual exclusion.
* INSERT may have no such troubles, but we forbid it to simplify the
......
......@@ -4736,19 +4736,19 @@ ReorderBufferToastReset(ReorderBuffer *rb, ReorderBufferTXN *txn)
* always rely on stored cmin/cmax values because of two scenarios:
*
* * A tuple got changed multiple times during a single transaction and thus
* has got a combocid. Combocid's are only valid for the duration of a
* has got a combo CID. Combo CIDs are only valid for the duration of a
* single transaction.
* * A tuple with a cmin but no cmax (and thus no combocid) got
* * A tuple with a cmin but no cmax (and thus no combo CID) got
* deleted/updated in another transaction than the one which created it
* which we are looking at right now. As only one of cmin, cmax or combocid
* which we are looking at right now. As only one of cmin, cmax or combo CID
* is actually stored in the heap we don't have access to the value we
* need anymore.
*
* To resolve those problems we have a per-transaction hash of (cmin,
* cmax) tuples keyed by (relfilenode, ctid) which contains the actual
* (cmin, cmax) values. That also takes care of combocids by simply
* (cmin, cmax) values. That also takes care of combo CIDs by simply
* not caring about them at all. As we have the real cmin/cmax values
* combocids aren't interesting.
* combo CIDs aren't interesting.
*
* As we only care about catalog tuples here the overhead of this
* hashtable should be acceptable.
......@@ -4995,7 +4995,7 @@ UpdateLogicalMappings(HTAB *tuplecid_data, Oid relid, Snapshot snapshot)
/*
* Lookup cmin/cmax of a tuple, during logical decoding where we can't rely on
* combocids.
* combo CIDs.
*/
bool
ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data,
......
......@@ -42,7 +42,7 @@
* catalog in a transaction. During normal operation this is achieved by using
* CommandIds/cmin/cmax. The problem with that however is that for space
* efficiency reasons only one value of that is stored
* (cf. combocid.c). Since ComboCids are only available in memory we log
* (cf. combocid.c). Since combo CIDs are only available in memory we log
* additional information which allows us to get the original (cmin, cmax)
* pair during visibility checks. Check the reorderbuffer.c's comment above
* ResolveCminCmaxDuringDecoding() for details.
......@@ -739,7 +739,7 @@ SnapBuildProcessChange(SnapBuild *builder, TransactionId xid, XLogRecPtr lsn)
}
/*
* Do CommandId/ComboCid handling after reading an xl_heap_new_cid record.
* Do CommandId/combo CID handling after reading an xl_heap_new_cid record.
* This implies that a transaction has done some form of write to system
* catalogs.
*/
......
......@@ -14,8 +14,8 @@
* real cmin and cmax using a backend-private array, which is managed by
* this module.
*
* To allow reusing existing combo cids, we also keep a hash table that
* maps cmin,cmax pairs to combo cids. This keeps the data structure size
* To allow reusing existing combo CIDs, we also keep a hash table that
* maps cmin,cmax pairs to combo CIDs. This keeps the data structure size
* reasonable in most cases, since the number of unique pairs used by any
* one transaction is likely to be small.
*
......@@ -49,7 +49,7 @@
#include "utils/hsearch.h"
#include "utils/memutils.h"
/* Hash table to lookup combo cids by cmin and cmax */
/* Hash table to lookup combo CIDs by cmin and cmax */
static HTAB *comboHash = NULL;
/* Key and entry structures for the hash table */
......@@ -75,7 +75,7 @@ typedef ComboCidEntryData *ComboCidEntry;
/*
* An array of cmin,cmax pairs, indexed by combo command id.
* To convert a combo cid to cmin and cmax, you do a simple array lookup.
* To convert a combo CID to cmin and cmax, you do a simple array lookup.
*/
static ComboCidKey comboCids = NULL;
static int usedComboCids = 0; /* number of elements in comboCids */
......@@ -259,11 +259,11 @@ GetComboCommandId(CommandId cmin, CommandId cmax)
if (found)
{
/* Reuse an existing combo cid */
/* Reuse an existing combo CID */
return entry->combocid;
}
/* We have to create a new combo cid; we already made room in the array */
/* We have to create a new combo CID; we already made room in the array */
combocid = usedComboCids;
comboCids[combocid].cmin = cmin;
......@@ -290,7 +290,7 @@ GetRealCmax(CommandId combocid)
}
/*
* Estimate the amount of space required to serialize the current ComboCID
* Estimate the amount of space required to serialize the current combo CID
* state.
*/
Size
......@@ -301,14 +301,14 @@ EstimateComboCIDStateSpace(void)
/* Add space required for saving usedComboCids */
size = sizeof(int);
/* Add space required for saving the combocids key */
/* Add space required for saving ComboCidKeyData */
size = add_size(size, mul_size(sizeof(ComboCidKeyData), usedComboCids));
return size;
}
/*
* Serialize the ComboCID state into the memory, beginning at start_address.
* Serialize the combo CID state into the memory, beginning at start_address.
* maxsize should be at least as large as the value returned by
* EstimateComboCIDStateSpace.
*/
......@@ -317,7 +317,7 @@ SerializeComboCIDState(Size maxsize, char *start_address)
{
char *endptr;
/* First, we store the number of currently-existing ComboCIDs. */
/* First, we store the number of currently-existing combo CIDs. */
*(int *) start_address = usedComboCids;
/* If maxsize is too small, throw an error. */
......@@ -333,9 +333,9 @@ SerializeComboCIDState(Size maxsize, char *start_address)
}
/*
* Read the ComboCID state at the specified address and initialize this
* backend with the same ComboCIDs. This is only valid in a backend that
* currently has no ComboCIDs (and only makes sense if the transaction state
* Read the combo CID state at the specified address and initialize this
* backend with the same combo CIDs. This is only valid in a backend that
* currently has no combo CIDs (and only makes sense if the transaction state
* is serialized and restored as well).
*/
void
......@@ -348,11 +348,11 @@ RestoreComboCIDState(char *comboCIDstate)
Assert(!comboCids && !comboHash);
/* First, we retrieve the number of ComboCIDs that were serialized. */
/* First, we retrieve the number of combo CIDs that were serialized. */
num_elements = *(int *) comboCIDstate;
keydata = (ComboCidKeyData *) (comboCIDstate + sizeof(int));
/* Use GetComboCommandId to restore each ComboCID. */
/* Use GetComboCommandId to restore each combo CID. */
for (i = 0; i < num_elements; i++)
{
cid = GetComboCommandId(keydata[i].cmin, keydata[i].cmax);
......
......@@ -191,7 +191,7 @@ struct HeapTupleHeaderData
#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */
#define HEAP_HASOID_OLD 0x0008 /* has an object-id field */
#define HEAP_XMAX_KEYSHR_LOCK 0x0010 /* xmax is a key-shared locker */
#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */
#define HEAP_COMBOCID 0x0020 /* t_cid is a combo CID */
#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */
#define HEAP_XMAX_LOCK_ONLY 0x0080 /* xmax, if valid, is only a locker */
......
......@@ -51,7 +51,7 @@ SELECT ctid,cmin,* FROM combocidtest;
(0,2) | 1 | 2
(2 rows)
-- Test combo cids with portals
-- Test combo CIDs with portals
BEGIN;
INSERT INTO combocidtest VALUES (333);
DECLARE c CURSOR FOR SELECT ctid,cmin,* FROM combocidtest;
......
......@@ -39,7 +39,7 @@ COMMIT;
-- combo data is not there anymore, but should still see tuples
SELECT ctid,cmin,* FROM combocidtest;
-- Test combo cids with portals
-- Test combo CIDs with portals
BEGIN;
INSERT INTO combocidtest VALUES (333);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment