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 (HeapTupleHeader tup)
 
CommandId HeapTupleHeaderGetCmax (HeapTupleHeader tup)
 
void HeapTupleHeaderAdjustCmax (HeapTupleHeader tup, CommandId *cmax, bool *iscombo)
 
TransactionId HeapTupleGetUpdateXid (HeapTupleHeader tuple)
 

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 1 of file htup.h.

◆ MinimalTuple

Definition at line 27 of file htup.h.

◆ MinimalTupleData

Definition at line 23 of file htup.h.

Function Documentation

◆ HeapTupleGetUpdateXid()

◆ HeapTupleHeaderAdjustCmax()

void HeapTupleHeaderAdjustCmax ( HeapTupleHeader  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  */
163  if (!HeapTupleHeaderXminCommitted(tup) &&
165  {
166  CommandId cmin = HeapTupleHeaderGetCmin(tup);
167 
168  *cmax = GetComboCommandId(cmin, *cmax);
169  *iscombo = true;
170  }
171  else
172  {
173  *iscombo = false;
174  }
175 }
uint32 CommandId
Definition: c.h:602
CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup)
Definition: combocid.c:104
static CommandId GetComboCommandId(CommandId cmin, CommandId cmax)
Definition: combocid.c:204
#define HeapTupleHeaderGetRawXmin(tup)
Definition: htup_details.h:303
#define HeapTupleHeaderXminCommitted(tup)
Definition: htup_details.h:319
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:925

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

Referenced by heap_delete(), and heap_update().

◆ HeapTupleHeaderGetCmax()

CommandId HeapTupleHeaderGetCmax ( HeapTupleHeader  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  */
130  Assert(CritSectionCount > 0 ||
132 
133  if (tup->t_infomask & HEAP_COMBOCID)
134  return GetRealCmax(cid);
135  else
136  return cid;
137 }
static CommandId GetRealCmax(CommandId combocid)
Definition: combocid.c:286
volatile uint32 CritSectionCount
Definition: globals.c:42
#define HEAP_MOVED
Definition: htup_details.h:212
#define HEAP_COMBOCID
Definition: htup_details.h:194
#define HeapTupleHeaderGetUpdateXid(tup)
Definition: htup_details.h:360
#define HeapTupleHeaderGetRawCommandId(tup)
Definition: htup_details.h:386
Assert(fmt[strlen(fmt) - 1] !='\n')

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 ( HeapTupleHeader  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
#define HeapTupleHeaderGetXmin(tup)
Definition: htup_details.h:308

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().