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))
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)
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)
*
* 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
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())
*/
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);
/*
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);
*
* 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
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())
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);
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))
* 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.
*
/*
* 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.
*/
/*
* 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)
{
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
{
/*
/*
* 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,
&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;
&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;
* 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
* 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.
/*
* Lookup cmin/cmax of a tuple, during logical decoding where we can't rely on
- * combocids.
+ * combo CIDs.
*/
bool
ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data,
* 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.
}
/*
- * 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.
*/
* 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.
*
#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 */
/*
* 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 */
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;
}
/*
- * 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
/* 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.
*/
{
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. */
}
/*
- * 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
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);
#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 */
(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;
-- 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);