PostgreSQL Source Code git master
htup.h File Reference
#include "storage/itemptr.h"
Include dependency graph for htup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HeapTupleData
 

Macros

#define FIELDNO_HEAPTUPLEDATA_DATA   3
 
#define HEAPTUPLESIZE   MAXALIGN(sizeof(HeapTupleData))
 
#define HeapTupleIsValid(tuple)   PointerIsValid(tuple)
 

Typedefs

typedef struct HeapTupleHeaderData HeapTupleHeaderData
 
typedef HeapTupleHeaderDataHeapTupleHeader
 
typedef struct MinimalTupleData MinimalTupleData
 
typedef MinimalTupleDataMinimalTuple
 
typedef struct HeapTupleData HeapTupleData
 
typedef HeapTupleDataHeapTuple
 

Functions

CommandId HeapTupleHeaderGetCmin (const HeapTupleHeaderData *tup)
 
CommandId HeapTupleHeaderGetCmax (const HeapTupleHeaderData *tup)
 
void HeapTupleHeaderAdjustCmax (const HeapTupleHeaderData *tup, CommandId *cmax, bool *iscombo)
 
TransactionId HeapTupleGetUpdateXid (const HeapTupleHeaderData *tup)
 

Macro Definition Documentation

◆ FIELDNO_HEAPTUPLEDATA_DATA

#define FIELDNO_HEAPTUPLEDATA_DATA   3

Definition at line 67 of file htup.h.

◆ HeapTupleIsValid

#define HeapTupleIsValid (   tuple)    PointerIsValid(tuple)

Definition at line 78 of file htup.h.

◆ HEAPTUPLESIZE

#define HEAPTUPLESIZE   MAXALIGN(sizeof(HeapTupleData))

Definition at line 73 of file htup.h.

Typedef Documentation

◆ HeapTuple

Definition at line 71 of file htup.h.

◆ HeapTupleData

typedef struct HeapTupleData HeapTupleData

◆ HeapTupleHeader

Definition at line 23 of file htup.h.

◆ HeapTupleHeaderData

Definition at line 21 of file htup.h.

◆ MinimalTuple

Definition at line 27 of file htup.h.

◆ MinimalTupleData

Definition at line 25 of file htup.h.

Function Documentation

◆ HeapTupleGetUpdateXid()

TransactionId HeapTupleGetUpdateXid ( const HeapTupleHeaderData tup)

◆ HeapTupleHeaderAdjustCmax()

void HeapTupleHeaderAdjustCmax ( const HeapTupleHeaderData tup,
CommandId cmax,
bool *  iscombo 
)

Definition at line 153 of file combocid.c.

156{
157 /*
158 * If we're marking a tuple deleted that was inserted by (any
159 * subtransaction of) our transaction, we need to use a combo command id.
160 * Test for HeapTupleHeaderXminCommitted() first, because it's cheaper
161 * than a TransactionIdIsCurrentTransactionId call.
162 */
165 {
167
168 *cmax = GetComboCommandId(cmin, *cmax);
169 *iscombo = true;
170 }
171 else
172 {
173 *iscombo = false;
174 }
175}
uint32 CommandId
Definition: c.h:623
CommandId HeapTupleHeaderGetCmin(const HeapTupleHeaderData *tup)
Definition: combocid.c:104
static CommandId GetComboCommandId(CommandId cmin, CommandId cmax)
Definition: combocid.c:204
static TransactionId HeapTupleHeaderGetRawXmin(const HeapTupleHeaderData *tup)
Definition: htup_details.h:318
static bool HeapTupleHeaderXminCommitted(const HeapTupleHeaderData *tup)
Definition: htup_details.h:337
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:940

References GetComboCommandId(), HeapTupleHeaderGetCmin(), HeapTupleHeaderGetRawXmin(), HeapTupleHeaderXminCommitted(), and TransactionIdIsCurrentTransactionId().

Referenced by heap_delete(), and heap_update().

◆ HeapTupleHeaderGetCmax()

CommandId HeapTupleHeaderGetCmax ( const HeapTupleHeaderData tup)

Definition at line 118 of file combocid.c.

119{
121
122 Assert(!(tup->t_infomask & HEAP_MOVED));
123
124 /*
125 * Because GetUpdateXid() performs memory allocations if xmax is a
126 * multixact we can't Assert() if we're inside a critical section. This
127 * weakens the check, but not using GetCmax() inside one would complicate
128 * things too much.
129 */
132
133 if (tup->t_infomask & HEAP_COMBOCID)
134 return GetRealCmax(cid);
135 else
136 return cid;
137}
#define Assert(condition)
Definition: c.h:815
static CommandId GetRealCmax(CommandId combocid)
Definition: combocid.c:286
volatile uint32 CritSectionCount
Definition: globals.c:44
static CommandId HeapTupleHeaderGetRawCommandId(const HeapTupleHeaderData *tup)
Definition: htup_details.h:415
#define HEAP_MOVED
Definition: htup_details.h:213
#define HEAP_COMBOCID
Definition: htup_details.h:195
static TransactionId HeapTupleHeaderGetUpdateXid(const HeapTupleHeaderData *tup)
Definition: htup_details.h:397

References Assert, CritSectionCount, GetRealCmax(), HEAP_COMBOCID, HEAP_MOVED, HeapTupleHeaderGetRawCommandId(), HeapTupleHeaderGetUpdateXid(), HeapTupleHeaderData::t_infomask, and TransactionIdIsCurrentTransactionId().

Referenced by heap_delete(), heap_lock_tuple(), heap_update(), HeapTupleSatisfiesMVCC(), HeapTupleSatisfiesUpdate(), and log_heap_new_cid().

◆ HeapTupleHeaderGetCmin()

CommandId HeapTupleHeaderGetCmin ( const HeapTupleHeaderData tup)

Definition at line 104 of file combocid.c.

105{
107
108 Assert(!(tup->t_infomask & HEAP_MOVED));
110
111 if (tup->t_infomask & HEAP_COMBOCID)
112 return GetRealCmin(cid);
113 else
114 return cid;
115}
static CommandId GetRealCmin(CommandId combocid)
Definition: combocid.c:279
static TransactionId HeapTupleHeaderGetXmin(const HeapTupleHeaderData *tup)
Definition: htup_details.h:324

References Assert, GetRealCmin(), HEAP_COMBOCID, HEAP_MOVED, HeapTupleHeaderGetRawCommandId(), HeapTupleHeaderGetXmin(), HeapTupleHeaderData::t_infomask, and TransactionIdIsCurrentTransactionId().

Referenced by heapam_tuple_lock(), HeapTupleHeaderAdjustCmax(), HeapTupleSatisfiesMVCC(), HeapTupleSatisfiesUpdate(), and log_heap_new_cid().