|
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/visibilitymapdefs.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 1885 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 2012 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 1996 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 2058 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 2078 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 | ( | PruneFreezeParams * | params, |
| PruneFreezeResult * | presult, | ||
| OffsetNumber * | off_loc, | ||
| TransactionId * | new_relfrozen_xid, | ||
| MultiXactId * | new_relmin_mxid | ||
| ) |
Definition at line 809 of file pruneheap.c.
References PruneState::all_frozen, PruneFreezeResult::all_frozen, PruneState::all_visible, PruneFreezeResult::all_visible, Assert(), PruneState::attempt_freeze, PruneFreezeParams::buffer, BufferGetPage(), END_CRIT_SECTION, HeapPageFreeze::FreezePageRelfrozenXid, HeapPageFreeze::FreezePageRelminMxid, PruneState::frozen, PruneState::frz_conflict_horizon, PruneState::hastup, PruneFreezeResult::hastup, heap_freeze_prepared_tuples(), heap_page_prune_execute(), heap_page_will_freeze(), InvalidBuffer, InvalidTransactionId, PruneState::latest_xid_removed, PruneState::live_tuples, PruneFreezeResult::live_tuples, log_heap_prune_and_freeze(), PruneState::lpdead_items, PruneFreezeResult::lpdead_items, MarkBufferDirty(), MarkBufferDirtyHint(), PruneState::ndead, PruneState::ndeleted, PruneFreezeResult::ndeleted, PruneState::new_prune_xid, PruneState::nfrozen, PruneFreezeResult::nfrozen, PruneFreezeResult::nnewlpdead, HeapPageFreeze::NoFreezePageRelfrozenXid, HeapPageFreeze::NoFreezePageRelminMxid, PruneState::nowdead, PruneState::nowunused, PruneState::nredirected, PruneState::nunused, PageClearFull(), PruneState::pagefrz, PageIsFull(), pgWalUsage, prune_freeze_plan(), prune_freeze_setup(), PruneFreezeParams::reason, PruneState::recently_dead_tuples, PruneFreezeResult::recently_dead_tuples, PruneState::redirected, PruneFreezeParams::relation, RelationGetRelid, RelationNeedsWAL, START_CRIT_SECTION, TransactionIdFollows(), PruneState::visibility_cutoff_xid, PruneFreezeResult::vm_conflict_horizon, and WalUsage::wal_fpi.
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 1661 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 209 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(), PruneFreezeParams::relation, RelationGetTargetPageFreeSpace, and TransactionIdIsValid.
Referenced by BitmapHeapScanNextBlock(), heap_prepare_pagescan(), and heapam_index_fetch_tuple().
|
static |
Definition at line 653 of file pruneheap.c.
References PruneState::all_frozen, PruneState::all_visible, Assert(), PruneState::attempt_freeze, PruneState::cutoffs, HeapPageFreeze::freeze_required, PruneState::frozen, PruneState::frz_conflict_horizon, heap_pre_freeze_checks(), PruneState::lpdead_items, PruneState::nfrozen, VacuumCutoffs::OldestXmin, PruneState::pagefrz, RelationNeedsWAL, TransactionIdRetreat, PruneState::visibility_cutoff_xid, XLogCheckBufferNeedsBackup(), and XLogHintBitIsNeeded.
Referenced by heap_page_prune_and_freeze().
|
static |
Definition at line 1093 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 prune_freeze_plan().
|
static |
Definition at line 1340 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 1375 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 1295 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 1309 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 1608 of file pruneheap.c.
References Assert(), PruneState::deadoffsets, PruneState::lpdead_items, and PruneState::processed.
Referenced by prune_freeze_plan().
|
static |
Definition at line 1425 of file pruneheap.c.
References PruneState::all_frozen, PruneState::all_visible, Assert(), PruneState::attempt_freeze, PruneState::cutoffs, elog, ERROR, 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_prune_chain(), and prune_freeze_plan().
|
static |
Definition at line 1636 of file pruneheap.c.
References Assert(), and PruneState::processed.
Referenced by heap_prune_chain().
|
static |
Definition at line 1414 of file pruneheap.c.
References Assert(), and PruneState::processed.
Referenced by prune_freeze_plan().
|
static |
Definition at line 1392 of file pruneheap.c.
References Assert(), MaxHeapTuplesPerPage, PruneState::ndeleted, PruneState::nowunused, PruneState::nunused, and PruneState::processed.
Referenced by heap_prune_chain(), heap_prune_record_dead_or_unused(), and prune_freeze_plan().
|
static |
Definition at line 1011 of file pruneheap.c.
References PruneState::cutoffs, GlobalVisTestIsRemovableXid(), HEAPTUPLE_DEAD, HEAPTUPLE_RECENTLY_DEAD, HeapTupleSatisfiesVacuumHorizon(), NormalTransactionIdPrecedes, VacuumCutoffs::OldestXmin, TransactionIdIsValid, and PruneState::vistest.
Referenced by prune_freeze_plan().
|
inlinestatic |
Definition at line 1054 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, | ||
| 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 at line 2157 of file pruneheap.c.
References Assert(), BufferGetPage(), BufferIsDirty(), 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_NO_IMAGE, REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, SizeOfHeapPrune, TransactionIdIsValid, VISIBILITYMAP_ALL_FROZEN, VISIBILITYMAP_ALL_VISIBLE, VISIBILITYMAP_VALID_BITS, 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, XLHP_VM_ALL_FROZEN, XLHP_VM_ALL_VISIBLE, XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_CLEANUP, XLOG_HEAP2_PRUNE_VACUUM_SCAN, XLogBeginInsert(), XLogHintBitIsNeeded, XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by heap_page_prune_and_freeze(), and lazy_vacuum_heap_page().
|
static |
Definition at line 1837 of file pruneheap.c.
References Assert(), FirstOffsetNumber, HeapTupleHeaderIsHeapOnly(), ItemIdGetRedirect, ItemIdHasStorage, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, OffsetNumberNext, PageGetItem(), PageGetItemId(), and PageGetMaxOffsetNumber().
Referenced by heap_page_prune_execute().
|
static |
Definition at line 448 of file pruneheap.c.
References Assert(), BufferGetBlockNumber(), BufferGetPage(), elog, ERROR, FirstOffsetNumber, 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, InvalidOffsetNumber, ItemIdGetLength, ItemIdIsDead, ItemIdIsNormal, ItemIdIsRedirected, ItemIdIsUsed, ItemPointerSet(), PruneState::latest_xid_removed, likely, PruneState::mark_unused_now, PruneState::nheaponly_items, PruneState::nroot_items, OffsetNumberNext, OffsetNumberPrev, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PruneState::processed, PruneState::root_items, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, and unlikely.
Referenced by heap_page_prune_and_freeze().
|
static |
Definition at line 327 of file pruneheap.c.
References PruneState::all_frozen, PruneState::all_visible, Assert(), PruneState::attempt_freeze, PruneState::cutoffs, PruneFreezeParams::cutoffs, PruneState::deadoffsets, PruneFreezeResult::deadoffsets, HeapPageFreeze::freeze_required, HeapPageFreeze::FreezePageRelfrozenXid, HeapPageFreeze::FreezePageRelminMxid, PruneState::frz_conflict_horizon, PruneState::hastup, HEAP_PAGE_PRUNE_FREEZE, HEAP_PAGE_PRUNE_MARK_UNUSED_NOW, if(), InvalidMultiXactId, InvalidTransactionId, PruneState::latest_xid_removed, PruneState::live_tuples, PruneState::lpdead_items, PruneState::mark_unused_now, PruneState::ndead, PruneState::ndeleted, PruneState::new_prune_xid, PruneState::nfrozen, PruneState::nheaponly_items, HeapPageFreeze::NoFreezePageRelfrozenXid, HeapPageFreeze::NoFreezePageRelminMxid, PruneState::nredirected, PruneState::nroot_items, PruneState::nunused, PruneFreezeParams::options, PruneState::pagefrz, PruneState::recently_dead_tuples, PruneState::visibility_cutoff_xid, PruneState::vistest, and PruneFreezeParams::vistest.
Referenced by heap_page_prune_and_freeze().