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