PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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-2026, 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 "commands/vacuum.h"
25#include "nodes/lockoptions.h"
26#include "nodes/primnodes.h"
27#include "storage/bufpage.h"
28#include "storage/dsm.h"
29#include "storage/lockdefs.h"
30#include "storage/read_stream.h"
31#include "storage/shm_toc.h"
32#include "utils/relcache.h"
33#include "utils/snapshot.h"
34
35
36/* "options" flag bits for heap_insert */
37#define HEAP_INSERT_SKIP_FSM TABLE_INSERT_SKIP_FSM
38#define HEAP_INSERT_FROZEN TABLE_INSERT_FROZEN
39#define HEAP_INSERT_NO_LOGICAL TABLE_INSERT_NO_LOGICAL
40#define HEAP_INSERT_SPECULATIVE 0x0010
41
42/* "options" flag bits for heap_page_prune_and_freeze */
43#define HEAP_PAGE_PRUNE_MARK_UNUSED_NOW (1 << 0)
44#define HEAP_PAGE_PRUNE_FREEZE (1 << 1)
45#define HEAP_PAGE_PRUNE_ALLOW_FAST_PATH (1 << 2)
46
50struct VacuumCutoffs;
51
52#define MaxLockTupleMode LockTupleExclusive
53
54/*
55 * Descriptor for heap table scans.
56 */
57typedef struct HeapScanDescData
58{
59 TableScanDescData rs_base; /* AM independent part of the descriptor */
60
61 /* state set up at initscan time */
62 BlockNumber rs_nblocks; /* total number of blocks in rel */
63 BlockNumber rs_startblock; /* block # to start at */
64 BlockNumber rs_numblocks; /* max number of blocks to scan */
65 /* rs_numblocks is usually InvalidBlockNumber, meaning "scan whole rel" */
66
67 /* scan current state */
68 bool rs_inited; /* false = scan not init'd yet */
69 OffsetNumber rs_coffset; /* current offset # in non-page-at-a-time mode */
70 BlockNumber rs_cblock; /* current block # in scan, if any */
71 Buffer rs_cbuf; /* current buffer in scan, if any */
72 /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
73
74 BufferAccessStrategy rs_strategy; /* access strategy for reads */
75
76 HeapTupleData rs_ctup; /* current tuple in scan, if any */
77
78 /* For scans that stream reads */
80
81 /*
82 * For sequential scans and TID range scans to stream reads. The read
83 * stream is allocated at the beginning of the scan and reset on rescan or
84 * when the scan direction changes. The scan direction is saved each time
85 * a new page is requested. If the scan direction changes from one page to
86 * the next, the read stream releases all previously pinned buffers and
87 * resets the prefetch block.
88 */
91
92 /*
93 * For parallel scans to store page allocation data. NULL when not
94 * performing a parallel scan.
95 */
97
98 /*
99 * For sequential scans and bitmap heap scans. The current heap block's
100 * corresponding page in the visibility map.
101 */
103
104 /* these fields only used in page-at-a-time mode and for bitmap scans */
105 uint32 rs_cindex; /* current tuple's index in vistuples */
106 uint32 rs_ntuples; /* number of visible tuples on page */
110
118
119/*
120 * Descriptor for fetches from heap via an index.
121 */
122typedef struct IndexFetchHeapData
123{
124 IndexFetchTableData xs_base; /* AM independent part of the descriptor */
125
126 /*
127 * Current heap buffer in scan, if any. NB: if xs_cbuf is not
128 * InvalidBuffer, we hold a pin on that buffer.
129 */
131
132 /* Current heap block's corresponding page in the visibility map */
135
136/* Result codes for HeapTupleSatisfiesVacuum */
137typedef enum
138{
139 HEAPTUPLE_DEAD, /* tuple is dead and deletable */
140 HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
141 HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
142 HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
143 HEAPTUPLE_DELETE_IN_PROGRESS, /* deleting xact is still in progress */
145
146/*
147 * heap_prepare_freeze_tuple may request that heap_freeze_execute_prepared
148 * check any tuple's to-be-frozen xmin and/or xmax status using pg_xact
149 */
150#define HEAP_FREEZE_CHECK_XMIN_COMMITTED 0x01
151#define HEAP_FREEZE_CHECK_XMAX_ABORTED 0x02
152
153/* heap_prepare_freeze_tuple state describing how to freeze a tuple */
154typedef struct HeapTupleFreeze
155{
156 /* Fields describing how to process tuple */
161
162 /* xmin/xmax check flags */
164 /* Page offset number for tuple */
167
168/*
169 * State used by VACUUM to track the details of freezing all eligible tuples
170 * on a given heap page.
171 *
172 * VACUUM prepares freeze plans for each page via heap_prepare_freeze_tuple
173 * calls (every tuple with storage gets its own call). This page-level freeze
174 * state is updated across each call, which ultimately determines whether or
175 * not freezing the page is required.
176 *
177 * Aside from the basic question of whether or not freezing will go ahead, the
178 * state also tracks the oldest extant XID/MXID in the table as a whole, for
179 * the purposes of advancing relfrozenxid/relminmxid values in pg_class later
180 * on. Each heap_prepare_freeze_tuple call pushes NewRelfrozenXid and/or
181 * NewRelminMxid back as required to avoid unsafe final pg_class values. Any
182 * and all unfrozen XIDs or MXIDs that remain after VACUUM finishes _must_
183 * have values >= the final relfrozenxid/relminmxid values in pg_class. This
184 * includes XIDs that remain as MultiXact members from any tuple's xmax.
185 *
186 * When 'freeze_required' flag isn't set after all tuples are examined, the
187 * final choice on freezing is made by vacuumlazy.c. It can decide to trigger
188 * freezing based on whatever criteria it deems appropriate. However, it is
189 * recommended that vacuumlazy.c avoid early freezing when freezing does not
190 * enable setting the target page all-frozen in the visibility map afterwards.
191 */
192typedef struct HeapPageFreeze
193{
194 /* Is heap_prepare_freeze_tuple caller required to freeze page? */
196
197 /*
198 * "Freeze" NewRelfrozenXid/NewRelminMxid trackers.
199 *
200 * Trackers used when heap_freeze_execute_prepared freezes, or when there
201 * are zero freeze plans for a page. It is always valid for vacuumlazy.c
202 * to freeze any page, by definition. This even includes pages that have
203 * no tuples with storage to consider in the first place. That way the
204 * 'totally_frozen' results from heap_prepare_freeze_tuple can always be
205 * used in the same way, even when no freeze plans need to be executed to
206 * "freeze the page". Only the "freeze" path needs to consider the need
207 * to set pages all-frozen in the visibility map under this scheme.
208 *
209 * When we freeze a page, we generally freeze all XIDs < OldestXmin, only
210 * leaving behind XIDs that are ineligible for freezing, if any. And so
211 * you might wonder why these trackers are necessary at all; why should
212 * _any_ page that VACUUM freezes _ever_ be left with XIDs/MXIDs that
213 * ratchet back the top-level NewRelfrozenXid/NewRelminMxid trackers?
214 *
215 * It is useful to use a definition of "freeze the page" that does not
216 * overspecify how MultiXacts are affected. heap_prepare_freeze_tuple
217 * generally prefers to remove Multis eagerly, but lazy processing is used
218 * in cases where laziness allows VACUUM to avoid allocating a new Multi.
219 * The "freeze the page" trackers enable this flexibility.
220 */
223
224 /*
225 * Newest XID that this page's freeze actions will remove from tuple
226 * visibility metadata (currently xmin and/or xvac). It is used to derive
227 * the snapshot conflict horizon for a WAL record that freezes tuples. On
228 * a standby, we must not replay that change while any snapshot could
229 * still treat that XID as running.
230 *
231 * It's only used if we execute freeze plans for this page, so there is no
232 * corresponding "no freeze" tracker.
233 */
235
236 /*
237 * "No freeze" NewRelfrozenXid/NewRelminMxid trackers.
238 *
239 * These trackers are maintained in the same way as the trackers used when
240 * VACUUM scans a page that isn't cleanup locked. Both code paths are
241 * based on the same general idea (do less work for this page during the
242 * ongoing VACUUM, at the cost of having to accept older final values).
243 */
246
248
249
250/* 'reason' codes for heap_page_prune_and_freeze() */
251typedef enum
252{
253 PRUNE_ON_ACCESS, /* on-access pruning */
254 PRUNE_VACUUM_SCAN, /* VACUUM 1st heap pass */
255 PRUNE_VACUUM_CLEANUP, /* VACUUM 2nd heap pass */
257
258/*
259 * Input parameters to heap_page_prune_and_freeze()
260 */
261typedef struct PruneFreezeParams
262{
263 Relation relation; /* relation containing buffer to be pruned */
264 Buffer buffer; /* buffer to be pruned */
265
266 /*
267 * Callers should provide a pinned vmbuffer corresponding to the heap
268 * block in buffer. We will check for and repair any corruption in the VM
269 * and set the VM after pruning if the page is all-visible/all-frozen.
270 */
272
273 /*
274 * The reason pruning was performed. It is used to set the WAL record
275 * opcode which is used for debugging and analysis purposes.
276 */
278
279 /*
280 * Contains flag bits:
281 *
282 * HEAP_PAGE_PRUNE_MARK_UNUSED_NOW indicates that dead items can be set
283 * LP_UNUSED during pruning.
284 *
285 * HEAP_PAGE_PRUNE_FREEZE indicates that we will also freeze tuples.
286 */
288
289 /*
290 * vistest is used to distinguish whether tuples are DEAD or RECENTLY_DEAD
291 * (see heap_prune_satisfies_vacuum).
292 */
294
295 /*
296 * Contains the cutoffs used for freezing. They are required if the
297 * HEAP_PAGE_PRUNE_FREEZE option is set. cutoffs->OldestXmin is also used
298 * to determine if dead tuples are HEAPTUPLE_RECENTLY_DEAD or
299 * HEAPTUPLE_DEAD. Currently only vacuum passes in cutoffs. Vacuum
300 * calculates them once, at the beginning of vacuuming the relation.
301 */
304
305/*
306 * Per-page state returned by heap_page_prune_and_freeze()
307 */
308typedef struct PruneFreezeResult
309{
310 int ndeleted; /* Number of tuples deleted from the page */
311 int nnewlpdead; /* Number of newly LP_DEAD items */
312 int nfrozen; /* Number of tuples we froze */
313
314 /* Number of live and recently dead tuples on the page, after pruning */
317
318 /*
319 * Whether or not the page was newly set all-visible and all-frozen during
320 * phase I of vacuuming.
321 */
325
326 /*
327 * Whether or not the page makes rel truncation unsafe. This is set to
328 * 'true', even if the page contains LP_DEAD items. VACUUM will remove
329 * them before attempting to truncate.
330 */
331 bool hastup;
332
333 /*
334 * LP_DEAD items on the page after pruning. Includes existing LP_DEAD
335 * items.
336 */
340
341
342/* ----------------
343 * function prototypes for heap access method
344 *
345 * heap_create, heap_create_with_catalog, and heap_drop_with_catalog
346 * are declared in catalog/heap.h
347 * ----------------
348 */
349
350
351extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
352 int nkeys, ScanKey key,
353 ParallelTableScanDesc parallel_scan,
354 uint32 flags);
358extern void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params,
359 bool allow_strat, bool allow_sync, bool allow_pagemode);
360extern void heap_endscan(TableScanDesc sscan);
363 ScanDirection direction, TupleTableSlot *slot);
367 ScanDirection direction,
368 TupleTableSlot *slot);
369extern bool heap_fetch(Relation relation, Snapshot snapshot,
370 HeapTuple tuple, Buffer *userbuf, bool keep_buf);
371extern bool heap_hot_search_buffer(ItemPointer tid, Relation relation,
372 Buffer buffer, Snapshot snapshot, HeapTuple heapTuple,
373 bool *all_dead, bool first_call);
374
376
379extern void ReleaseBulkInsertStatePin(BulkInsertState bistate);
380
381extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid,
383extern void heap_multi_insert(Relation relation, TupleTableSlot **slots,
384 int ntuples, CommandId cid, bits32 options,
385 BulkInsertState bistate);
386extern TM_Result heap_delete(Relation relation, const ItemPointerData *tid,
387 CommandId cid, Snapshot crosscheck, bool wait,
388 TM_FailureData *tmfd, bool changingPart);
389extern void heap_finish_speculative(Relation relation, const ItemPointerData *tid);
390extern void heap_abort_speculative(Relation relation, const ItemPointerData *tid);
391extern TM_Result heap_update(Relation relation, const ItemPointerData *otid,
393 CommandId cid, Snapshot crosscheck, bool wait,
394 TM_FailureData *tmfd, LockTupleMode *lockmode,
396extern TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple,
398 bool follow_updates,
399 Buffer *buffer, TM_FailureData *tmfd);
400
401extern bool heap_inplace_lock(Relation relation,
403 void (*release_callback) (void *), void *arg);
404extern void heap_inplace_update_and_unlock(Relation relation,
406 Buffer buffer);
407extern void heap_inplace_unlock(Relation relation,
408 HeapTuple oldtup, Buffer buffer);
410 const struct VacuumCutoffs *cutoffs,
411 HeapPageFreeze *pagefrz,
413
414extern void heap_pre_freeze_checks(Buffer buffer,
415 HeapTupleFreeze *tuples, int ntuples);
416extern void heap_freeze_prepared_tuples(Buffer buffer,
417 HeapTupleFreeze *tuples, int ntuples);
418extern bool heap_freeze_tuple(HeapTupleHeader tuple,
419 TransactionId relfrozenxid, TransactionId relminmxid,
420 TransactionId FreezeLimit, TransactionId MultiXactCutoff);
422 const struct VacuumCutoffs *cutoffs,
423 TransactionId *NoFreezePageRelfrozenXid,
424 MultiXactId *NoFreezePageRelminMxid);
426
427extern void simple_heap_insert(Relation relation, HeapTuple tup);
428extern void simple_heap_delete(Relation relation, const ItemPointerData *tid);
429extern void simple_heap_update(Relation relation, const ItemPointerData *otid,
431
434
435/* in heap/pruneheap.c */
436extern void heap_page_prune_opt(Relation relation, Buffer buffer,
437 Buffer *vmbuffer);
443extern void heap_page_prune_execute(Buffer buffer, bool lp_truncate_only,
444 OffsetNumber *redirected, int nredirected,
445 OffsetNumber *nowdead, int ndead,
446 OffsetNumber *nowunused, int nunused);
448extern void log_heap_prune_and_freeze(Relation relation, Buffer buffer,
449 Buffer vmbuffer, uint8 vmflags,
451 bool cleanup_lock,
452 PruneReason reason,
453 HeapTupleFreeze *frozen, int nfrozen,
454 OffsetNumber *redirected, int nredirected,
455 OffsetNumber *dead, int ndead,
456 OffsetNumber *unused, int nunused);
457
458/* in heap/vacuumlazy.c */
459extern void heap_vacuum_rel(Relation rel,
460 const VacuumParams params, BufferAccessStrategy bstrategy);
461#ifdef USE_ASSERT_CHECKING
463 GlobalVisState *vistest,
464 bool *all_frozen,
465 TransactionId *newest_live_xid,
467#endif
468
469/* in heap/heapam_visibility.c */
470extern bool HeapTupleSatisfiesVisibility(HeapTuple htup, Snapshot snapshot,
471 Buffer buffer);
473 Buffer buffer);
475 Buffer buffer);
478extern void HeapTupleSetHintBits(HeapTupleHeader tuple, Buffer buffer,
481extern bool HeapTupleIsSurelyDead(HeapTuple htup,
482 GlobalVisState *vistest);
483
484/*
485 * Some of the input/output to/from HeapTupleSatisfiesMVCCBatch() is passed
486 * via this struct, as otherwise the increased number of arguments to
487 * HeapTupleSatisfiesMVCCBatch() leads to on-stack argument passing on x86-64,
488 * which causes a small regression.
489 */
495
496extern int HeapTupleSatisfiesMVCCBatch(Snapshot snapshot, Buffer buffer,
497 int ntups,
500
501/*
502 * To avoid leaking too much knowledge about reorderbuffer implementation
503 * details this is implemented in reorderbuffer.c not heapam_visibility.c
504 */
505struct HTAB;
507 Snapshot snapshot,
508 HeapTuple htup,
509 Buffer buffer,
510 CommandId *cmin, CommandId *cmax);
511extern void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple,
512 Buffer buffer, Snapshot snapshot);
513
514/*
515 * heap_execute_freeze_tuple
516 * Execute the prepared freezing of a tuple with caller's freeze plan.
517 *
518 * Caller is responsible for ensuring that no other backend can access the
519 * storage underlying this tuple, either by holding an exclusive lock on the
520 * buffer containing it (which is what lazy VACUUM does), or by having it be
521 * in private storage (which is what CLUSTER and friends do).
522 */
523static inline void
525{
526 HeapTupleHeaderSetXmax(tuple, frz->xmax);
527
528 if (frz->frzflags & XLH_FREEZE_XVAC)
530
531 if (frz->frzflags & XLH_INVALID_XVAC)
533
534 tuple->t_infomask = frz->t_infomask;
535 tuple->t_infomask2 = frz->t_infomask2;
536}
537
538#endif /* HEAPAM_H */
uint32 BlockNumber
Definition block.h:31
int Buffer
Definition buf.h:23
PageData * Page
Definition bufpage.h:81
uint8_t uint8
Definition c.h:616
TransactionId MultiXactId
Definition c.h:748
uint32 bits32
Definition c.h:627
uint16_t uint16
Definition c.h:617
uint32_t uint32
Definition c.h:618
uint32 CommandId
Definition c.h:752
uint32 TransactionId
Definition c.h:738
Datum arg
Definition elog.c:1322
void simple_heap_update(Relation relation, const ItemPointerData *otid, HeapTuple tup, TU_UpdateIndexes *update_indexes)
Definition heapam.c:4568
bool heap_inplace_lock(Relation relation, HeapTuple oldtup_ptr, Buffer buffer, void(*release_callback)(void *), void *arg)
Definition heapam.c:6449
void heap_multi_insert(Relation relation, TupleTableSlot **slots, int ntuples, CommandId cid, bits32 options, BulkInsertState bistate)
Definition heapam.c:2421
bool heap_fetch(Relation relation, Snapshot snapshot, HeapTuple tuple, Buffer *userbuf, bool keep_buf)
Definition heapam.c:1669
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
void heap_vacuum_rel(Relation rel, const VacuumParams params, BufferAccessStrategy bstrategy)
Definition vacuumlazy.c:623
void heap_get_root_tuples(Page page, OffsetNumber *root_offsets)
Definition pruneheap.c:2257
void heap_finish_speculative(Relation relation, const ItemPointerData *tid)
Definition heapam.c:6180
HTSV_Result
Definition heapam.h:138
@ HEAPTUPLE_RECENTLY_DEAD
Definition heapam.h:141
@ HEAPTUPLE_INSERT_IN_PROGRESS
Definition heapam.h:142
@ HEAPTUPLE_LIVE
Definition heapam.h:140
@ HEAPTUPLE_DELETE_IN_PROGRESS
Definition heapam.h:143
@ HEAPTUPLE_DEAD
Definition heapam.h:139
bool heap_getnextslot(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
Definition heapam.c:1459
void heap_page_prune_and_freeze(PruneFreezeParams *params, PruneFreezeResult *presult, OffsetNumber *off_loc, TransactionId *new_relfrozen_xid, MultiXactId *new_relmin_mxid)
Definition pruneheap.c:1056
void heap_endscan(TableScanDesc sscan)
Definition heapam.c:1378
void heap_rescan(TableScanDesc sscan, ScanKey key, bool set_params, bool allow_strat, bool allow_sync, bool allow_pagemode)
Definition heapam.c:1319
void heap_inplace_unlock(Relation relation, HeapTuple oldtup, Buffer buffer)
Definition heapam.c:6727
TM_Result heap_update(Relation relation, const ItemPointerData *otid, HeapTuple newtup, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, LockTupleMode *lockmode, TU_UpdateIndexes *update_indexes)
Definition heapam.c:3321
struct BitmapHeapScanDescData * BitmapHeapScanDesc
Definition heapam.h:117
bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple)
Definition heapam.c:7908
TM_Result heap_delete(Relation relation, const ItemPointerData *tid, CommandId cid, Snapshot crosscheck, bool wait, TM_FailureData *tmfd, bool changingPart)
Definition heapam.c:2852
bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, Snapshot snapshot, HeapTuple htup, Buffer buffer, CommandId *cmin, CommandId *cmax)
void log_heap_prune_and_freeze(Relation relation, Buffer buffer, Buffer vmbuffer, uint8 vmflags, 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:2529
void heap_insert(Relation relation, HeapTuple tup, CommandId cid, bits32 options, BulkInsertState bistate)
Definition heapam.c:2150
bool heap_tuple_should_freeze(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, TransactionId *NoFreezePageRelfrozenXid, MultiXactId *NoFreezePageRelminMxid)
Definition heapam.c:7963
bool heap_freeze_tuple(HeapTupleHeader tuple, TransactionId relfrozenxid, TransactionId relminmxid, TransactionId FreezeLimit, TransactionId MultiXactCutoff)
Definition heapam.c:7499
void heap_inplace_update_and_unlock(Relation relation, HeapTuple oldtup, HeapTuple tuple, Buffer buffer)
Definition heapam.c:6587
void ReleaseBulkInsertStatePin(BulkInsertState bistate)
Definition heapam.c:2112
bool HeapTupleIsSurelyDead(HeapTuple htup, GlobalVisState *vistest)
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition heapam.c:1420
bool heap_hot_search_buffer(ItemPointer tid, Relation relation, Buffer buffer, Snapshot snapshot, HeapTuple heapTuple, bool *all_dead, bool first_call)
Definition heapam.c:1787
void heap_freeze_prepared_tuples(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition heapam.c:7477
static void heap_execute_freeze_tuple(HeapTupleHeader tuple, HeapTupleFreeze *frz)
Definition heapam.h:524
bool heap_getnextslot_tidrange(TableScanDesc sscan, ScanDirection direction, TupleTableSlot *slot)
Definition heapam.c:1562
void heap_set_tidrange(TableScanDesc sscan, ItemPointer mintid, ItemPointer maxtid)
Definition heapam.c:1489
HTSV_Result HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin, Buffer buffer)
void heap_abort_speculative(Relation relation, const ItemPointerData *tid)
Definition heapam.c:6267
TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, ParallelTableScanDesc parallel_scan, uint32 flags)
Definition heapam.c:1164
void heap_page_prune_opt(Relation relation, Buffer buffer, Buffer *vmbuffer)
Definition pruneheap.c:256
void heap_prepare_pagescan(TableScanDesc sscan)
Definition heapam.c:616
int HeapTupleSatisfiesMVCCBatch(Snapshot snapshot, Buffer buffer, int ntups, BatchMVCCState *batchmvcc, OffsetNumber *vistuples_dense)
void simple_heap_insert(Relation relation, HeapTuple tup)
Definition heapam.c:2794
bool heap_prepare_freeze_tuple(HeapTupleHeader tuple, const struct VacuumCutoffs *cutoffs, HeapPageFreeze *pagefrz, HeapTupleFreeze *frz, bool *totally_frozen)
Definition heapam.c:7144
void simple_heap_delete(Relation relation, const ItemPointerData *tid)
Definition heapam.c:3275
TransactionId heap_index_delete_tuples(Relation rel, TM_IndexDeleteOp *delstate)
Definition heapam.c:8216
bool HeapTupleHeaderIsOnlyLocked(HeapTupleHeader tuple)
PruneReason
Definition heapam.h:252
@ PRUNE_VACUUM_CLEANUP
Definition heapam.h:255
@ PRUNE_ON_ACCESS
Definition heapam.h:253
@ PRUNE_VACUUM_SCAN
Definition heapam.h:254
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:2033
TM_Result heap_lock_tuple(Relation relation, HeapTuple tuple, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, bool follow_updates, Buffer *buffer, TM_FailureData *tmfd)
Definition heapam.c:4656
TM_Result HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, Buffer buffer)
struct BulkInsertStateData * BulkInsertState
Definition heapam.h:47
void heap_get_latest_tid(TableScanDesc sscan, ItemPointer tid)
Definition heapam.c:1939
void heap_setscanlimits(TableScanDesc sscan, BlockNumber startBlk, BlockNumber numBlks)
Definition heapam.c:500
void HeapCheckForSerializableConflictOut(bool visible, Relation relation, HeapTuple tuple, Buffer buffer, Snapshot snapshot)
Definition heapam.c:9299
void FreeBulkInsertState(BulkInsertState)
Definition heapam.c:2100
void heap_pre_freeze_checks(Buffer buffer, HeapTupleFreeze *tuples, int ntuples)
Definition heapam.c:7424
BulkInsertState GetBulkInsertState(void)
Definition heapam.c:2083
#define XLH_INVALID_XVAC
#define XLH_FREEZE_XVAC
static void HeapTupleHeaderSetXvac(HeapTupleHeaderData *tup, TransactionId xid)
#define MaxHeapTuplesPerPage
static void HeapTupleHeaderSetXmax(HeapTupleHeaderData *tup, TransactionId xid)
LockWaitPolicy
Definition lockoptions.h:38
LockTupleMode
Definition lockoptions.h:51
uint16 OffsetNumber
Definition off.h:24
static PgChecksumMode mode
static char buf[DEFAULT_XLOG_SEG_SIZE]
static int fb(int x)
ScanDirection
Definition sdir.h:25
static HTAB * tuplecid_data
Definition snapmgr.c:163
bool visible[MaxHeapTuplesPerPage]
Definition heapam.h:493
HeapTupleData tuples[MaxHeapTuplesPerPage]
Definition heapam.h:492
HeapScanDescData rs_heap_base
Definition heapam.h:113
MultiXactId NoFreezePageRelminMxid
Definition heapam.h:245
TransactionId FreezePageConflictXid
Definition heapam.h:234
TransactionId FreezePageRelfrozenXid
Definition heapam.h:221
bool freeze_required
Definition heapam.h:195
MultiXactId FreezePageRelminMxid
Definition heapam.h:222
TransactionId NoFreezePageRelfrozenXid
Definition heapam.h:244
Buffer rs_vmbuffer
Definition heapam.h:102
BufferAccessStrategy rs_strategy
Definition heapam.h:74
ScanDirection rs_dir
Definition heapam.h:89
uint32 rs_ntuples
Definition heapam.h:106
OffsetNumber rs_coffset
Definition heapam.h:69
Buffer rs_cbuf
Definition heapam.h:71
ParallelBlockTableScanWorkerData * rs_parallelworkerdata
Definition heapam.h:96
BlockNumber rs_startblock
Definition heapam.h:63
HeapTupleData rs_ctup
Definition heapam.h:76
OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]
Definition heapam.h:107
BlockNumber rs_numblocks
Definition heapam.h:64
BlockNumber rs_nblocks
Definition heapam.h:62
ReadStream * rs_read_stream
Definition heapam.h:79
uint32 rs_cindex
Definition heapam.h:105
BlockNumber rs_prefetch_block
Definition heapam.h:90
BlockNumber rs_cblock
Definition heapam.h:70
TableScanDescData rs_base
Definition heapam.h:59
uint8 frzflags
Definition heapam.h:160
uint16 t_infomask2
Definition heapam.h:158
TransactionId xmax
Definition heapam.h:157
OffsetNumber offset
Definition heapam.h:165
uint8 checkflags
Definition heapam.h:163
uint16 t_infomask
Definition heapam.h:159
IndexFetchTableData xs_base
Definition heapam.h:124
Buffer xs_vmbuffer
Definition heapam.h:133
PruneReason reason
Definition heapam.h:277
GlobalVisState * vistest
Definition heapam.h:293
struct VacuumCutoffs * cutoffs
Definition heapam.h:302
Relation relation
Definition heapam.h:263
Buffer vmbuffer
Definition heapam.h:271
bool newly_all_visible_frozen
Definition heapam.h:323
int recently_dead_tuples
Definition heapam.h:316
bool newly_all_frozen
Definition heapam.h:324
OffsetNumber deadoffsets[MaxHeapTuplesPerPage]
Definition heapam.h:338
bool newly_all_visible
Definition heapam.h:322
TU_UpdateIndexes
Definition tableam.h:111
TM_Result
Definition tableam.h:73
#define FrozenTransactionId
Definition transam.h:33
#define InvalidTransactionId
Definition transam.h:31