PostgreSQL Source Code  git master
heapam.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * heapam.h
4  * POSTGRES heap access method definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/access/heapam.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef HEAPAM_H
15 #define HEAPAM_H
16 
17 #include "access/relation.h" /* for backward compatibility */
18 #include "access/relscan.h"
19 #include "access/sdir.h"
20 #include "access/skey.h"
21 #include "access/table.h" /* for backward compatibility */
22 #include "access/tableam.h"
23 #include "nodes/lockoptions.h"
24 #include "nodes/primnodes.h"
25 #include "storage/bufpage.h"
26 #include "storage/dsm.h"
27 #include "storage/lockdefs.h"
28 #include "storage/read_stream.h"
29 #include "storage/shm_toc.h"
30 #include "utils/relcache.h"
31 #include "utils/snapshot.h"
32 
33 
34 /* "options" flag bits for heap_insert */
35 #define HEAP_INSERT_SKIP_FSM TABLE_INSERT_SKIP_FSM
36 #define HEAP_INSERT_FROZEN TABLE_INSERT_FROZEN
37 #define HEAP_INSERT_NO_LOGICAL TABLE_INSERT_NO_LOGICAL
38 #define HEAP_INSERT_SPECULATIVE 0x0010
39 
40 /* "options" flag bits for heap_page_prune_and_freeze */
41 #define HEAP_PAGE_PRUNE_MARK_UNUSED_NOW (1 << 0)
42 #define HEAP_PAGE_PRUNE_FREEZE (1 << 1)
43 
45 struct TupleTableSlot;
46 struct VacuumCutoffs;
47 
48 #define MaxLockTupleMode LockTupleExclusive
49 
50 /*
51  * Descriptor for heap table scans.
52  */
53 typedef struct HeapScanDescData
54 {
55  TableScanDescData rs_base; /* AM independent part of the descriptor */
56 
57  /* state set up at initscan time */
58  BlockNumber rs_nblocks; /* total number of blocks in rel */
59  BlockNumber rs_startblock; /* block # to start at */
60  BlockNumber rs_numblocks; /* max number of blocks to scan */
61  /* rs_numblocks is usually InvalidBlockNumber, meaning "scan whole rel" */
62 
63  /* scan current state */
64  bool rs_inited; /* false = scan not init'd yet */
65  OffsetNumber rs_coffset; /* current offset # in non-page-at-a-time mode */
66  BlockNumber rs_cblock; /* current block # in scan, if any */
67  Buffer rs_cbuf; /* current buffer in scan, if any */
68  /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
69 
70  BufferAccessStrategy rs_strategy; /* access strategy for reads */
71 
72  HeapTupleData rs_ctup; /* current tuple in scan, if any */
73 
74  /* For scans that stream reads */
76 
77  /*
78  * For sequential scans and TID range scans to stream reads. The read
79  * stream is allocated at the beginning of the scan and reset on rescan or
80  * when the scan direction changes. The scan direction is saved each time
81  * a new page is requested. If the scan direction changes from one page to
82  * the next, the read stream releases all previously pinned buffers and
83  * resets the prefetch block.
84  */
87 
88  /*
89  * For parallel scans to store page allocation data. NULL when not
90  * performing a parallel scan.
91  */
93 
94  /*
95  * These fields are only used for bitmap scans for the "skip fetch"
96  * optimization. Bitmap scans needing no fields from the heap may skip
97  * fetching an all visible block, instead using the number of tuples per
98  * block reported by the bitmap to determine how many NULL-filled tuples
99  * to return.
100  */
103 
104  /* these fields only used in page-at-a-time mode and for bitmap scans */
105  int rs_cindex; /* current tuple's index in vistuples */
106  int rs_ntuples; /* number of visible tuples on page */
110 
111 /*
112  * Descriptor for fetches from heap via an index.
113  */
114 typedef struct IndexFetchHeapData
115 {
116  IndexFetchTableData xs_base; /* AM independent part of the descriptor */
117 
118  Buffer xs_cbuf; /* current heap buffer in scan, if any */
119  /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
121 
122 /* Result codes for HeapTupleSatisfiesVacuum */
123 typedef enum
124 {
125  HEAPTUPLE_DEAD, /* tuple is dead and deletable */
126  HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
127  HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
128  HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
129  HEAPTUPLE_DELETE_IN_PROGRESS, /* deleting xact is still in progress */
130 } HTSV_Result;
131 
132 /*
133  * heap_prepare_freeze_tuple may request that heap_freeze_execute_prepared
134  * check any tuple's to-be-frozen xmin and/or xmax status using pg_xact
135  */
136 #define HEAP_FREEZE_CHECK_XMIN_COMMITTED 0x01
137 #define HEAP_FREEZE_CHECK_XMAX_ABORTED 0x02
138 
139 /* heap_prepare_freeze_tuple state describing how to freeze a tuple */
140 typedef struct HeapTupleFreeze
141 {
142  /* Fields describing how to process tuple */
147 
148  /* xmin/xmax check flags */
150  /* Page offset number for tuple */
153 
154 /*
155  * State used by VACUUM to track the details of freezing all eligible tuples
156  * on a given heap page.
157  *
158  * VACUUM prepares freeze plans for each page via heap_prepare_freeze_tuple
159  * calls (every tuple with storage gets its own call). This page-level freeze
160  * state is updated across each call, which ultimately determines whether or
161  * not freezing the page is required.
162  *
163  * Aside from the basic question of whether or not freezing will go ahead, the
164  * state also tracks the oldest extant XID/MXID in the table as a whole, for
165  * the purposes of advancing relfrozenxid/relminmxid values in pg_class later
166  * on. Each heap_prepare_freeze_tuple call pushes NewRelfrozenXid and/or
167  * NewRelminMxid back as required to avoid unsafe final pg_class values. Any
168  * and all unfrozen XIDs or MXIDs that remain after VACUUM finishes _must_
169  * have values >= the final relfrozenxid/relminmxid values in pg_class. This
170  * includes XIDs that remain as MultiXact members from any tuple's xmax.
171  *
172  * When 'freeze_required' flag isn't set after all tuples are examined, the
173  * final choice on freezing is made by vacuumlazy.c. It can decide to trigger
174  * freezing based on whatever criteria it deems appropriate. However, it is
175  * recommended that vacuumlazy.c avoid early freezing when freezing does not
176  * enable setting the target page all-frozen in the visibility map afterwards.
177  */
178 typedef struct HeapPageFreeze
179 {
180  /* Is heap_prepare_freeze_tuple caller required to freeze page? */
182 
183  /*
184  * "Freeze" NewRelfrozenXid/NewRelminMxid trackers.
185  *
186  * Trackers used when heap_freeze_execute_prepared freezes, or when there
187  * are zero freeze plans for a page. It is always valid for vacuumlazy.c
188  * to freeze any page, by definition. This even includes pages that have
189  * no tuples with storage to consider in the first place. That way the
190  * 'totally_frozen' results from heap_prepare_freeze_tuple can always be
191  * used in the same way, even when no freeze plans need to be executed to
192  * "freeze the page". Only the "freeze" path needs to consider the need
193  * to set pages all-frozen in the visibility map under this scheme.
194  *
195  * When we freeze a page, we generally freeze all XIDs < OldestXmin, only
196  * leaving behind XIDs that are ineligible for freezing, if any. And so
197  * you might wonder why these trackers are necessary at all; why should
198  * _any_ page that VACUUM freezes _ever_ be left with XIDs/MXIDs that
199  * ratchet back the top-level NewRelfrozenXid/NewRelminMxid trackers?
200  *
201  * It is useful to use a definition of "freeze the page" that does not
202  * overspecify how MultiXacts are affected. heap_prepare_freeze_tuple
203  * generally prefers to remove Multis eagerly, but lazy processing is used
204  * in cases where laziness allows VACUUM to avoid allocating a new Multi.
205  * The "freeze the page" trackers enable this flexibility.
206  */
209 
210  /*
211  * "No freeze" NewRelfrozenXid/NewRelminMxid trackers.
212  *
213  * These trackers are maintained in the same way as the trackers used when
214  * VACUUM scans a page that isn't cleanup locked. Both code paths are
215  * based on the same general idea (do less work for this page during the
216  * ongoing VACUUM, at the cost of having to accept older final values).
217  */
220 
222 
223 /*
224  * Per-page state returned by heap_page_prune_and_freeze()
225  */
226 typedef struct PruneFreezeResult
227 {
228  int ndeleted; /* Number of tuples deleted from the page */
229  int nnewlpdead; /* Number of newly LP_DEAD items */
230  int nfrozen; /* Number of tuples we froze */
231 
232  /* Number of live and recently dead tuples on the page, after pruning */
235 
236  /*
237  * all_visible and all_frozen indicate if the all-visible and all-frozen
238  * bits in the visibility map can be set for this page, after pruning.
239  *
240  * vm_conflict_horizon is the newest xmin of live tuples on the page. The
241  * caller can use it as the conflict horizon when setting the VM bits. It
242  * is only valid if we froze some tuples (nfrozen > 0), and all_frozen is
243  * true.
244  *
245  * These are only set if the HEAP_PRUNE_FREEZE option is set.
246  */
250 
251  /*
252  * Whether or not the page makes rel truncation unsafe. This is set to
253  * 'true', even if the page contains LP_DEAD items. VACUUM will remove
254  * them before attempting to truncate.
255  */
256  bool hastup;
257 
258  /*
259  * LP_DEAD items on the page after pruning. Includes existing LP_DEAD
260  * items.
261  */
265 
266 /* 'reason' codes for heap_page_prune_and_freeze() */
267 typedef enum
268 {
269  PRUNE_ON_ACCESS, /* on-access pruning */
270  PRUNE_VACUUM_SCAN, /* VACUUM 1st heap pass */
271  PRUNE_VACUUM_CLEANUP, /* VACUUM 2nd heap pass */
272 } PruneReason;
273 
274 /* ----------------
275  * function prototypes for heap access method
276  *
277  * heap_create, heap_create_with_catalog, and heap_drop_with_catalog
278  * are declared in catalog/heap.h
279  * ----------------
280  */
281 
282 
283 /*
284  * HeapScanIsValid
285  * True iff the heap scan is valid.
286  */
287 #define HeapScanIsValid(scan) PointerIsValid(scan)
288 
289 extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
290  int nkeys, ScanKey key,
291  ParallelTableScanDesc parallel_scan,
292  uint32 flags);
293 extern void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk,
294  BlockNumber numBlks);
295 extern void heap_prepare_pagescan(TableScanDesc sscan);
296 extern void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
297  bool allow_strat, bool allow_sync, bool allow_pagemode);
298 extern void heap_endscan(TableScanDesc sscan);
299 extern HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction);
300 extern bool heap_getnextslot(TableScanDesc sscan,
301  ScanDirection direction, struct TupleTableSlot *slot);
302 extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid,
303  ItemPointer maxtid);
304 extern bool heap_getnextslot_tidrange(TableScanDesc sscan,
305  ScanDirection direction,
306  TupleTableSlot *slot);
307 extern bool heap_fetch(Relation relation, Snapshot snapshot,
308  HeapTuple tuple, Buffer *userbuf, bool keep_buf);
309 extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation,
310  Buffer buffer, Snapshot snapshot, HeapTuple heapTuple,
311  bool *all_dead, bool first_call);
312 
313 extern void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid);
314 
317 extern void ReleaseBulkInsertStatePin(BulkInsertState bistate);
318 
319 extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid,
320  int options, BulkInsertState bistate);
321 extern void heap_multi_insert(Relation relation, struct TupleTableSlot **slots,
322  int ntuples, CommandId cid, int options,
323  BulkInsertState bistate);
324 extern TM_Result heap_delete(Relation relation, ItemPointer tid,
325  CommandId cid, Snapshot crosscheck, bool wait,
326  struct TM_FailureData *tmfd, bool changingPart);
327 extern void heap_finish_speculative(Relation relation, ItemPointer tid);
328 extern void heap_abort_speculative(Relation relation, ItemPointer tid);
329 extern TM_Result heap_update(Relation relation, ItemPointer otid,
330  HeapTuple newtup,
331  CommandId cid, Snapshot crosscheck, bool wait,
332  struct TM_FailureData *tmfd, LockTupleMode *lockmode,
333  TU_UpdateIndexes *update_indexes);
334 extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple,
335  CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy,
336  bool follow_updates,
337  Buffer *buffer, struct TM_FailureData *tmfd);
338 
339 extern void heap_inplace_update(Relation relation, HeapTuple tuple);
341  const struct VacuumCutoffs *cutoffs,
342  HeapPageFreeze *pagefrz,
343  HeapTupleFreeze *frz, bool *totally_frozen);
344 
345 extern void heap_pre_freeze_checks(Buffer buffer,
346  HeapTupleFreeze *tuples, int ntuples);
347 extern void heap_freeze_prepared_tuples(Buffer buffer,
348  HeapTupleFreeze *tuples, int ntuples);
349 extern bool heap_freeze_tuple(HeapTupleHeader tuple,
350  TransactionId relfrozenxid, TransactionId relminmxid,
351  TransactionId FreezeLimit, TransactionId MultiXactCutoff);
352 extern bool heap_tuple_should_freeze(HeapTupleHeader tuple,
353  const struct VacuumCutoffs *cutoffs,
354  TransactionId *NoFreezePageRelfrozenXid,
355  MultiXactId *NoFreezePageRelminMxid);
357 
358 extern void simple_heap_insert(Relation relation, HeapTuple tup);
359 extern void simple_heap_delete(Relation relation, ItemPointer tid);
360 extern void simple_heap_update(Relation relation, ItemPointer otid,
361  HeapTuple tup, TU_UpdateIndexes *update_indexes);
362 
364  TM_IndexDeleteOp *delstate);
365 
366 /* in heap/pruneheap.c */
367 struct GlobalVisState;
368 extern void heap_page_prune_opt(Relation relation, Buffer buffer);
369 extern void heap_page_prune_and_freeze(Relation relation, Buffer buffer,
370  struct GlobalVisState *vistest,
371  int options,
372  struct VacuumCutoffs *cutoffs,
373  PruneFreezeResult *presult,
374  PruneReason reason,
375  OffsetNumber *off_loc,
376  TransactionId *new_relfrozen_xid,
377  MultiXactId *new_relmin_mxid);
378 extern void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only,
379  OffsetNumber *redirected, int nredirected,
380  OffsetNumber *nowdead, int ndead,
381  OffsetNumber *nowunused, int nunused);
382 extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets);
383 extern void log_heap_prune_and_freeze(Relation relation, Buffer buffer,
384  TransactionId conflict_xid,
385  bool cleanup_lock,
386  PruneReason reason,
387  HeapTupleFreeze *frozen, int nfrozen,
388  OffsetNumber *redirected, int nredirected,
389  OffsetNumber *dead, int ndead,
390  OffsetNumber *unused, int nunused);
391 
392 /* in heap/vacuumlazy.c */
393 struct VacuumParams;
394 extern void heap_vacuum_rel(Relation rel,
395  struct VacuumParams *params, BufferAccessStrategy bstrategy);
396 
397 /* in heap/heapam_visibility.c */
398 extern bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot,
399  Buffer buffer);
401  Buffer buffer);
403  Buffer buffer);
405  TransactionId *dead_after);
406 extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
407  uint16 infomask, TransactionId xid);
409 extern bool HeapTupleIsSurelyDead(HeapTuple htup,
410  struct GlobalVisState *vistest);
411 
412 /*
413  * To avoid leaking too much knowledge about reorderbuffer implementation
414  * details this is implemented in reorderbuffer.c not heapam_visibility.c
415  */
416 struct HTAB;
418  Snapshot snapshot,
419  HeapTuple htup,
420  Buffer buffer,
421  CommandId *cmin, CommandId *cmax);
422 extern void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple,
423  Buffer buffer, Snapshot snapshot);
424 
425 #endif /* HEAPAM_H */
uint32 BlockNumber
Definition: block.h:31
int Buffer
Definition: buf.h:23
Pointer Page
Definition: bufpage.h:78
unsigned short uint16
Definition: c.h:505
unsigned int uint32
Definition: c.h:506
TransactionId MultiXactId
Definition: c.h:662
unsigned char uint8
Definition: c.h:504
uint32 CommandId
Definition: c.h:666
uint32 TransactionId
Definition: c.h:652
void heap_finish_speculative(Relation relation, ItemPointer tid)
Definition: heapam.c:5819
void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate)
Definition: heapam.c:1994
struct HeapTupleFreeze HeapTupleFreeze
struct PruneFreezeResult PruneFreezeResult
void heap_page_prune_and_freeze(Relation relation, Buffer buffer, struct GlobalVisState *vistest, int options, struct VacuumCutoffs *cutoffs, PruneFreezeResult *presult, PruneReason reason, OffsetNumber *off_loc, TransactionId *new_relfrozen_xid, MultiXactId *new_relmin_mxid)
Definition: pruneheap.c:348
bool heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tuple, Buffer *userbuf, bool keep_buf)
Definition: heapam.c:1511
void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer, uint16 infomask, TransactionId xid)
bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot, Buffer buffer)
HTSV_Result HeapTupleSatisfiesVacuumHorizon(HeapTuple htup, Buffer buffer, TransactionId *dead_after)
struct HeapScanDescData * HeapScanDesc
Definition: heapam.h:109
bool HeapTupleIsSurelyDead(HeapTuple htup, struct GlobalVisState *vistest)
void simple_heap_delete(Relation relation, ItemPointer tid)
Definition: heapam.c:3104
void heap_get_root_tuples(Page page, OffsetNumber *root_offsets)
Definition: pruneheap.c:1764
void heap_vacuum_rel(Relation rel, struct VacuumParams *params, BufferAccessStrategy bstrategy)
Definition: vacuumlazy.c:295
void heap_page_prune_opt(Relation relation, Buffer buffer)
Definition: pruneheap.c:193
HTSV_Result
Definition: heapam.h:124
@ HEAPTUPLE_RECENTLY_DEAD
Definition: heapam.h:127
@ HEAPTUPLE_INSERT_IN_PROGRESS
Definition: heapam.h:128
@ HEAPTUPLE_LIVE
Definition: heapam.h:126
@ HEAPTUPLE_DELETE_IN_PROGRESS
Definition: heapam.h:129
@ HEAPTUPLE_DEAD
Definition: heapam.h:125
void heap_endscan(TableScanDesc sscan)
Definition: heapam.c:1210
void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
Definition: heapam.c:1152
bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple)
Definition: heapam.c:7328
bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, Snapshot snapshot, HeapTuple htup, Buffer buffer, CommandId *cmin, CommandId *cmax)
void heap_inplace_update(Relation relation, HeapTuple tuple)
Definition: heapam.c:6063
TM_Result heap_delete(Relation relation, ItemPointer tid, CommandId cid, Snapshot crosscheck, bool wait, struct TM_FailureData *tmfd, bool changingPart)
Definition: heapam.c:2683
bool heap_tuple_should_freeze(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, TransactionId *NoFreezePageRelfrozenXid, MultiXactId *NoFreezePageRelminMxid)
Definition: heapam.c:7383
bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId FreezeLimit, TransactionId MultiXactCutoff)
Definition: heapam.c:6922
struct HeapPageFreeze HeapPageFreeze
void ReleaseBulkInsertStatePin(BulkInsertState bistate)
Definition: heapam.c:1956
void log_heap_prune_and_freeze(Relation relation, Buffer buffer, TransactionId conflict_xid, bool cleanup_lock, PruneReason reason, HeapTupleFreeze *frozen, int nfrozen, OffsetNumber *redirected, int nredirected, OffsetNumber *dead, int ndead, OffsetNumber *unused, int nunused)
Definition: pruneheap.c:2032
void heap_multi_insert(Relation relation, struct TupleTableSlot **slots, int ntuples, CommandId cid, int options, BulkInsertState bistate)
Definition: heapam.c:2263
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition: heapam.c:1252
bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call)
Definition: heapam.c:1631
void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup, TU_UpdateIndexes *update_indexes)
Definition: heapam.c:4221
void heap_freeze_prepared_tuples(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition: heapam.c:6900
bool heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
Definition: heapam.c:1404
void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
Definition: heapam.c:1331
HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer)
struct HeapScanDescData HeapScanDescData
void heap_abort_speculative(Relation relation, ItemPointer tid)
Definition: heapam.c:5906
TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, ParallelTableScanDesc parallel_scan, uint32 flags)
Definition: heapam.c:1038
bool heap_getnextslot(TableScanDesc sscan, ScanDirection direction, struct TupleTableSlot *slot)
Definition: heapam.c:1301
void heap_prepare_pagescan(TableScanDesc sscan)
Definition: heapam.c:494
void simple_heap_insert(Relation relation, HeapTuple tup)
Definition: heapam.c:2625
bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, HeapPageFreeze *pagefrz, HeapTupleFreeze *frz, bool *totally_frozen)
Definition: heapam.c:6550
TM_Result heap_update(Relation relation, ItemPointer otid, HeapTuple newtup, CommandId cid, Snapshot crosscheck, bool wait, struct TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
Definition: heapam.c:3150
TransactionId heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
Definition: heapam.c:7636
bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple)
TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, bool follow_updates, Buffer *buffer, struct TM_FailureData *tmfd)
Definition: heapam.c:4310
PruneReason
Definition: heapam.h:268
@ PRUNE_VACUUM_CLEANUP
Definition: heapam.h:271
@ PRUNE_ON_ACCESS
Definition: heapam.h:269
@ PRUNE_VACUUM_SCAN
Definition: heapam.h:270
void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only, OffsetNumber *redirected, int nredirected, OffsetNumber *nowdead, int ndead, OffsetNumber *nowunused, int nunused)
Definition: pruneheap.c:1540
TM_Result HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, Buffer buffer)
struct BulkInsertStateData * BulkInsertState
Definition: heapam.h:44
void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid)
Definition: heapam.c:1783
void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk, BlockNumber numBlks)
Definition: heapam.c:422
void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: heapam.c:10061
struct IndexFetchHeapData IndexFetchHeapData
void FreeBulkInsertState(BulkInsertState)
Definition: heapam.c:1944
void heap_pre_freeze_checks(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition: heapam.c:6847
BulkInsertState GetBulkInsertState(void)
Definition: heapam.c:1927
#define MaxHeapTuplesPerPage
Definition: htup_details.h:572
LockWaitPolicy
Definition: lockoptions.h:37
LockTupleMode
Definition: lockoptions.h:50
uint16 OffsetNumber
Definition: off.h:24
static PgChecksumMode mode
Definition: pg_checksums.c:56
ScanDirection
Definition: sdir.h:25
static HTAB * tuplecid_data
Definition: snapmgr.c:102
Definition: dynahash.c:220
MultiXactId NoFreezePageRelminMxid
Definition: heapam.h:219
TransactionId FreezePageRelfrozenXid
Definition: heapam.h:207
bool freeze_required
Definition: heapam.h:181
MultiXactId FreezePageRelminMxid
Definition: heapam.h:208
TransactionId NoFreezePageRelfrozenXid
Definition: heapam.h:218
Buffer rs_vmbuffer
Definition: heapam.h:101
BufferAccessStrategy rs_strategy
Definition: heapam.h:70
ScanDirection rs_dir
Definition: heapam.h:85
OffsetNumber rs_coffset
Definition: heapam.h:65
bool rs_inited
Definition: heapam.h:64
Buffer rs_cbuf
Definition: heapam.h:67
ParallelBlockTableScanWorkerData * rs_parallelworkerdata
Definition: heapam.h:92
BlockNumber rs_startblock
Definition: heapam.h:59
HeapTupleData rs_ctup
Definition: heapam.h:72
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]
Definition: heapam.h:107
BlockNumber rs_numblocks
Definition: heapam.h:60
BlockNumber rs_nblocks
Definition: heapam.h:58
ReadStream * rs_read_stream
Definition: heapam.h:75
int rs_empty_tuples_pending
Definition: heapam.h:102
BlockNumber rs_prefetch_block
Definition: heapam.h:86
BlockNumber rs_cblock
Definition: heapam.h:66
TableScanDescData rs_base
Definition: heapam.h:55
uint8 frzflags
Definition: heapam.h:146
uint16 t_infomask2
Definition: heapam.h:144
TransactionId xmax
Definition: heapam.h:143
OffsetNumber offset
Definition: heapam.h:151
uint8 checkflags
Definition: heapam.h:149
uint16 t_infomask
Definition: heapam.h:145
Buffer xs_cbuf
Definition: heapam.h:118
IndexFetchTableData xs_base
Definition: heapam.h:116
int recently_dead_tuples
Definition: heapam.h:234
TransactionId vm_conflict_horizon
Definition: heapam.h:249
OffsetNumber deadoffsets[MaxHeapTuplesPerPage]
Definition: heapam.h:263
bool all_visible
Definition: heapam.h:247
TU_UpdateIndexes
Definition: tableam.h:118
TM_Result
Definition: tableam.h:80