PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/heapam.h"
#include "access/heapam_xlog.h"
#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/transam.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "commands/vacuum.h"
#include "executor/instrument.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
#include "utils/rel.h"
#include "utils/snapmgr.h"
Go to the source code of this file.
Data Structures | |
struct | PruneState |
void heap_get_root_tuples | ( | Page | page, |
OffsetNumber * | root_offsets | ||
) |
Definition at line 1785 of file pruneheap.c.
References Assert, FirstOffsetNumber, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderIndicatesMovedPartitions, HeapTupleHeaderIsHeapOnly, HeapTupleHeaderIsHotUpdated, InvalidOffsetNumber, InvalidTransactionId, ItemIdGetRedirect, ItemIdIsDead, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, ItemPointerGetOffsetNumber(), MaxHeapTuplesPerPage, MemSet, OffsetNumberNext, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), HeapTupleHeaderData::t_ctid, TransactionIdEquals, and TransactionIdIsValid.
Referenced by heapam_index_build_range_scan(), and heapam_index_validate_scan().
|
static |
Definition at line 1912 of file pruneheap.c.
References Assert, HeapTupleFreeze::frzflags, HeapTupleFreeze::offset, HeapTupleFreeze::t_infomask, HeapTupleFreeze::t_infomask2, and HeapTupleFreeze::xmax.
Referenced by heap_log_freeze_plan().
|
inlinestatic |
Definition at line 1896 of file pruneheap.c.
References HeapTupleFreeze::frzflags, plan, HeapTupleFreeze::t_infomask, HeapTupleFreeze::t_infomask2, and HeapTupleFreeze::xmax.
Referenced by heap_log_freeze_plan().
|
inlinestatic |
Definition at line 1958 of file pruneheap.c.
References HeapTupleFreeze::frzflags, plan, HeapTupleFreeze::t_infomask, HeapTupleFreeze::t_infomask2, and HeapTupleFreeze::xmax.
Referenced by heap_log_freeze_plan().
|
static |
Definition at line 1978 of file pruneheap.c.
References Assert, heap_log_freeze_cmp(), heap_log_freeze_eq(), heap_log_freeze_new_plan(), i, xlhp_freeze_plan::ntuples, HeapTupleFreeze::offset, and qsort.
Referenced by log_heap_prune_and_freeze().
void heap_page_prune_and_freeze | ( | Relation | relation, |
Buffer | buffer, | ||
GlobalVisState * | vistest, | ||
int | options, | ||
struct VacuumCutoffs * | cutoffs, | ||
PruneFreezeResult * | presult, | ||
PruneReason | reason, | ||
OffsetNumber * | off_loc, | ||
TransactionId * | new_relfrozen_xid, | ||
MultiXactId * | new_relmin_mxid | ||
) |
Definition at line 350 of file pruneheap.c.
References PruneState::all_frozen, PruneFreezeResult::all_frozen, PruneState::all_visible, PruneFreezeResult::all_visible, Assert, BufferGetBlockNumber(), BufferGetPage(), PruneState::cutoffs, PruneState::deadoffsets, PruneFreezeResult::deadoffsets, elog, END_CRIT_SECTION, ERROR, FirstOffsetNumber, PruneState::freeze, HeapPageFreeze::freeze_required, HeapPageFreeze::FreezePageRelfrozenXid, HeapPageFreeze::FreezePageRelminMxid, PruneState::frozen, PruneState::hastup, PruneFreezeResult::hastup, heap_freeze_prepared_tuples(), heap_page_prune_execute(), HEAP_PAGE_PRUNE_FREEZE, HEAP_PAGE_PRUNE_MARK_UNUSED_NOW, heap_pre_freeze_checks(), heap_prune_chain(), heap_prune_record_unchanged_lp_dead(), heap_prune_record_unchanged_lp_normal(), heap_prune_record_unchanged_lp_unused(), heap_prune_record_unused(), heap_prune_satisfies_vacuum(), PruneState::heaponly_items, HEAPTUPLE_DEAD, HeapTupleHeaderAdvanceConflictHorizon(), HeapTupleHeaderIsHeapOnly, HeapTupleHeaderIsHotUpdated, PruneState::htsv, i, InvalidMultiXactId, InvalidOffsetNumber, InvalidTransactionId, ItemIdGetLength, ItemIdIsDead, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, ItemPointerSet(), PruneState::latest_xid_removed, likely, PruneState::live_tuples, PruneFreezeResult::live_tuples, log_heap_prune_and_freeze(), PruneState::lpdead_items, PruneFreezeResult::lpdead_items, PruneState::mark_unused_now, MarkBufferDirty(), MarkBufferDirtyHint(), PruneState::ndead, PruneState::ndeleted, PruneFreezeResult::ndeleted, PruneState::new_prune_xid, PruneState::nfrozen, PruneFreezeResult::nfrozen, PruneState::nheaponly_items, PruneFreezeResult::nnewlpdead, HeapPageFreeze::NoFreezePageRelfrozenXid, HeapPageFreeze::NoFreezePageRelminMxid, PruneState::nowdead, PruneState::nowunused, PruneState::nredirected, PruneState::nroot_items, PruneState::nunused, OffsetNumberNext, OffsetNumberPrev, VacuumCutoffs::OldestXmin, PageClearFull(), PruneState::pagefrz, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageIsFull(), pgWalUsage, PruneState::processed, PruneState::recently_dead_tuples, PruneFreezeResult::recently_dead_tuples, PruneState::redirected, RelationGetRelid, RelationNeedsWAL, PruneState::root_items, START_CRIT_SECTION, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TransactionIdFollows(), TransactionIdRetreat, unlikely, PruneState::visibility_cutoff_xid, PruneState::vistest, PruneFreezeResult::vm_conflict_horizon, WalUsage::wal_fpi, XLogCheckBufferNeedsBackup(), and XLogHintBitIsNeeded.
Referenced by heap_page_prune_opt(), and lazy_scan_prune().
void heap_page_prune_execute | ( | Buffer | buffer, |
bool | lp_truncate_only, | ||
OffsetNumber * | redirected, | ||
int | nredirected, | ||
OffsetNumber * | nowdead, | ||
int | ndead, | ||
OffsetNumber * | nowunused, | ||
int | nunused | ||
) |
Definition at line 1561 of file pruneheap.c.
References Assert, BufferGetPage(), HeapTupleHeaderIsHeapOnly, i, ItemIdGetRedirect, ItemIdHasStorage, ItemIdIsDead, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, ItemIdSetDead, ItemIdSetRedirect, ItemIdSetUnused, page_verify_redirects(), PageGetItem(), PageGetItemId(), PageRepairFragmentation(), PageTruncateLinePointerArray(), and PG_USED_FOR_ASSERTS_ONLY.
Referenced by heap_page_prune_and_freeze(), and heap_xlog_prune_freeze().
Definition at line 193 of file pruneheap.c.
References BUFFER_LOCK_UNLOCK, BufferGetPage(), ConditionalLockBufferForCleanup(), GlobalVisTestFor(), GlobalVisTestIsRemovableXid(), HEAP_DEFAULT_FILLFACTOR, heap_page_prune_and_freeze(), LockBuffer(), Max, PruneFreezeResult::ndeleted, PruneFreezeResult::nnewlpdead, PageGetHeapFreeSpace(), PageIsFull(), pgstat_update_heap_dead_tuples(), PRUNE_ON_ACCESS, RecoveryInProgress(), RelationGetTargetPageFreeSpace, and TransactionIdIsValid.
Referenced by heap_prepare_pagescan(), heapam_index_fetch_tuple(), and heapam_scan_bitmap_next_block().
|
static |
Definition at line 999 of file pruneheap.c.
References Assert, elog, ERROR, FirstOffsetNumber, heap_prune_record_dead_or_unused(), heap_prune_record_redirect(), heap_prune_record_unchanged_lp_normal(), heap_prune_record_unchanged_lp_redirect(), heap_prune_record_unused(), HEAPTUPLE_DEAD, HEAPTUPLE_DELETE_IN_PROGRESS, HEAPTUPLE_INSERT_IN_PROGRESS, HEAPTUPLE_LIVE, HEAPTUPLE_RECENTLY_DEAD, HeapTupleHeaderAdvanceConflictHorizon(), HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderIndicatesMovedPartitions, HeapTupleHeaderIsHotUpdated, PruneState::htsv, htsv_get_valid_status(), i, InvalidTransactionId, ItemIdGetRedirect, ItemIdIsDead, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), PruneState::latest_xid_removed, MaxHeapTuplesPerPage, PageGetItem(), PageGetItemId(), PruneState::processed, HeapTupleHeaderData::t_ctid, TransactionIdEquals, and TransactionIdIsValid.
Referenced by heap_page_prune_and_freeze().
|
static |
Definition at line 1246 of file pruneheap.c.
References Assert, PruneState::deadoffsets, PruneState::lpdead_items, MaxHeapTuplesPerPage, PruneState::ndead, PruneState::ndeleted, PruneState::nowdead, and PruneState::processed.
Referenced by heap_prune_record_dead_or_unused().
|
static |
Definition at line 1280 of file pruneheap.c.
References heap_prune_record_dead(), heap_prune_record_unused(), PruneState::mark_unused_now, and unlikely.
Referenced by heap_prune_chain().
|
static |
Definition at line 1201 of file pruneheap.c.
References Assert, PruneState::new_prune_xid, TransactionIdIsNormal, TransactionIdIsValid, and TransactionIdPrecedes().
Referenced by heap_prune_record_unchanged_lp_normal().
|
static |
Definition at line 1215 of file pruneheap.c.
References Assert, PruneState::hastup, MaxHeapTuplesPerPage, PruneState::ndeleted, PruneState::nredirected, PruneState::processed, and PruneState::redirected.
Referenced by heap_prune_chain().
|
static |
Definition at line 1508 of file pruneheap.c.
References Assert, PruneState::deadoffsets, PruneState::lpdead_items, and PruneState::processed.
Referenced by heap_page_prune_and_freeze().
|
static |
Definition at line 1330 of file pruneheap.c.
References PruneState::all_frozen, PruneState::all_visible, Assert, PruneState::cutoffs, elog, ERROR, PruneState::freeze, PruneState::frozen, PruneState::hastup, heap_prepare_freeze_tuple(), heap_prune_record_prunable(), HEAPTUPLE_DELETE_IN_PROGRESS, HEAPTUPLE_INSERT_IN_PROGRESS, HEAPTUPLE_LIVE, HEAPTUPLE_RECENTLY_DEAD, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderXminCommitted, PruneState::htsv, PruneState::live_tuples, PruneState::nfrozen, HeapTupleFreeze::offset, VacuumCutoffs::OldestXmin, PruneState::pagefrz, PageGetItem(), PageGetItemId(), PruneState::processed, PruneState::recently_dead_tuples, TransactionIdFollows(), TransactionIdIsNormal, TransactionIdPrecedes(), and PruneState::visibility_cutoff_xid.
Referenced by heap_page_prune_and_freeze(), and heap_prune_chain().
|
static |
Definition at line 1536 of file pruneheap.c.
References Assert, and PruneState::processed.
Referenced by heap_prune_chain().
|
static |
Definition at line 1319 of file pruneheap.c.
References Assert, and PruneState::processed.
Referenced by heap_page_prune_and_freeze().
|
static |
Definition at line 1297 of file pruneheap.c.
References Assert, MaxHeapTuplesPerPage, PruneState::ndeleted, PruneState::nowunused, PruneState::nunused, and PruneState::processed.
Referenced by heap_page_prune_and_freeze(), heap_prune_chain(), and heap_prune_record_dead_or_unused().
|
static |
Definition at line 917 of file pruneheap.c.
References PruneState::cutoffs, GlobalVisTestIsRemovableXid(), HEAPTUPLE_DEAD, HEAPTUPLE_RECENTLY_DEAD, HeapTupleSatisfiesVacuumHorizon(), NormalTransactionIdPrecedes, VacuumCutoffs::OldestXmin, res, TransactionIdIsValid, and PruneState::vistest.
Referenced by heap_page_prune_and_freeze().
|
inlinestatic |
Definition at line 960 of file pruneheap.c.
References Assert, HEAPTUPLE_DEAD, and HEAPTUPLE_DELETE_IN_PROGRESS.
Referenced by heap_prune_chain().
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 at line 2053 of file pruneheap.c.
References Assert, BufferGetPage(), data, elog, ERROR, xl_heap_prune::flags, heap_log_freeze_plan(), MaxHeapTuplesPerPage, xlhp_freeze_plans::nplans, xlhp_prune_items::ntargets, PageSetLSN(), PRUNE_ON_ACCESS, PRUNE_VACUUM_CLEANUP, PRUNE_VACUUM_SCAN, REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, SizeOfHeapPrune, TransactionIdIsValid, XLHP_CLEANUP_LOCK, XLHP_HAS_CONFLICT_HORIZON, XLHP_HAS_DEAD_ITEMS, XLHP_HAS_FREEZE_PLANS, XLHP_HAS_NOW_UNUSED_ITEMS, XLHP_HAS_REDIRECTIONS, XLHP_IS_CATALOG_REL, XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_CLEANUP, XLOG_HEAP2_PRUNE_VACUUM_SCAN, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by heap_page_prune_and_freeze(), and lazy_vacuum_heap_page().
|
static |
Definition at line 1737 of file pruneheap.c.
References Assert, FirstOffsetNumber, HeapTupleHeaderIsHeapOnly, ItemIdGetRedirect, ItemIdHasStorage, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, OffsetNumberNext, PageGetItem(), PageGetItemId(), and PageGetMaxOffsetNumber().
Referenced by heap_page_prune_execute().