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-2025, 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
46struct TupleTableSlot;
47struct VacuumCutoffs;
48
49#define MaxLockTupleMode LockTupleExclusive
50
51/*
52 * Descriptor for heap table scans.
53 */
54typedef 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 /* these fields only used in page-at-a-time mode and for bitmap scans */
96 uint32 rs_cindex; /* current tuple's index in vistuples */
97 uint32 rs_ntuples; /* number of visible tuples on page */
101
103{
105
106 /*
107 * These fields are only used for bitmap scans for the "skip fetch"
108 * optimization. Bitmap scans needing no fields from the heap may skip
109 * fetching an all visible block, instead using the number of tuples per
110 * block reported by the bitmap to determine how many NULL-filled tuples
111 * to return. They are common to parallel and serial BitmapHeapScans
112 */
113
114 /* page of VM containing info for current block */
119
120/*
121 * Descriptor for fetches from heap via an index.
122 */
123typedef struct IndexFetchHeapData
124{
125 IndexFetchTableData xs_base; /* AM independent part of the descriptor */
126
127 Buffer xs_cbuf; /* current heap buffer in scan, if any */
128 /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
130
131/* Result codes for HeapTupleSatisfiesVacuum */
132typedef enum
133{
134 HEAPTUPLE_DEAD, /* tuple is dead and deletable */
135 HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
136 HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
137 HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
138 HEAPTUPLE_DELETE_IN_PROGRESS, /* deleting xact is still in progress */
140
141/*
142 * heap_prepare_freeze_tuple may request that heap_freeze_execute_prepared
143 * check any tuple's to-be-frozen xmin and/or xmax status using pg_xact
144 */
145#define HEAP_FREEZE_CHECK_XMIN_COMMITTED 0x01
146#define HEAP_FREEZE_CHECK_XMAX_ABORTED 0x02
147
148/* heap_prepare_freeze_tuple state describing how to freeze a tuple */
149typedef struct HeapTupleFreeze
150{
151 /* Fields describing how to process tuple */
156
157 /* xmin/xmax check flags */
159 /* Page offset number for tuple */
162
163/*
164 * State used by VACUUM to track the details of freezing all eligible tuples
165 * on a given heap page.
166 *
167 * VACUUM prepares freeze plans for each page via heap_prepare_freeze_tuple
168 * calls (every tuple with storage gets its own call). This page-level freeze
169 * state is updated across each call, which ultimately determines whether or
170 * not freezing the page is required.
171 *
172 * Aside from the basic question of whether or not freezing will go ahead, the
173 * state also tracks the oldest extant XID/MXID in the table as a whole, for
174 * the purposes of advancing relfrozenxid/relminmxid values in pg_class later
175 * on. Each heap_prepare_freeze_tuple call pushes NewRelfrozenXid and/or
176 * NewRelminMxid back as required to avoid unsafe final pg_class values. Any
177 * and all unfrozen XIDs or MXIDs that remain after VACUUM finishes _must_
178 * have values >= the final relfrozenxid/relminmxid values in pg_class. This
179 * includes XIDs that remain as MultiXact members from any tuple's xmax.
180 *
181 * When 'freeze_required' flag isn't set after all tuples are examined, the
182 * final choice on freezing is made by vacuumlazy.c. It can decide to trigger
183 * freezing based on whatever criteria it deems appropriate. However, it is
184 * recommended that vacuumlazy.c avoid early freezing when freezing does not
185 * enable setting the target page all-frozen in the visibility map afterwards.
186 */
187typedef struct HeapPageFreeze
188{
189 /* Is heap_prepare_freeze_tuple caller required to freeze page? */
191
192 /*
193 * "Freeze" NewRelfrozenXid/NewRelminMxid trackers.
194 *
195 * Trackers used when heap_freeze_execute_prepared freezes, or when there
196 * are zero freeze plans for a page. It is always valid for vacuumlazy.c
197 * to freeze any page, by definition. This even includes pages that have
198 * no tuples with storage to consider in the first place. That way the
199 * 'totally_frozen' results from heap_prepare_freeze_tuple can always be
200 * used in the same way, even when no freeze plans need to be executed to
201 * "freeze the page". Only the "freeze" path needs to consider the need
202 * to set pages all-frozen in the visibility map under this scheme.
203 *
204 * When we freeze a page, we generally freeze all XIDs < OldestXmin, only
205 * leaving behind XIDs that are ineligible for freezing, if any. And so
206 * you might wonder why these trackers are necessary at all; why should
207 * _any_ page that VACUUM freezes _ever_ be left with XIDs/MXIDs that
208 * ratchet back the top-level NewRelfrozenXid/NewRelminMxid trackers?
209 *
210 * It is useful to use a definition of "freeze the page" that does not
211 * overspecify how MultiXacts are affected. heap_prepare_freeze_tuple
212 * generally prefers to remove Multis eagerly, but lazy processing is used
213 * in cases where laziness allows VACUUM to avoid allocating a new Multi.
214 * The "freeze the page" trackers enable this flexibility.
215 */
218
219 /*
220 * "No freeze" NewRelfrozenXid/NewRelminMxid trackers.
221 *
222 * These trackers are maintained in the same way as the trackers used when
223 * VACUUM scans a page that isn't cleanup locked. Both code paths are
224 * based on the same general idea (do less work for this page during the
225 * ongoing VACUUM, at the cost of having to accept older final values).
226 */
229
231
232/*
233 * Per-page state returned by heap_page_prune_and_freeze()
234 */
235typedef struct PruneFreezeResult
236{
237 int ndeleted; /* Number of tuples deleted from the page */
238 int nnewlpdead; /* Number of newly LP_DEAD items */
239 int nfrozen; /* Number of tuples we froze */
240
241 /* Number of live and recently dead tuples on the page, after pruning */
244
245 /*
246 * all_visible and all_frozen indicate if the all-visible and all-frozen
247 * bits in the visibility map can be set for this page, after pruning.
248 *
249 * vm_conflict_horizon is the newest xmin of live tuples on the page. The
250 * caller can use it as the conflict horizon when setting the VM bits. It
251 * is only valid if we froze some tuples (nfrozen > 0), and all_frozen is
252 * true.
253 *
254 * These are only set if the HEAP_PRUNE_FREEZE option is set.
255 */
259
260 /*
261 * Whether or not the page makes rel truncation unsafe. This is set to
262 * 'true', even if the page contains LP_DEAD items. VACUUM will remove
263 * them before attempting to truncate.
264 */
265 bool hastup;
266
267 /*
268 * LP_DEAD items on the page after pruning. Includes existing LP_DEAD
269 * items.
270 */
274
275/* 'reason' codes for heap_page_prune_and_freeze() */
276typedef enum
277{
278 PRUNE_ON_ACCESS, /* on-access pruning */
279 PRUNE_VACUUM_SCAN, /* VACUUM 1st heap pass */
280 PRUNE_VACUUM_CLEANUP, /* VACUUM 2nd heap pass */
282
283/* ----------------
284 * function prototypes for heap access method
285 *
286 * heap_create, heap_create_with_catalog, and heap_drop_with_catalog
287 * are declared in catalog/heap.h
288 * ----------------
289 */
290
291
292/*
293 * HeapScanIsValid
294 * True iff the heap scan is valid.
295 */
296#define HeapScanIsValid(scan) PointerIsValid(scan)
297
298extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
299 int nkeys, ScanKey key,
300 ParallelTableScanDesc parallel_scan,
301 uint32 flags);
302extern void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk,
303 BlockNumber numBlks);
304extern void heap_prepare_pagescan(TableScanDesc sscan);
305extern void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
306 bool allow_strat, bool allow_sync, bool allow_pagemode);
307extern void heap_endscan(TableScanDesc sscan);
308extern HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction);
309extern bool heap_getnextslot(TableScanDesc sscan,
310 ScanDirection direction, struct TupleTableSlot *slot);
311extern void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid,
312 ItemPointer maxtid);
314 ScanDirection direction,
315 TupleTableSlot *slot);
316extern bool heap_fetch(Relation relation, Snapshot snapshot,
317 HeapTuple tuple, Buffer *userbuf, bool keep_buf);
318extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation,
319 Buffer buffer, Snapshot snapshot, HeapTuple heapTuple,
320 bool *all_dead, bool first_call);
321
322extern void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid);
323
326extern void ReleaseBulkInsertStatePin(BulkInsertState bistate);
327
328extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid,
329 int options, BulkInsertState bistate);
330extern void heap_multi_insert(Relation relation, struct TupleTableSlot **slots,
331 int ntuples, CommandId cid, int options,
332 BulkInsertState bistate);
333extern TM_Result heap_delete(Relation relation, ItemPointer tid,
334 CommandId cid, Snapshot crosscheck, bool wait,
335 struct TM_FailureData *tmfd, bool changingPart);
336extern void heap_finish_speculative(Relation relation, ItemPointer tid);
337extern void heap_abort_speculative(Relation relation, ItemPointer tid);
338extern TM_Result heap_update(Relation relation, ItemPointer otid,
339 HeapTuple newtup,
340 CommandId cid, Snapshot crosscheck, bool wait,
341 struct TM_FailureData *tmfd, LockTupleMode *lockmode,
342 TU_UpdateIndexes *update_indexes);
343extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple,
344 CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy,
345 bool follow_updates,
346 Buffer *buffer, struct TM_FailureData *tmfd);
347
348extern bool heap_inplace_lock(Relation relation,
349 HeapTuple oldtup_ptr, Buffer buffer,
350 void (*release_callback) (void *), void *arg);
351extern void heap_inplace_update_and_unlock(Relation relation,
352 HeapTuple oldtup, HeapTuple tuple,
353 Buffer buffer);
354extern void heap_inplace_unlock(Relation relation,
355 HeapTuple oldtup, Buffer buffer);
357 const struct VacuumCutoffs *cutoffs,
358 HeapPageFreeze *pagefrz,
359 HeapTupleFreeze *frz, bool *totally_frozen);
360
361extern void heap_pre_freeze_checks(Buffer buffer,
362 HeapTupleFreeze *tuples, int ntuples);
363extern void heap_freeze_prepared_tuples(Buffer buffer,
364 HeapTupleFreeze *tuples, int ntuples);
365extern bool heap_freeze_tuple(HeapTupleHeader tuple,
366 TransactionId relfrozenxid, TransactionId relminmxid,
367 TransactionId FreezeLimit, TransactionId MultiXactCutoff);
369 const struct VacuumCutoffs *cutoffs,
370 TransactionId *NoFreezePageRelfrozenXid,
371 MultiXactId *NoFreezePageRelminMxid);
373
374extern void simple_heap_insert(Relation relation, HeapTuple tup);
375extern void simple_heap_delete(Relation relation, ItemPointer tid);
376extern void simple_heap_update(Relation relation, ItemPointer otid,
377 HeapTuple tup, TU_UpdateIndexes *update_indexes);
378
380 TM_IndexDeleteOp *delstate);
381
382/* in heap/pruneheap.c */
383struct GlobalVisState;
384extern void heap_page_prune_opt(Relation relation, Buffer buffer);
385extern void heap_page_prune_and_freeze(Relation relation, Buffer buffer,
386 struct GlobalVisState *vistest,
387 int options,
388 struct VacuumCutoffs *cutoffs,
389 PruneFreezeResult *presult,
390 PruneReason reason,
391 OffsetNumber *off_loc,
392 TransactionId *new_relfrozen_xid,
393 MultiXactId *new_relmin_mxid);
394extern void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only,
395 OffsetNumber *redirected, int nredirected,
396 OffsetNumber *nowdead, int ndead,
397 OffsetNumber *nowunused, int nunused);
398extern void heap_get_root_tuples(Page page, OffsetNumber *root_offsets);
399extern void log_heap_prune_and_freeze(Relation relation, Buffer buffer,
400 TransactionId conflict_xid,
401 bool cleanup_lock,
402 PruneReason reason,
403 HeapTupleFreeze *frozen, int nfrozen,
404 OffsetNumber *redirected, int nredirected,
405 OffsetNumber *dead, int ndead,
406 OffsetNumber *unused, int nunused);
407
408/* in heap/vacuumlazy.c */
409struct VacuumParams;
410extern void heap_vacuum_rel(Relation rel,
411 struct VacuumParams *params, BufferAccessStrategy bstrategy);
412
413/* in heap/heapam_visibility.c */
414extern bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot,
415 Buffer buffer);
417 Buffer buffer);
419 Buffer buffer);
421 TransactionId *dead_after);
422extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
423 uint16 infomask, TransactionId xid);
425extern bool HeapTupleIsSurelyDead(HeapTuple htup,
426 struct GlobalVisState *vistest);
427
428/*
429 * To avoid leaking too much knowledge about reorderbuffer implementation
430 * details this is implemented in reorderbuffer.c not heapam_visibility.c
431 */
432struct HTAB;
434 Snapshot snapshot,
435 HeapTuple htup,
436 Buffer buffer,
437 CommandId *cmin, CommandId *cmax);
438extern void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple,
439 Buffer buffer, Snapshot snapshot);
440
441/*
442 * heap_execute_freeze_tuple
443 * Execute the prepared freezing of a tuple with caller's freeze plan.
444 *
445 * Caller is responsible for ensuring that no other backend can access the
446 * storage underlying this tuple, either by holding an exclusive lock on the
447 * buffer containing it (which is what lazy VACUUM does), or by having it be
448 * in private storage (which is what CLUSTER and friends do).
449 */
450static inline void
452{
453 HeapTupleHeaderSetXmax(tuple, frz->xmax);
454
455 if (frz->frzflags & XLH_FREEZE_XVAC)
457
458 if (frz->frzflags & XLH_INVALID_XVAC)
460
461 tuple->t_infomask = frz->t_infomask;
462 tuple->t_infomask2 = frz->t_infomask2;
463}
464
465#endif /* HEAPAM_H */
uint32 BlockNumber
Definition: block.h:31
int Buffer
Definition: buf.h:23
PageData * Page
Definition: bufpage.h:82
uint8_t uint8
Definition: c.h:486
TransactionId MultiXactId
Definition: c.h:619
uint16_t uint16
Definition: c.h:487
uint32_t uint32
Definition: c.h:488
uint32 CommandId
Definition: c.h:623
uint32 TransactionId
Definition: c.h:609
void heap_finish_speculative(Relation relation, ItemPointer tid)
Definition: heapam.c:6004
void heap_insert(Relation relation, HeapTuple tup, CommandId cid, int options, BulkInsertState bistate)
Definition: heapam.c:2008
struct HeapTupleFreeze HeapTupleFreeze
struct PruneFreezeResult PruneFreezeResult
bool heap_inplace_lock(Relation relation, HeapTuple oldtup_ptr, Buffer buffer, void(*release_callback)(void *), void *arg)
Definition: heapam.c:6270
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:1525
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:100
bool HeapTupleIsSurelyDead(HeapTuple htup, struct GlobalVisState *vistest)
void simple_heap_delete(Relation relation, ItemPointer tid)
Definition: heapam.c:3118
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:615
void heap_page_prune_opt(Relation relation, Buffer buffer)
Definition: pruneheap.c:193
HTSV_Result
Definition: heapam.h:133
@ HEAPTUPLE_RECENTLY_DEAD
Definition: heapam.h:136
@ HEAPTUPLE_INSERT_IN_PROGRESS
Definition: heapam.h:137
@ HEAPTUPLE_LIVE
Definition: heapam.h:135
@ HEAPTUPLE_DELETE_IN_PROGRESS
Definition: heapam.h:138
@ HEAPTUPLE_DEAD
Definition: heapam.h:134
void heap_endscan(TableScanDesc sscan)
Definition: heapam.c:1218
void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
Definition: heapam.c:1155
void heap_inplace_unlock(Relation relation, HeapTuple oldtup, Buffer buffer)
Definition: heapam.c:6551
struct BitmapHeapScanDescData * BitmapHeapScanDesc
Definition: heapam.h:118
bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple)
Definition: heapam.c:7716
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:2697
bool heap_tuple_should_freeze(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, TransactionId *NoFreezePageRelfrozenXid, MultiXactId *NoFreezePageRelminMxid)
Definition: heapam.c:7771
bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId FreezeLimit, TransactionId MultiXactCutoff)
Definition: heapam.c:7310
void heap_inplace_update_and_unlock(Relation relation, HeapTuple oldtup, HeapTuple tuple, Buffer buffer)
Definition: heapam.c:6406
struct HeapPageFreeze HeapPageFreeze
void ReleaseBulkInsertStatePin(BulkInsertState bistate)
Definition: heapam.c:1970
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:2277
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition: heapam.c:1266
bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call)
Definition: heapam.c:1645
void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup, TU_UpdateIndexes *update_indexes)
Definition: heapam.c:4406
void heap_freeze_prepared_tuples(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition: heapam.c:7288
static void heap_execute_freeze_tuple(HeapTupleHeader tuple, HeapTupleFreeze *frz)
Definition: heapam.h:451
bool heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
Definition: heapam.c:1418
void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
Definition: heapam.c:1345
HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer)
struct HeapScanDescData HeapScanDescData
void heap_abort_speculative(Relation relation, ItemPointer tid)
Definition: heapam.c:6091
struct BitmapHeapScanDescData BitmapHeapScanDescData
TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, ParallelTableScanDesc parallel_scan, uint32 flags)
Definition: heapam.c:1034
bool heap_getnextslot(TableScanDesc sscan, ScanDirection direction, struct TupleTableSlot *slot)
Definition: heapam.c:1315
void heap_prepare_pagescan(TableScanDesc sscan)
Definition: heapam.c:489
void simple_heap_insert(Relation relation, HeapTuple tup)
Definition: heapam.c:2639
bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, HeapPageFreeze *pagefrz, HeapTupleFreeze *frz, bool *totally_frozen)
Definition: heapam.c:6962
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:3164
TransactionId heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
Definition: heapam.c:8024
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:4495
PruneReason
Definition: heapam.h:277
@ PRUNE_VACUUM_CLEANUP
Definition: heapam.h:280
@ PRUNE_ON_ACCESS
Definition: heapam.h:278
@ PRUNE_VACUUM_SCAN
Definition: heapam.h:279
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:1797
void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk, BlockNumber numBlks)
Definition: heapam.c:417
void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition: heapam.c:9151
struct IndexFetchHeapData IndexFetchHeapData
void FreeBulkInsertState(BulkInsertState)
Definition: heapam.c:1958
void heap_pre_freeze_checks(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition: heapam.c:7235
BulkInsertState GetBulkInsertState(void)
Definition: heapam.c:1941
#define XLH_INVALID_XVAC
Definition: heapam_xlog.h:340
#define XLH_FREEZE_XVAC
Definition: heapam_xlog.h:339
static void HeapTupleHeaderSetXvac(HeapTupleHeaderData *tup, TransactionId xid)
Definition: htup_details.h:451
#define MaxHeapTuplesPerPage
Definition: htup_details.h:624
static void HeapTupleHeaderSetXmax(HeapTupleHeaderData *tup, TransactionId xid)
Definition: htup_details.h:383
LockWaitPolicy
Definition: lockoptions.h:37
LockTupleMode
Definition: lockoptions.h:50
uint16 OffsetNumber
Definition: off.h:24
void * arg
static PgChecksumMode mode
Definition: pg_checksums.c:55
ScanDirection
Definition: sdir.h:25
static HTAB * tuplecid_data
Definition: snapmgr.c:103
HeapScanDescData rs_heap_base
Definition: heapam.h:104
Definition: dynahash.c:220
MultiXactId NoFreezePageRelminMxid
Definition: heapam.h:228
TransactionId FreezePageRelfrozenXid
Definition: heapam.h:216
bool freeze_required
Definition: heapam.h:190
MultiXactId FreezePageRelminMxid
Definition: heapam.h:217
TransactionId NoFreezePageRelfrozenXid
Definition: heapam.h:227
BufferAccessStrategy rs_strategy
Definition: heapam.h:71
ScanDirection rs_dir
Definition: heapam.h:86
uint32 rs_ntuples
Definition: heapam.h:97
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:98
BlockNumber rs_numblocks
Definition: heapam.h:61
BlockNumber rs_nblocks
Definition: heapam.h:59
ReadStream * rs_read_stream
Definition: heapam.h:76
uint32 rs_cindex
Definition: heapam.h:96
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:155
uint16 t_infomask2
Definition: heapam.h:153
TransactionId xmax
Definition: heapam.h:152
OffsetNumber offset
Definition: heapam.h:160
uint8 checkflags
Definition: heapam.h:158
uint16 t_infomask
Definition: heapam.h:154
Buffer xs_cbuf
Definition: heapam.h:127
IndexFetchTableData xs_base
Definition: heapam.h:125
int recently_dead_tuples
Definition: heapam.h:243
TransactionId vm_conflict_horizon
Definition: heapam.h:258
OffsetNumber deadoffsets[MaxHeapTuplesPerPage]
Definition: heapam.h:272
bool all_visible
Definition: heapam.h:256
TU_UpdateIndexes
Definition: tableam.h:117
TM_Result
Definition: tableam.h:79
#define FrozenTransactionId
Definition: transam.h:33
#define InvalidTransactionId
Definition: transam.h:31