PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/bufmask.h"
#include "access/heapam.h"
#include "access/heapam_xlog.h"
#include "access/heaptoast.h"
#include "access/hio.h"
#include "access/multixact.h"
#include "access/parallel.h"
#include "access/relscan.h"
#include "access/subtrans.h"
#include "access/syncscan.h"
#include "access/sysattr.h"
#include "access/tableam.h"
#include "access/transam.h"
#include "access/valid.h"
#include "access/visibilitymap.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "port/atomics.h"
#include "port/pg_bitutils.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/lmgr.h"
#include "storage/predicate.h"
#include "storage/procarray.h"
#include "storage/standby.h"
#include "utils/datum.h"
#include "utils/inval.h"
#include "utils/relcache.h"
#include "utils/snapmgr.h"
#include "utils/spccache.h"
Go to the source code of this file.
Data Structures | |
struct | IndexDeleteCounts |
Macros | |
#define | LOCKMODE_from_mxstatus(status) (tupleLockExtraInfo[TUPLOCK_from_mxstatus((status))].hwlock) |
#define | LockTupleTuplock(rel, tup, mode) LockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
#define | UnlockTupleTuplock(rel, tup, mode) UnlockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
#define | ConditionalLockTupleTuplock(rel, tup, mode) ConditionalLockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
#define | BOTTOMUP_MAX_NBLOCKS 6 |
#define | BOTTOMUP_TOLERANCE_NBLOCKS 3 |
#define | TUPLOCK_from_mxstatus(status) (MultiXactStatusLock[(status)]) |
#define | FRM_NOOP 0x0001 |
#define | FRM_INVALIDATE_XMAX 0x0002 |
#define | FRM_RETURN_IS_XID 0x0004 |
#define | FRM_RETURN_IS_MULTI 0x0008 |
#define | FRM_MARK_COMMITTED 0x0010 |
Typedefs | |
typedef struct IndexDeleteCounts | IndexDeleteCounts |
Variables | |
struct { | |
LOCKMODE hwlock | |
int lockstatus | |
int updstatus | |
} | tupleLockExtraInfo [MaxLockTupleMode+1] |
static const int | MultiXactStatusLock [MaxMultiXactStatus+1] |
#define ConditionalLockTupleTuplock | ( | rel, | |
tup, | |||
mode | |||
) | ConditionalLockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
#define LOCKMODE_from_mxstatus | ( | status | ) | (tupleLockExtraInfo[TUPLOCK_from_mxstatus((status))].hwlock) |
#define LockTupleTuplock | ( | rel, | |
tup, | |||
mode | |||
) | LockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
#define TUPLOCK_from_mxstatus | ( | status | ) | (MultiXactStatusLock[(status)]) |
#define UnlockTupleTuplock | ( | rel, | |
tup, | |||
mode | |||
) | UnlockTuple((rel), (tup), tupleLockExtraInfo[mode].hwlock) |
typedef struct IndexDeleteCounts IndexDeleteCounts |
|
static |
Definition at line 8085 of file heapam.c.
References Assert(), b, BOTTOMUP_MAX_NBLOCKS, BOTTOMUP_TOLERANCE_NBLOCKS, IndexDeleteCounts::ifirsttid, ItemPointerGetBlockNumber(), and TM_IndexDelete::tid.
Referenced by bottomup_sort_and_shrink().
|
static |
Definition at line 8201 of file heapam.c.
References Assert(), b, BlockNumberIsValid(), TM_IndexDeleteOp::bottomup, BOTTOMUP_MAX_NBLOCKS, bottomup_nblocksfavorable(), bottomup_sort_and_shrink_cmp(), TM_IndexDeleteOp::deltids, i, TM_IndexDelete::id, IndexDeleteCounts::ifirsttid, InvalidBlockNumber, ItemPointerGetBlockNumber(), Min, TM_IndexDeleteOp::ndeltids, IndexDeleteCounts::npromisingtids, IndexDeleteCounts::ntids, palloc(), pfree(), pg_nextpower2_32(), TM_IndexStatus::promising, qsort, TM_IndexDeleteOp::status, and TM_IndexDelete::tid.
Referenced by heap_index_delete_tuples().
|
static |
Definition at line 8128 of file heapam.c.
References IndexDeleteCounts::ifirsttid, IndexDeleteCounts::npromisingtids, IndexDeleteCounts::ntids, pg_nextpower2_32(), and pg_unreachable.
Referenced by bottomup_sort_and_shrink().
Definition at line 2468 of file heapam.c.
References HEAP_KEYS_UPDATED, HEAP_XMAX_EXCL_LOCK, HEAP_XMAX_IS_MULTI, HEAP_XMAX_KEYSHR_LOCK, HEAP_XMAX_LOCK_ONLY, XLHL_KEYS_UPDATED, XLHL_XMAX_EXCL_LOCK, XLHL_XMAX_IS_MULTI, XLHL_XMAX_KEYSHR_LOCK, and XLHL_XMAX_LOCK_ONLY.
Referenced by heap_abort_speculative(), heap_delete(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_update(), and log_heap_update().
|
static |
Definition at line 4887 of file heapam.c.
References Assert(), elog, ERROR, get_mxact_status_for_lock(), GetMultiXactIdHintBits(), HEAP_KEYS_UPDATED, HEAP_LOCKED_UPGRADED, HEAP_XMAX_COMMITTED, HEAP_XMAX_EXCL_LOCK, HEAP_XMAX_INVALID, HEAP_XMAX_IS_EXCL_LOCKED, HEAP_XMAX_IS_KEYSHR_LOCKED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HEAP_XMAX_IS_SHR_LOCKED, HEAP_XMAX_KEYSHR_LOCK, HEAP_XMAX_LOCK_ONLY, HEAP_XMAX_SHR_LOCK, InvalidTransactionId, LockTupleExclusive, LockTupleKeyShare, LockTupleNoKeyExclusive, LockTupleShare, mode, MultiXactIdCreate(), MultiXactIdExpand(), MultiXactIdGetUpdateXid(), MultiXactIdIsRunning(), MultiXactStatusForKeyShare, MultiXactStatusForNoKeyUpdate, MultiXactStatusForShare, MultiXactStatusForUpdate, MultiXactStatusNoKeyUpdate, MultiXactStatusUpdate, TransactionIdDidCommit(), TransactionIdIsCurrentTransactionId(), TransactionIdIsInProgress(), TUPLOCK_from_mxstatus, and WARNING.
Referenced by heap_delete(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), and heap_update().
|
static |
Definition at line 7321 of file heapam.c.
References Do_MultiXactIdWait(), remaining, and XLTW_None.
Referenced by heap_lock_tuple().
|
static |
Definition at line 7221 of file heapam.c.
References ConditionalXactLockTableWait(), DoLockModesConflict(), GetMultiXactIdMembers(), HEAP_LOCKED_UPGRADED, HEAP_XMAX_IS_LOCKED_ONLY, i, LOCKMODE_from_mxstatus, oper(), pfree(), remaining, MultiXactMember::status, TransactionIdIsCurrentTransactionId(), TransactionIdIsInProgress(), XactLockTableWait(), and MultiXactMember::xid.
Referenced by ConditionalMultiXactIdWait(), and MultiXactIdWait().
|
static |
Definition at line 7122 of file heapam.c.
References DoLockModesConflict(), GetMultiXactIdMembers(), HEAP_LOCKED_UPGRADED, HEAP_XMAX_IS_LOCKED_ONLY, i, ISUPDATE_from_mxstatus, LOCKMODE_from_mxstatus, pfree(), TransactionIdDidAbort(), TransactionIdIsCurrentTransactionId(), TransactionIdIsInProgress(), tupleLockExtraInfo, and MultiXactMember::xid.
Referenced by heap_delete(), heap_lock_tuple(), and heap_update().
|
static |
Definition at line 8667 of file heapam.c.
References Assert(), bms_free(), bms_is_empty, bms_is_member(), FirstLowInvalidHeapAttributeNumber, heap_deform_tuple(), heap_form_tuple(), heap_freetuple(), HeapTupleHasExternal, i, INDEX_ATTR_BITMAP_IDENTITY_KEY, MaxHeapAttributeNumber, TupleDescData::natts, RelationData::rd_rel, RelationGetDescr, RelationGetIndexAttrBitmap(), RelationIsLogicallyLogged, toast_flatten_tuple(), and values.
Referenced by heap_delete(), and heap_update().
|
static |
Definition at line 9127 of file heapam.c.
References HEAP_KEYS_UPDATED, HEAP_XMAX_EXCL_LOCK, HEAP_XMAX_IS_MULTI, HEAP_XMAX_KEYSHR_LOCK, HEAP_XMAX_LOCK_ONLY, XLHL_KEYS_UPDATED, XLHL_XMAX_EXCL_LOCK, XLHL_XMAX_IS_MULTI, XLHL_XMAX_KEYSHR_LOCK, and XLHL_XMAX_LOCK_ONLY.
Referenced by heap_xlog_delete(), heap_xlog_lock(), heap_xlog_lock_updated(), and heap_xlog_update().
void FreeBulkInsertState | ( | BulkInsertState | bistate | ) |
Definition at line 1774 of file heapam.c.
References BulkInsertStateData::current_buf, FreeAccessStrategy(), InvalidBuffer, pfree(), ReleaseBuffer(), and BulkInsertStateData::strategy.
Referenced by ATRewriteTable(), CopyFrom(), CopyMultiInsertBufferCleanup(), intorel_shutdown(), and transientrel_shutdown().
|
static |
Definition at line 6025 of file heapam.c.
References Assert(), ereport, errcode(), ERRCODE_DATA_CORRUPTED, errdetail_internal(), errmsg_internal(), ERROR, HeapPageFreeze::freeze_required, VacuumCutoffs::FreezeLimit, HeapPageFreeze::FreezePageRelfrozenXid, HeapPageFreeze::FreezePageRelminMxid, FRM_INVALIDATE_XMAX, FRM_MARK_COMMITTED, FRM_NOOP, FRM_RETURN_IS_MULTI, FRM_RETURN_IS_XID, GetMultiXactIdMembers(), HEAP_LOCKED_UPGRADED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, i, InvalidTransactionId, ISUPDATE_from_mxstatus, VacuumCutoffs::MultiXactCutoff, MultiXactIdCreateFromMembers(), MultiXactIdGetUpdateXid(), MultiXactIdIsRunning(), MultiXactIdIsValid, MultiXactIdPrecedes(), VacuumCutoffs::OldestMxact, VacuumCutoffs::OldestXmin, palloc(), pfree(), VacuumCutoffs::relfrozenxid, VacuumCutoffs::relminmxid, MultiXactMember::status, TransactionIdDidCommit(), TransactionIdIsCurrentTransactionId(), TransactionIdIsInProgress(), TransactionIdIsValid, TransactionIdPrecedes(), and MultiXactMember::xid.
Referenced by heap_prepare_freeze_tuple().
|
static |
Definition at line 4092 of file heapam.c.
References elog, ERROR, mode, and tupleLockExtraInfo.
Referenced by compute_new_xmax_infomask(), heap_lock_tuple(), and test_lockmode_for_conflict().
BulkInsertState GetBulkInsertState | ( | void | ) |
Definition at line 1757 of file heapam.c.
References BulkInsertStateData::already_extended_by, BAS_BULKWRITE, BulkInsertStateData::current_buf, GetAccessStrategy(), InvalidBlockNumber, InvalidBuffer, BulkInsertStateData::last_free, BulkInsertStateData::next_free, palloc(), and BulkInsertStateData::strategy.
Referenced by ATRewriteTable(), CopyFrom(), CopyMultiInsertBufferInit(), intorel_startup(), and transientrel_startup().
|
static |
Definition at line 6973 of file heapam.c.
References GetMultiXactIdMembers(), HEAP_KEYS_UPDATED, HEAP_XMAX_EXCL_LOCK, HEAP_XMAX_IS_MULTI, HEAP_XMAX_KEYSHR_LOCK, HEAP_XMAX_LOCK_ONLY, HEAP_XMAX_SHR_LOCK, i, LockTupleExclusive, LockTupleKeyShare, LockTupleNoKeyExclusive, LockTupleShare, mode, MultiXactStatusForKeyShare, MultiXactStatusForNoKeyUpdate, MultiXactStatusForShare, MultiXactStatusForUpdate, MultiXactStatusNoKeyUpdate, MultiXactStatusUpdate, pfree(), and TUPLOCK_from_mxstatus.
Referenced by compute_new_xmax_infomask(), heap_prepare_freeze_tuple(), and heap_update().
void heap2_redo | ( | XLogReaderState * | record | ) |
Definition at line 10014 of file heapam.c.
References elog, heap_xlog_freeze_page(), heap_xlog_lock_updated(), heap_xlog_logical_rewrite(), heap_xlog_multi_insert(), heap_xlog_prune(), heap_xlog_vacuum(), heap_xlog_visible(), PANIC, XLOG_HEAP2_FREEZE_PAGE, XLOG_HEAP2_LOCK_UPDATED, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP2_NEW_CID, XLOG_HEAP2_PRUNE, XLOG_HEAP2_REWRITE, XLOG_HEAP2_VACUUM, XLOG_HEAP2_VISIBLE, XLOG_HEAP_OPMASK, XLogRecGetInfo, and XLR_INFO_MASK.
void heap_abort_speculative | ( | Relation | relation, |
ItemPointer | tid | ||
) |
Definition at line 5736 of file heapam.c.
References Assert(), BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage(), compute_infobits(), elog, END_CRIT_SECTION, ERROR, xl_heap_delete::flags, GetCurrentTransactionId(), HEAP_KEYS_UPDATED, HEAP_MOVED, heap_toast_delete(), HEAP_XMAX_BITS, HeapTupleHasExternal, HeapTupleHeaderIsHeapOnly, HeapTupleHeaderIsSpeculative, HeapTupleHeaderSetXmin, xl_heap_delete::infobits_set, InvalidTransactionId, IsToastRelation(), ItemIdGetLength, ItemIdIsNormal, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), LockBuffer(), MarkBufferDirty(), xl_heap_delete::offnum, PageGetItem(), PageGetItemId(), PageIsAllVisible(), PageSetLSN(), PageSetPrunable, pgstat_count_heap_delete(), RelationData::rd_rel, ReadBuffer(), REGBUF_STANDARD, RelationGetRelid, RelationNeedsWAL, ReleaseBuffer(), SizeOfHeapDelete, START_CRIT_SECTION, HeapTupleHeaderData::t_choice, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_heap, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, HeapTupleFields::t_xmin, TransactionIdIsValid, TransactionIdPrecedes(), TransactionXmin, XLH_DELETE_IS_SUPER, XLOG_HEAP_DELETE, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), and xl_heap_delete::xmax.
Referenced by heapam_tuple_complete_speculative(), and toast_delete_datum().
|
static |
Definition at line 4838 of file heapam.c.
References ConditionalLockTupleTuplock, ereport, errcode(), errmsg(), ERROR, LockTupleTuplock, LockWaitBlock, LockWaitError, LockWaitSkip, mode, and RelationGetRelationName.
Referenced by heap_delete(), heap_lock_tuple(), and heap_update().
|
static |
Definition at line 3910 of file heapam.c.
References Assert(), DatumGetObjectId(), datumIsEqual(), and TupleDescAttr.
Referenced by HeapDetermineColumnsInfo().
TableScanDesc heap_beginscan | ( | Relation | relation, |
Snapshot | snapshot, | ||
int | nkeys, | ||
ScanKey | key, | ||
ParallelTableScanDesc | parallel_scan, | ||
uint32 | flags | ||
) |
Definition at line 927 of file heapam.c.
References Assert(), if(), initscan(), IsMVCCSnapshot, sort-test::key, palloc(), PredicateLockRelation(), RelationGetRelid, RelationIncrementReferenceCount(), HeapScanDescData::rs_base, HeapScanDescData::rs_ctup, TableScanDescData::rs_flags, TableScanDescData::rs_key, TableScanDescData::rs_nkeys, TableScanDescData::rs_parallel, HeapScanDescData::rs_parallelworkerdata, TableScanDescData::rs_rd, TableScanDescData::rs_snapshot, HeapScanDescData::rs_strategy, SO_ALLOW_PAGEMODE, SO_TYPE_SAMPLESCAN, SO_TYPE_SEQSCAN, and HeapTupleData::t_tableOid.
TM_Result heap_delete | ( | Relation | relation, |
ItemPointer | tid, | ||
CommandId | cid, | ||
Snapshot | crosscheck, | ||
bool | wait, | ||
TM_FailureData * | tmfd, | ||
bool | changingPart | ||
) |
Definition at line 2513 of file heapam.c.
References Assert(), BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetBlockNumber(), BufferGetPage(), CacheInvalidateHeapTuple(), CheckForSerializableConflictIn(), TM_FailureData::cmax, compute_infobits(), compute_new_xmax_infomask(), TM_FailureData::ctid, DoesMultiXactIdConflict(), END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, ExtractReplicaIdentity(), xl_heap_delete::flags, GetCurrentTransactionId(), heap_acquire_tuplock(), heap_freetuple(), HEAP_KEYS_UPDATED, HEAP_MOVED, heap_toast_delete(), HEAP_XMAX_BITS, HEAP_XMAX_INVALID, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HeapTupleHasExternal, HeapTupleHeaderAdjustCmax(), HeapTupleHeaderClearHotUpdated, HeapTupleHeaderGetCmax(), HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderIsOnlyLocked(), HeapTupleHeaderSetCmax, HeapTupleHeaderSetMovedPartitions, HeapTupleHeaderSetXmax, HeapTupleSatisfiesUpdate(), HeapTupleSatisfiesVisibility(), xl_heap_delete::infobits_set, InvalidBuffer, InvalidCommandId, InvalidSnapshot, IsInParallelMode(), ItemIdGetLength, ItemIdIsNormal, ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), LockBuffer(), LockTupleExclusive, LockWaitBlock, log_heap_new_cid(), MarkBufferDirty(), MultiXactIdSetOldestMember(), MultiXactIdWait(), MultiXactStatusUpdate, xl_heap_delete::offnum, PageClearAllVisible(), PageGetItem(), PageGetItemId(), PageIsAllVisible(), PageSetLSN(), PageSetPrunable, pgstat_count_heap_delete(), RelationData::rd_rel, ReadBuffer(), REGBUF_STANDARD, RelationGetRelid, RelationIsAccessibleInLogicalDecoding, RelationNeedsWAL, ReleaseBuffer(), SizeOfHeapDelete, SizeOfHeapHeader, SizeofHeapTupleHeader, START_CRIT_SECTION, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, xl_heap_header::t_hoff, HeapTupleHeaderData::t_hoff, xl_heap_header::t_infomask, HeapTupleHeaderData::t_infomask, xl_heap_header::t_infomask2, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TM_BeingModified, TM_Deleted, TM_Invisible, TM_Ok, TM_SelfModified, TM_Updated, TransactionIdEquals, TransactionIdIsCurrentTransactionId(), UnlockReleaseBuffer(), UnlockTupleTuplock, UpdateXmaxHintBits(), visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XactLockTableWait(), XLH_DELETE_ALL_VISIBLE_CLEARED, XLH_DELETE_CONTAINS_OLD_KEY, XLH_DELETE_CONTAINS_OLD_TUPLE, XLH_DELETE_IS_PARTITION_MOVE, XLOG_HEAP_DELETE, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), XLogSetRecordFlags(), XLTW_Delete, xl_heap_delete::xmax, TM_FailureData::xmax, and xmax_infomask_changed().
Referenced by heapam_tuple_delete(), and simple_heap_delete().
void heap_endscan | ( | TableScanDesc | sscan | ) |
Definition at line 1049 of file heapam.c.
References BufferIsValid(), FreeAccessStrategy(), pfree(), RelationDecrementReferenceCount(), ReleaseBuffer(), HeapScanDescData::rs_base, HeapScanDescData::rs_cbuf, TableScanDescData::rs_flags, TableScanDescData::rs_key, HeapScanDescData::rs_parallelworkerdata, TableScanDescData::rs_rd, TableScanDescData::rs_snapshot, HeapScanDescData::rs_strategy, SO_TEMP_SNAPSHOT, and UnregisterSnapshot().
|
inlinestatic |
Definition at line 6649 of file heapam.c.
References FrozenTransactionId, HeapTupleFreeze::frzflags, HeapTupleHeaderSetXmax, HeapTupleHeaderSetXvac, InvalidTransactionId, HeapTupleFreeze::t_infomask, HeapTupleHeaderData::t_infomask, HeapTupleFreeze::t_infomask2, HeapTupleHeaderData::t_infomask2, XLH_FREEZE_XVAC, XLH_INVALID_XVAC, and HeapTupleFreeze::xmax.
Referenced by heap_freeze_execute_prepared(), heap_freeze_tuple(), and heap_xlog_freeze_page().
bool heap_fetch | ( | Relation | relation, |
Snapshot | snapshot, | ||
HeapTuple | tuple, | ||
Buffer * | userbuf, | ||
bool | keep_buf | ||
) |
Definition at line 1341 of file heapam.c.
References BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferGetPage(), HeapCheckForSerializableConflictOut(), HeapTupleHeaderGetXmin, HeapTupleSatisfiesVisibility(), InvalidBuffer, ItemIdGetLength, ItemIdIsNormal, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockBuffer(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PredicateLockTID(), ReadBuffer(), RelationGetRelid, ReleaseBuffer(), HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, and HeapTupleData::t_tableOid.
Referenced by heap_lock_updated_tuple_rec(), heapam_fetch_row_version(), and heapam_tuple_lock().
void heap_finish_speculative | ( | Relation | relation, |
ItemPointer | tid | ||
) |
Definition at line 5649 of file heapam.c.
References Assert(), BUFFER_LOCK_EXCLUSIVE, BufferGetPage(), elog, END_CRIT_SECTION, ERROR, HeapTupleHeaderIsSpeculative, ItemIdIsNormal, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockBuffer(), MarkBufferDirty(), xl_heap_confirm::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), ReadBuffer(), REGBUF_STANDARD, RelationNeedsWAL, SizeOfHeapConfirm, START_CRIT_SECTION, HeapTupleHeaderData::t_ctid, UnlockReleaseBuffer(), XLOG_HEAP_CONFIRM, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), and XLogSetRecordFlags().
Referenced by heapam_tuple_complete_speculative().
void heap_freeze_execute_prepared | ( | Relation | rel, |
Buffer | buffer, | ||
TransactionId | snapshotConflictHorizon, | ||
HeapTupleFreeze * | tuples, | ||
int | ntuples | ||
) |
Definition at line 6678 of file heapam.c.
References Assert(), BufferGetPage(), HeapTupleFreeze::checkflags, END_CRIT_SECTION, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errmsg_internal(), ERROR, heap_execute_freeze_tuple(), HEAP_FREEZE_CHECK_XMAX_ABORTED, HEAP_FREEZE_CHECK_XMIN_COMMITTED, heap_log_freeze_plan(), HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetRawXmin, HeapTupleHeaderXminFrozen, i, xl_heap_freeze_page::isCatalogRel, MarkBufferDirty(), MaxHeapTuplesPerPage, xl_heap_freeze_page::nplans, HeapTupleFreeze::offset, PageGetItem(), PageGetItemId(), PageSetLSN(), REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, RelationNeedsWAL, SizeOfHeapFreezePage, xl_heap_freeze_page::snapshotConflictHorizon, START_CRIT_SECTION, TransactionIdDidCommit(), TransactionIdIsNormal, unlikely, XLOG_HEAP2_FREEZE_PAGE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by lazy_scan_prune().
bool heap_freeze_tuple | ( | HeapTupleHeader | tuple, |
TransactionId | relfrozenxid, | ||
TransactionId | relminmxid, | ||
TransactionId | FreezeLimit, | ||
TransactionId | MultiXactCutoff | ||
) |
Definition at line 6929 of file heapam.c.
References VacuumCutoffs::FreezeLimit, heap_execute_freeze_tuple(), heap_prepare_freeze_tuple(), VacuumCutoffs::MultiXactCutoff, VacuumCutoffs::OldestMxact, VacuumCutoffs::OldestXmin, VacuumCutoffs::relfrozenxid, and VacuumCutoffs::relminmxid.
Referenced by rewrite_heap_tuple().
void heap_get_latest_tid | ( | TableScanDesc | sscan, |
ItemPointer | tid | ||
) |
Definition at line 1613 of file heapam.c.
References Assert(), BUFFER_LOCK_SHARE, BufferGetPage(), HEAP_XMAX_INVALID, HeapCheckForSerializableConflictOut(), HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderIndicatesMovedPartitions, HeapTupleHeaderIsOnlyLocked(), HeapTupleSatisfiesVisibility(), InvalidTransactionId, ItemIdGetLength, ItemIdIsNormal, ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), LockBuffer(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), ReadBuffer(), RelationGetRelid, TableScanDescData::rs_rd, TableScanDescData::rs_snapshot, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TransactionIdEquals, TransactionIdIsValid, and UnlockReleaseBuffer().
HeapTuple heap_getnext | ( | TableScanDesc | sscan, |
ScanDirection | direction | ||
) |
Definition at line 1082 of file heapam.c.
References bsysscan, CheckXidAlive, elog, ereport, errcode(), errmsg_internal(), ERROR, GetHeapamTableAmRoutine(), heapgettup(), heapgettup_pagemode(), pgstat_count_heap_getnext, RelationData::rd_tableam, HeapScanDescData::rs_base, HeapScanDescData::rs_ctup, TableScanDescData::rs_flags, TableScanDescData::rs_key, TableScanDescData::rs_nkeys, TableScanDescData::rs_rd, SO_ALLOW_PAGEMODE, HeapTupleData::t_data, TransactionIdIsValid, and unlikely.
Referenced by AlterTableMoveAll(), AlterTableSpaceOptions(), check_db_file_conflict(), CreateDatabaseUsingFileCopy(), do_autovacuum(), DropSetting(), DropTableSpace(), find_typed_table_dependencies(), get_all_vacuum_rels(), get_database_list(), get_subscription_list(), get_tables_to_cluster(), get_tablespace_name(), get_tablespace_oid(), GetAllTablesPublicationRelations(), getRelationsInNamespace(), GetSchemaPublicationRelations(), heapam_index_build_range_scan(), heapam_index_validate_scan(), index_update_stats(), objectsInSchemaToOids(), pgrowlocks(), pgstat_heap(), populate_typ_list(), ReindexMultipleTables(), remove_dbtablespaces(), RemoveSubscriptionRel(), RenameTableSpace(), ThereIsAtLeastOneRole(), and vac_truncate_clog().
bool heap_getnextslot | ( | TableScanDesc | sscan, |
ScanDirection | direction, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 1131 of file heapam.c.
References ExecClearTuple(), ExecStoreBufferHeapTuple(), heapgettup(), heapgettup_pagemode(), pgstat_count_heap_getnext, HeapScanDescData::rs_base, HeapScanDescData::rs_cbuf, HeapScanDescData::rs_ctup, TableScanDescData::rs_flags, TableScanDescData::rs_key, TableScanDescData::rs_nkeys, TableScanDescData::rs_rd, SO_ALLOW_PAGEMODE, and HeapTupleData::t_data.
bool heap_getnextslot_tidrange | ( | TableScanDesc | sscan, |
ScanDirection | direction, | ||
TupleTableSlot * | slot | ||
) |
Definition at line 1234 of file heapam.c.
References ExecClearTuple(), ExecStoreBufferHeapTuple(), heapgettup(), heapgettup_pagemode(), ItemPointerCompare(), pgstat_count_heap_getnext, HeapScanDescData::rs_base, HeapScanDescData::rs_cbuf, HeapScanDescData::rs_ctup, TableScanDescData::rs_flags, TableScanDescData::rs_key, TableScanDescData::rs_maxtid, TableScanDescData::rs_mintid, TableScanDescData::rs_nkeys, TableScanDescData::rs_rd, ScanDirectionIsBackward, ScanDirectionIsForward, SO_ALLOW_PAGEMODE, HeapTupleData::t_data, and HeapTupleData::t_self.
bool heap_hot_search_buffer | ( | ItemPointer | tid, |
Relation | relation, | ||
Buffer | buffer, | ||
Snapshot | snapshot, | ||
HeapTuple | heapTuple, | ||
bool * | all_dead, | ||
bool | first_call | ||
) |
Definition at line 1461 of file heapam.c.
References Assert(), BufferGetBlockNumber(), BufferGetPage(), GlobalVisTestFor(), HeapCheckForSerializableConflictOut(), HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleIsHeapOnly, HeapTupleIsHotUpdated, HeapTupleIsSurelyDead(), HeapTupleSatisfiesVisibility(), InvalidTransactionId, ItemIdGetLength, ItemIdGetRedirect, ItemIdIsNormal, ItemIdIsRedirected, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerSet(), ItemPointerSetOffsetNumber(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PredicateLockTID(), RecentXmin, RelationGetRelid, skip, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TransactionIdEquals, and TransactionIdIsValid.
Referenced by heap_index_delete_tuples(), heapam_index_fetch_tuple(), and heapam_scan_bitmap_next_block().
TransactionId heap_index_delete_tuples | ( | Relation | rel, |
TM_IndexDeleteOp * | delstate | ||
) |
Definition at line 7643 of file heapam.c.
References Assert(), TM_IndexDeleteOp::bottomup, BOTTOMUP_MAX_NBLOCKS, bottomup_sort_and_shrink(), TM_IndexDeleteOp::bottomupfreespace, buf, BUFFER_LOCK_SHARE, BufferGetPage(), BufferIsValid(), TM_IndexDeleteOp::deltids, FirstOffsetNumber, TM_IndexStatus::freespace, get_tablespace_maintenance_io_concurrency(), GlobalVisTestFor(), heap_hot_search_buffer(), HeapTupleHeaderAdvanceConflictHorizon(), HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderIsHotUpdated, i, TM_IndexDelete::id, index_delete_check_htid(), index_delete_sort(), InitNonVacuumableSnapshot, InvalidBlockNumber, InvalidBuffer, InvalidOffsetNumber, InvalidTransactionId, IsCatalogRelation(), ItemIdGetRedirect, ItemIdIsNormal, ItemIdIsRedirected, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), TM_IndexStatus::knowndeletable, LockBuffer(), maintenance_io_concurrency, Min, TM_IndexDeleteOp::ndeltids, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), TM_IndexStatus::promising, RelationData::rd_rel, ReadBuffer(), TM_IndexDeleteOp::status, HeapTupleHeaderData::t_ctid, TM_IndexDelete::tid, TransactionIdEquals, TransactionIdIsValid, and UnlockReleaseBuffer().
Definition at line 5889 of file heapam.c.
References BUFFER_LOCK_EXCLUSIVE, BufferGetPage(), CacheInvalidateHeapTuple(), elog, END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, IsBootstrapProcessingMode, IsInParallelMode(), ItemIdGetLength, ItemIdIsNormal, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockBuffer(), MarkBufferDirty(), xl_heap_inplace::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), ReadBuffer(), REGBUF_STANDARD, RelationNeedsWAL, SizeOfHeapInplace, START_CRIT_SECTION, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, HeapTupleData::t_len, HeapTupleData::t_self, UnlockReleaseBuffer(), XLOG_HEAP_INPLACE, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by create_toast_table(), dropdb(), EventTriggerOnLogin(), index_update_stats(), vac_update_datfrozenxid(), and vac_update_relstats().
void heap_insert | ( | Relation | relation, |
HeapTuple | tup, | ||
CommandId | cid, | ||
int | options, | ||
BulkInsertState | bistate | ||
) |
Definition at line 1824 of file heapam.c.
References Assert(), BufferGetBlockNumber(), BufferGetPage(), CacheInvalidateHeapTuple(), CheckForSerializableConflictIn(), END_CRIT_SECTION, FirstOffsetNumber, xl_heap_insert::flags, GetCurrentTransactionId(), heap_freetuple(), HEAP_INSERT_NO_LOGICAL, HEAP_INSERT_SPECULATIVE, heap_prepare_insert(), HeapTupleHeaderGetNatts, InvalidBlockNumber, InvalidBuffer, IsToastRelation(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), log_heap_new_cid(), MarkBufferDirty(), xl_heap_insert::offnum, PageClearAllVisible(), PageGetMaxOffsetNumber(), PageIsAllVisible(), PageSetLSN(), pgstat_count_heap_insert(), REGBUF_KEEP_DATA, REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetBufferForTuple(), RelationGetNumberOfAttributes, RelationIsAccessibleInLogicalDecoding, RelationIsLogicallyLogged, RelationNeedsWAL, RelationPutHeapTuple(), ReleaseBuffer(), SizeOfHeapHeader, SizeOfHeapInsert, SizeofHeapTupleHeader, START_CRIT_SECTION, HeapTupleData::t_data, xl_heap_header::t_hoff, HeapTupleHeaderData::t_hoff, xl_heap_header::t_infomask, HeapTupleHeaderData::t_infomask, xl_heap_header::t_infomask2, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, UnlockReleaseBuffer(), visibilitymap_clear(), VISIBILITYMAP_VALID_BITS, XLH_INSERT_ALL_VISIBLE_CLEARED, XLH_INSERT_CONTAINS_NEW_TUPLE, XLH_INSERT_IS_SPECULATIVE, XLH_INSERT_ON_TOAST_RELATION, XLOG_HEAP_INIT_PAGE, XLOG_HEAP_INSERT, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), XLogRegisterData(), and XLogSetRecordFlags().
Referenced by heapam_tuple_insert(), heapam_tuple_insert_speculative(), simple_heap_insert(), and toast_save_datum().
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 at line 4140 of file heapam.c.
References Assert(), BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage(), BufferIsValid(), TM_FailureData::cmax, compute_infobits(), compute_new_xmax_infomask(), ConditionalMultiXactIdWait(), ConditionalXactLockTableWait(), TM_FailureData::ctid, DoesMultiXactIdConflict(), elog, END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, xl_heap_lock::flags, get_mxact_status_for_lock(), GetCurrentTransactionId(), GetMultiXactIdMembers(), heap_acquire_tuplock(), HEAP_KEYS_UPDATED, heap_lock_updated_tuple(), HEAP_XMAX_BITS, HEAP_XMAX_INVALID, HEAP_XMAX_IS_EXCL_LOCKED, HEAP_XMAX_IS_KEYSHR_LOCKED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HEAP_XMAX_IS_SHR_LOCKED, HeapTupleHeaderClearHotUpdated, HeapTupleHeaderGetCmax(), HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderIsOnlyLocked(), HeapTupleHeaderSetXmax, HeapTupleSatisfiesUpdate(), i, xl_heap_lock::infobits_set, InvalidBuffer, InvalidCommandId, ItemIdGetLength, ItemIdIsNormal, ItemPointerCopy(), ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockBuffer(), LockTupleExclusive, LockTupleKeyShare, LockTupleNoKeyExclusive, LockTupleShare, LockWaitBlock, LockWaitError, LockWaitSkip, MarkBufferDirty(), mode, MultiXactIdSetOldestMember(), MultiXactIdWait(), MultiXactStatusNoKeyUpdate, xl_heap_lock::offnum, PageGetItem(), PageGetItemId(), PageIsAllVisible(), PageSetLSN(), pfree(), ReadBuffer(), REGBUF_STANDARD, RelationGetRelationName, RelationGetRelid, RelationNeedsWAL, ReleaseBuffer(), res, SizeOfHeapLock, START_CRIT_SECTION, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TM_BeingModified, TM_Deleted, TM_Invisible, TM_Ok, TM_SelfModified, TM_Updated, TM_WouldBlock, TransactionIdEquals, TransactionIdIsCurrentTransactionId(), TUPLOCK_from_mxstatus, UnlockTupleTuplock, UpdateXmaxHintBits(), VISIBILITYMAP_ALL_FROZEN, visibilitymap_clear(), visibilitymap_pin(), XactLockTableWait(), XLH_LOCK_ALL_FROZEN_CLEARED, XLOG_HEAP_LOCK, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), XLTW_Lock, xl_heap_lock::xmax, TM_FailureData::xmax, and xmax_infomask_changed().
Referenced by heapam_tuple_lock().
|
static |
Definition at line 5604 of file heapam.c.
References heap_lock_updated_tuple_rec(), HeapTupleHeaderIndicatesMovedPartitions, ItemPointerEquals(), mode, MultiXactIdSetOldestMember(), HeapTupleData::t_data, HeapTupleData::t_self, and TM_Ok.
Referenced by heap_lock_tuple().
|
static |
Definition at line 5259 of file heapam.c.
References Assert(), buf, BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetPage(), CHECK_FOR_INTERRUPTS, compute_infobits(), compute_new_xmax_infomask(), elog, END_CRIT_SECTION, ERROR, xl_heap_lock_updated::flags, GetMultiXactIdMembers(), heap_fetch(), HEAP_KEYS_UPDATED, HEAP_LOCKED_UPGRADED, HEAP_XMAX_BITS, HEAP_XMAX_INVALID, HEAP_XMAX_IS_EXCL_LOCKED, HEAP_XMAX_IS_KEYSHR_LOCKED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HEAP_XMAX_IS_SHR_LOCKED, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderIndicatesMovedPartitions, HeapTupleHeaderIsOnlyLocked(), HeapTupleHeaderSetXmax, i, xl_heap_lock_updated::infobits_set, InvalidBuffer, InvalidTransactionId, ItemPointerCopy(), ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), LockBuffer(), MarkBufferDirty(), mode, MultiXactStatusForKeyShare, MultiXactStatusForNoKeyUpdate, MultiXactStatusForShare, MultiXactStatusForUpdate, MultiXactStatusNoKeyUpdate, MultiXactStatusUpdate, next, xl_heap_lock_updated::offnum, PageIsAllVisible(), PageSetLSN(), pfree(), REGBUF_STANDARD, RelationNeedsWAL, ReleaseBuffer(), SizeOfHeapLockUpdated, SnapshotAny, START_CRIT_SECTION, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_self, test_lockmode_for_conflict(), TM_Ok, TM_SelfModified, TransactionIdDidAbort(), TransactionIdEquals, TransactionIdIsValid, UnlockReleaseBuffer(), VISIBILITYMAP_ALL_FROZEN, visibilitymap_clear(), visibilitymap_pin(), XactLockTableWait(), XLH_LOCK_ALL_FROZEN_CLEARED, XLOG_HEAP2_LOCK_UPDATED, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), XLTW_LockUpdated, and xl_heap_lock_updated::xmax.
Referenced by heap_lock_updated_tuple().
|
static |
Definition at line 6788 of file heapam.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 6835 of file heapam.c.
References HeapTupleFreeze::frzflags, plan, HeapTupleFreeze::t_infomask, HeapTupleFreeze::t_infomask2, and HeapTupleFreeze::xmax.
Referenced by heap_log_freeze_plan().
|
inlinestatic |
Definition at line 6852 of file heapam.c.
References HeapTupleFreeze::frzflags, plan, HeapTupleFreeze::t_infomask, HeapTupleFreeze::t_infomask2, and HeapTupleFreeze::xmax.
Referenced by heap_log_freeze_plan().
|
static |
Definition at line 6872 of file heapam.c.
References Assert(), heap_log_freeze_cmp(), heap_log_freeze_eq(), heap_log_freeze_new_plan(), i, xl_heap_freeze_plan::ntuples, HeapTupleFreeze::offset, and qsort.
Referenced by heap_freeze_execute_prepared().
void heap_mask | ( | char * | pagedata, |
BlockNumber | blkno | ||
) |
Definition at line 10057 of file heapam.c.
References HEAP_XACT_MASK, HEAP_XMAX_COMMITTED, HEAP_XMAX_INVALID, HeapTupleHeaderIsSpeculative, HeapTupleHeaderXminFrozen, ItemIdGetLength, ItemIdGetOffset, ItemIdHasStorage, ItemIdIsNormal, ItemPointerSet(), len, MASK_MARKER, mask_page_hint_bits(), mask_page_lsn_and_checksum(), mask_unused_space(), MAXALIGN, PageGetItemId(), PageGetMaxOffsetNumber(), and HeapTupleHeaderData::t_infomask.
void heap_multi_insert | ( | Relation | relation, |
TupleTableSlot ** | slots, | ||
int | ntuples, | ||
CommandId | cid, | ||
int | options, | ||
BulkInsertState | bistate | ||
) |
Definition at line 2093 of file heapam.c.
References Assert(), BufferGetBlockNumber(), BufferGetPage(), CacheInvalidateHeapTuple(), CHECK_FOR_INTERRUPTS, CheckForSerializableConflictIn(), PGAlignedBlock::data, xl_multi_insert_tuple::datalen, END_CRIT_SECTION, ExecFetchSlotHeapTuple(), xl_heap_multi_insert::flags, GetCurrentTransactionId(), HEAP_DEFAULT_FILLFACTOR, HEAP_INSERT_FROZEN, HEAP_INSERT_NO_LOGICAL, heap_multi_insert_pages(), heap_prepare_insert(), i, init, InvalidBlockNumber, InvalidBuffer, InvalidTransactionId, InvalidXLogRecPtr, IsCatalogRelation(), ItemPointerGetOffsetNumber(), log_heap_new_cid(), MarkBufferDirty(), MAXALIGN, xl_heap_multi_insert::ntuples, xl_heap_multi_insert::offsets, PageClearAllVisible(), PageGetHeapFreeSpace(), PageGetMaxOffsetNumber(), PageIsAllVisible(), PageSetAllVisible(), PageSetLSN(), palloc(), pgstat_count_heap_insert(), REGBUF_KEEP_DATA, REGBUF_STANDARD, REGBUF_WILL_INIT, RelationGetBufferForTuple(), RelationGetRelid, RelationGetTargetPageFreeSpace, RelationIsAccessibleInLogicalDecoding, RelationIsLogicallyLogged, RelationNeedsWAL, RelationPutHeapTuple(), ReleaseBuffer(), SHORTALIGN, SizeOfHeapMultiInsert, SizeofHeapTupleHeader, SizeOfMultiInsertTuple, START_CRIT_SECTION, HeapTupleData::t_data, xl_multi_insert_tuple::t_hoff, HeapTupleHeaderData::t_hoff, xl_multi_insert_tuple::t_infomask, HeapTupleHeaderData::t_infomask, xl_multi_insert_tuple::t_infomask2, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TupleTableSlot::tts_tableOid, UnlockReleaseBuffer(), VISIBILITYMAP_ALL_FROZEN, VISIBILITYMAP_ALL_VISIBLE, visibilitymap_clear(), visibilitymap_pin_ok(), visibilitymap_set(), VISIBILITYMAP_VALID_BITS, XLH_INSERT_ALL_FROZEN_SET, XLH_INSERT_ALL_VISIBLE_CLEARED, XLH_INSERT_CONTAINS_NEW_TUPLE, XLH_INSERT_LAST_IN_MULTI, XLOG_HEAP2_MULTI_INSERT, XLOG_HEAP_INIT_PAGE, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), XLogRegisterData(), and XLogSetRecordFlags().
Referenced by CatalogTuplesMultiInsertWithInfo().
|
static |
Definition at line 2061 of file heapam.c.
References i, MAXALIGN, and SizeOfPageHeaderData.
Referenced by heap_multi_insert().
bool heap_prepare_freeze_tuple | ( | HeapTupleHeader | tuple, |
const struct VacuumCutoffs * | cutoffs, | ||
HeapPageFreeze * | pagefrz, | ||
HeapTupleFreeze * | frz, | ||
bool * | totally_frozen | ||
) |
Definition at line 6375 of file heapam.c.
References Assert(), HeapTupleFreeze::checkflags, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errmsg_internal(), ERROR, HeapPageFreeze::freeze_required, FreezeMultiXactId(), FRM_INVALIDATE_XMAX, FRM_MARK_COMMITTED, FRM_NOOP, FRM_RETURN_IS_MULTI, FRM_RETURN_IS_XID, HeapTupleFreeze::frzflags, GetMultiXactIdHintBits(), HEAP_FREEZE_CHECK_XMAX_ABORTED, HEAP_FREEZE_CHECK_XMIN_COMMITTED, HEAP_HOT_UPDATED, HEAP_KEYS_UPDATED, HEAP_MOVED_OFF, heap_tuple_should_freeze(), HEAP_XMAX_BITS, HEAP_XMAX_COMMITTED, HEAP_XMAX_INVALID, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HEAP_XMIN_FROZEN, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetXmin, HeapTupleHeaderGetXvac, InvalidTransactionId, VacuumCutoffs::MultiXactCutoff, MultiXactIdIsValid, MultiXactIdPrecedes(), HeapPageFreeze::NoFreezePageRelfrozenXid, HeapPageFreeze::NoFreezePageRelminMxid, VacuumCutoffs::OldestMxact, VacuumCutoffs::OldestXmin, VacuumCutoffs::relfrozenxid, HeapTupleFreeze::t_infomask, HeapTupleHeaderData::t_infomask, HeapTupleFreeze::t_infomask2, HeapTupleHeaderData::t_infomask2, TransactionIdIsNormal, TransactionIdIsValid, TransactionIdPrecedes(), TransactionIdPrecedesOrEquals(), XLH_FREEZE_XVAC, XLH_INVALID_XVAC, and HeapTupleFreeze::xmax.
Referenced by heap_freeze_tuple(), and lazy_scan_prune().
|
static |
Definition at line 2013 of file heapam.c.
References Assert(), ereport, errcode(), errmsg(), ERROR, HEAP2_XACT_MASK, HEAP_INSERT_FROZEN, heap_toast_insert_or_update(), HEAP_XACT_MASK, HEAP_XMAX_INVALID, HeapTupleHasExternal, HeapTupleHeaderSetCmin, HeapTupleHeaderSetXmax, HeapTupleHeaderSetXmin, HeapTupleHeaderSetXminFrozen, IsParallelWorker, RelationData::rd_rel, RelationGetRelid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_tableOid, and TOAST_TUPLE_THRESHOLD.
Referenced by heap_insert(), and heap_multi_insert().
void heap_redo | ( | XLogReaderState * | record | ) |
Definition at line 9968 of file heapam.c.
References elog, heap_xlog_confirm(), heap_xlog_delete(), heap_xlog_inplace(), heap_xlog_insert(), heap_xlog_lock(), heap_xlog_update(), PANIC, XLOG_HEAP_CONFIRM, XLOG_HEAP_DELETE, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INPLACE, XLOG_HEAP_INSERT, XLOG_HEAP_LOCK, XLOG_HEAP_OPMASK, XLOG_HEAP_TRUNCATE, XLOG_HEAP_UPDATE, XLogRecGetInfo, and XLR_INFO_MASK.
void heap_rescan | ( | TableScanDesc | sscan, |
ScanKey | key, | ||
bool | set_params, | ||
bool | allow_strat, | ||
bool | allow_sync, | ||
bool | allow_pagemode | ||
) |
Definition at line 1012 of file heapam.c.
References BufferIsValid(), initscan(), IsMVCCSnapshot, sort-test::key, ReleaseBuffer(), HeapScanDescData::rs_base, HeapScanDescData::rs_cbuf, TableScanDescData::rs_flags, TableScanDescData::rs_snapshot, SO_ALLOW_PAGEMODE, SO_ALLOW_STRAT, and SO_ALLOW_SYNC.
void heap_set_tidrange | ( | TableScanDesc | sscan, |
ItemPointer | mintid, | ||
ItemPointer | maxtid | ||
) |
Definition at line 1161 of file heapam.c.
References FirstOffsetNumber, heap_setscanlimits(), ItemPointerCompare(), ItemPointerCopy(), ItemPointerGetBlockNumberNoCheck(), ItemPointerSet(), MaxOffsetNumber, TableScanDescData::rs_maxtid, TableScanDescData::rs_mintid, and HeapScanDescData::rs_nblocks.
void heap_setscanlimits | ( | TableScanDesc | sscan, |
BlockNumber | startBlk, | ||
BlockNumber | numBlks | ||
) |
Definition at line 350 of file heapam.c.
References Assert(), HeapScanDescData::rs_base, TableScanDescData::rs_flags, HeapScanDescData::rs_inited, HeapScanDescData::rs_numblocks, HeapScanDescData::rs_startblock, and SO_ALLOW_SYNC.
Referenced by heap_set_tidrange(), and heapam_index_build_range_scan().
bool heap_tuple_needs_eventual_freeze | ( | HeapTupleHeader | tuple | ) |
Definition at line 7335 of file heapam.c.
References HEAP_MOVED, HEAP_XMAX_IS_MULTI, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetXmin, HeapTupleHeaderGetXvac, MultiXactIdIsValid, HeapTupleHeaderData::t_infomask, and TransactionIdIsNormal.
Referenced by collect_corrupt_items(), and heap_page_is_all_visible().
bool heap_tuple_should_freeze | ( | HeapTupleHeader | tuple, |
const struct VacuumCutoffs * | cutoffs, | ||
TransactionId * | NoFreezePageRelfrozenXid, | ||
MultiXactId * | NoFreezePageRelminMxid | ||
) |
Definition at line 7390 of file heapam.c.
References Assert(), VacuumCutoffs::FreezeLimit, GetMultiXactIdMembers(), HEAP_LOCKED_UPGRADED, HEAP_MOVED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetXmin, HeapTupleHeaderGetXvac, i, InvalidMultiXactId, InvalidTransactionId, VacuumCutoffs::MultiXactCutoff, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactIdPrecedesOrEquals(), pfree(), VacuumCutoffs::relfrozenxid, VacuumCutoffs::relminmxid, HeapTupleHeaderData::t_infomask, TransactionIdIsNormal, TransactionIdPrecedes(), TransactionIdPrecedesOrEquals(), and MultiXactMember::xid.
Referenced by heap_prepare_freeze_tuple(), and lazy_scan_noprune().
TM_Result heap_update | ( | Relation | relation, |
ItemPointer | otid, | ||
HeapTuple | newtup, | ||
CommandId | cid, | ||
Snapshot | crosscheck, | ||
bool | wait, | ||
TM_FailureData * | tmfd, | ||
LockTupleMode * | lockmode, | ||
TU_UpdateIndexes * | update_indexes | ||
) |
Definition at line 2980 of file heapam.c.
References Assert(), bms_add_members(), bms_free(), bms_overlap(), BUFFER_LOCK_EXCLUSIVE, BUFFER_LOCK_UNLOCK, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), CacheInvalidateHeapTuple(), CheckForSerializableConflictIn(), TM_FailureData::cmax, compute_infobits(), compute_new_xmax_infomask(), TM_FailureData::ctid, DoesMultiXactIdConflict(), END_CRIT_SECTION, ereport, errcode(), errmsg(), ERROR, ExtractReplicaIdentity(), xl_heap_lock::flags, GetCurrentTransactionId(), GetMultiXactIdHintBits(), HEAP2_XACT_MASK, heap_acquire_tuplock(), heap_freetuple(), HEAP_KEYS_UPDATED, HEAP_LOCKED_UPGRADED, HEAP_MOVED, heap_toast_insert_or_update(), HEAP_UPDATED, HEAP_XACT_MASK, HEAP_XMAX_BITS, HEAP_XMAX_INVALID, HEAP_XMAX_IS_KEYSHR_LOCKED, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HEAP_XMAX_KEYSHR_LOCK, HEAP_XMAX_LOCK_ONLY, HeapDetermineColumnsInfo(), HeapTupleClearHeapOnly, HeapTupleClearHotUpdated, HeapTupleGetUpdateXid(), HeapTupleHasExternal, HeapTupleHeaderAdjustCmax(), HeapTupleHeaderGetCmax(), HeapTupleHeaderGetNatts, HeapTupleHeaderGetRawXmax, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderSetCmax, HeapTupleHeaderSetCmin, HeapTupleHeaderSetXmax, HeapTupleHeaderSetXmin, HeapTupleSatisfiesUpdate(), HeapTupleSatisfiesVisibility(), HeapTupleSetHeapOnly, HeapTupleSetHotUpdated, INDEX_ATTR_BITMAP_HOT_BLOCKING, INDEX_ATTR_BITMAP_IDENTITY_KEY, INDEX_ATTR_BITMAP_KEY, INDEX_ATTR_BITMAP_SUMMARIZED, xl_heap_lock::infobits_set, InvalidBuffer, InvalidCommandId, InvalidSnapshot, InvalidTransactionId, IsInParallelMode(), ItemIdGetLength, ItemIdIsNormal, ItemPointerEquals(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), ItemPointerIsValid(), LockBuffer(), LockTupleExclusive, LockTupleNoKeyExclusive, LockWaitBlock, log_heap_new_cid(), log_heap_update(), MarkBufferDirty(), MAXALIGN, MultiXactIdSetOldestMember(), MultiXactIdWait(), MultiXactStatusNoKeyUpdate, MultiXactStatusUpdate, xl_heap_lock::offnum, PageClearAllVisible(), PageGetHeapFreeSpace(), PageGetItem(), PageGetItemId(), PageIsAllVisible(), PageSetFull(), PageSetLSN(), PageSetPrunable, pgstat_count_heap_update(), RelationData::rd_rel, ReadBuffer(), REGBUF_STANDARD, RelationGetBufferForTuple(), RelationGetIndexAttrBitmap(), RelationGetNumberOfAttributes, RelationGetRelid, RelationIsAccessibleInLogicalDecoding, RelationNeedsWAL, RelationPutHeapTuple(), ReleaseBuffer(), SizeOfHeapLock, START_CRIT_SECTION, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, TM_BeingModified, TM_Deleted, TM_Invisible, TM_Ok, TM_SelfModified, TM_Updated, TOAST_TUPLE_THRESHOLD, TransactionIdDidAbort(), TransactionIdEquals, TransactionIdIsCurrentTransactionId(), TransactionIdIsValid, TU_All, TU_None, TU_Summarizing, UnlockReleaseBuffer(), UnlockTupleTuplock, UpdateXmaxHintBits(), VISIBILITYMAP_ALL_FROZEN, visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XactLockTableWait(), XLH_LOCK_ALL_FROZEN_CLEARED, XLOG_HEAP_LOCK, XLogBeginInsert(), XLogInsert(), XLogRegisterBuffer(), XLogRegisterData(), XLTW_Update, xl_heap_lock::xmax, TM_FailureData::xmax, and xmax_infomask_changed().
Referenced by heapam_tuple_update(), and simple_heap_update().
|
static |
Definition at line 9760 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), elog, XLogReaderState::EndRecPtr, ItemIdIsNormal, ItemPointerSet(), MarkBufferDirty(), xl_heap_confirm::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), PANIC, HeapTupleHeaderData::t_ctid, UnlockReleaseBuffer(), XLogReadBufferForRedo(), and XLogRecGetData.
Referenced by heap_redo().
|
static |
Definition at line 9148 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), CreateFakeRelcacheEntry(), elog, XLogReaderState::EndRecPtr, FirstCommandId, fix_infomask_from_infobits(), xl_heap_delete::flags, FreeFakeRelcacheEntry(), HEAP_KEYS_UPDATED, HEAP_MOVED, HEAP_XMAX_BITS, HeapTupleHeaderClearHotUpdated, HeapTupleHeaderSetCmax, HeapTupleHeaderSetMovedPartitions, HeapTupleHeaderSetXmax, HeapTupleHeaderSetXmin, xl_heap_delete::infobits_set, InvalidBuffer, InvalidTransactionId, ItemIdIsNormal, ItemPointerSetBlockNumber(), ItemPointerSetOffsetNumber(), MarkBufferDirty(), xl_heap_delete::offnum, PageClearAllVisible(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), PageSetPrunable, PANIC, ReleaseBuffer(), HeapTupleHeaderData::t_ctid, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, UnlockReleaseBuffer(), visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XLH_DELETE_ALL_VISIBLE_CLEARED, XLH_DELETE_IS_PARTITION_MOVE, XLH_DELETE_IS_SUPER, XLogReadBufferForRedo(), XLogRecGetBlockTag(), XLogRecGetData, XLogRecGetXid, and xl_heap_delete::xmax.
Referenced by heap_redo().
|
static |
Definition at line 9056 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), XLogReaderState::EndRecPtr, HeapTupleFreeze::frzflags, xl_heap_freeze_plan::frzflags, heap_execute_freeze_tuple(), i, InHotStandby, InvalidOffsetNumber, xl_heap_freeze_page::isCatalogRel, MarkBufferDirty(), xl_heap_freeze_page::nplans, xl_heap_freeze_plan::ntuples, HeapTupleFreeze::offset, PageGetItem(), PageGetItemId(), PageSetLSN(), ResolveRecoveryConflictWithSnapshot(), xl_heap_freeze_page::snapshotConflictHorizon, HeapTupleFreeze::t_infomask, xl_heap_freeze_plan::t_infomask, HeapTupleFreeze::t_infomask2, xl_heap_freeze_plan::t_infomask2, UnlockReleaseBuffer(), XLogReadBufferForRedo(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetData, HeapTupleFreeze::xmax, and xl_heap_freeze_plan::xmax.
Referenced by heap2_redo().
|
static |
Definition at line 9927 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), elog, XLogReaderState::EndRecPtr, ItemIdGetLength, ItemIdIsNormal, MarkBufferDirty(), xl_heap_inplace::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), PANIC, HeapTupleHeaderData::t_hoff, UnlockReleaseBuffer(), XLogReadBufferForRedo(), XLogRecGetBlockData(), and XLogRecGetData.
Referenced by heap_redo().
|
static |
Definition at line 9221 of file heapam.c.
References generate_unaccent_rules::action, Assert(), BLK_NEEDS_REDO, BufferGetPage(), BufferGetPageSize(), BufferIsValid(), CreateFakeRelcacheEntry(), data, elog, XLogReaderState::EndRecPtr, FirstCommandId, xl_heap_insert::flags, FreeFakeRelcacheEntry(), HeapTupleHeaderSetCmin, HeapTupleHeaderSetXmin, InvalidBuffer, InvalidOffsetNumber, ItemPointerSetBlockNumber(), ItemPointerSetOffsetNumber(), MarkBufferDirty(), MaxHeapTupleSize, MemSet, xl_heap_insert::offnum, PageAddItem, PageClearAllVisible(), PageGetHeapFreeSpace(), PageGetMaxOffsetNumber(), PageInit(), PageSetAllVisible(), PageSetLSN(), PANIC, ReleaseBuffer(), SizeOfHeapHeader, SizeofHeapTupleHeader, UnlockReleaseBuffer(), visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XLH_INSERT_ALL_FROZEN_SET, XLH_INSERT_ALL_VISIBLE_CLEARED, XLOG_HEAP_INIT_PAGE, XLogInitBufferForRedo(), XLogReadBufferForRedo(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetData, XLogRecGetInfo, XLogRecGetXid, and XLogRecordPageWithFreeSpace().
Referenced by heap_redo().
|
static |
Definition at line 9796 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetBlockNumber(), BufferGetPage(), BufferIsValid(), CreateFakeRelcacheEntry(), elog, XLogReaderState::EndRecPtr, FirstCommandId, fix_infomask_from_infobits(), xl_heap_lock::flags, FreeFakeRelcacheEntry(), HEAP_KEYS_UPDATED, HEAP_MOVED, HEAP_XMAX_BITS, HEAP_XMAX_IS_LOCKED_ONLY, HeapTupleHeaderClearHotUpdated, HeapTupleHeaderSetCmax, HeapTupleHeaderSetXmax, xl_heap_lock::infobits_set, InvalidBuffer, ItemIdIsNormal, ItemPointerSet(), MarkBufferDirty(), xl_heap_lock::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), PANIC, ReleaseBuffer(), HeapTupleHeaderData::t_ctid, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, UnlockReleaseBuffer(), VISIBILITYMAP_ALL_FROZEN, visibilitymap_clear(), visibilitymap_pin(), XLH_LOCK_ALL_FROZEN_CLEARED, XLogReadBufferForRedo(), XLogRecGetBlockTag(), XLogRecGetData, and xl_heap_lock::xmax.
Referenced by heap_redo().
|
static |
Definition at line 9867 of file heapam.c.
References BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), CreateFakeRelcacheEntry(), elog, XLogReaderState::EndRecPtr, fix_infomask_from_infobits(), xl_heap_lock_updated::flags, FreeFakeRelcacheEntry(), HEAP_KEYS_UPDATED, HEAP_MOVED, HEAP_XMAX_BITS, HeapTupleHeaderSetXmax, xl_heap_lock_updated::infobits_set, InvalidBuffer, ItemIdIsNormal, MarkBufferDirty(), xl_heap_lock_updated::offnum, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageSetLSN(), PANIC, ReleaseBuffer(), HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, UnlockReleaseBuffer(), VISIBILITYMAP_ALL_FROZEN, visibilitymap_clear(), visibilitymap_pin(), XLH_LOCK_ALL_FROZEN_CLEARED, XLogReadBufferForRedo(), XLogRecGetBlockTag(), XLogRecGetData, and xl_heap_lock_updated::xmax.
Referenced by heap2_redo().
|
static |
Definition at line 9341 of file heapam.c.
References generate_unaccent_rules::action, Assert(), BLK_NEEDS_REDO, BufferGetPage(), BufferGetPageSize(), BufferIsValid(), CreateFakeRelcacheEntry(), data, xl_multi_insert_tuple::datalen, elog, XLogReaderState::EndRecPtr, FirstCommandId, FirstOffsetNumber, xl_heap_multi_insert::flags, FreeFakeRelcacheEntry(), HeapTupleHeaderSetCmin, HeapTupleHeaderSetXmin, i, InvalidBuffer, InvalidOffsetNumber, ItemPointerSetBlockNumber(), ItemPointerSetOffsetNumber(), len, MarkBufferDirty(), MaxHeapTupleSize, MemSet, xl_heap_multi_insert::ntuples, xl_heap_multi_insert::offsets, PageAddItem, PageClearAllVisible(), PageGetHeapFreeSpace(), PageGetMaxOffsetNumber(), PageInit(), PageSetAllVisible(), PageSetLSN(), PANIC, ReleaseBuffer(), SHORTALIGN, SizeofHeapTupleHeader, SizeOfMultiInsertTuple, xl_multi_insert_tuple::t_hoff, xl_multi_insert_tuple::t_infomask, xl_multi_insert_tuple::t_infomask2, UnlockReleaseBuffer(), visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XLH_INSERT_ALL_FROZEN_SET, XLH_INSERT_ALL_VISIBLE_CLEARED, XLOG_HEAP_INIT_PAGE, XLogInitBufferForRedo(), XLogReadBufferForRedo(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetData, XLogRecGetInfo, XLogRecGetXid, and XLogRecordPageWithFreeSpace().
Referenced by heap2_redo().
|
static |
Definition at line 8761 of file heapam.c.
References generate_unaccent_rules::action, Assert(), BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), XLogReaderState::EndRecPtr, heap_page_prune_execute(), InHotStandby, xl_heap_prune::isCatalogRel, MarkBufferDirty(), xl_heap_prune::ndead, xl_heap_prune::nredirected, PageGetHeapFreeSpace(), PageSetLSN(), RBM_NORMAL, ResolveRecoveryConflictWithSnapshot(), xl_heap_prune::snapshotConflictHorizon, UnlockReleaseBuffer(), XLogReadBufferForRedoExtended(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetData, and XLogRecordPageWithFreeSpace().
Referenced by heap2_redo().
|
static |
Definition at line 9488 of file heapam.c.
References Assert(), BLK_NEEDS_REDO, BufferGetPage(), BufferGetPageSize(), BufferIsValid(), CreateFakeRelcacheEntry(), data, elog, XLogReaderState::EndRecPtr, FirstCommandId, fix_infomask_from_infobits(), xl_heap_update::flags, FreeFakeRelcacheEntry(), HEAP_KEYS_UPDATED, HEAP_MOVED, HEAP_XMAX_BITS, HeapTupleHeaderClearHotUpdated, HeapTupleHeaderSetCmax, HeapTupleHeaderSetCmin, HeapTupleHeaderSetHotUpdated, HeapTupleHeaderSetXmax, HeapTupleHeaderSetXmin, InvalidBuffer, InvalidOffsetNumber, ItemIdGetLength, ItemIdIsNormal, ItemPointerSet(), len, MarkBufferDirty(), MaxHeapTupleSize, MemSet, xl_heap_update::new_offnum, xl_heap_update::new_xmax, xl_heap_update::old_infobits_set, xl_heap_update::old_offnum, xl_heap_update::old_xmax, PageAddItem, PageClearAllVisible(), PageGetHeapFreeSpace(), PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageInit(), PageSetLSN(), PageSetPrunable, PANIC, ReleaseBuffer(), SizeOfHeapHeader, SizeofHeapTupleHeader, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleHeaderData::t_hoff, HeapTupleHeaderData::t_infomask, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, UnlockReleaseBuffer(), visibilitymap_clear(), visibilitymap_pin(), VISIBILITYMAP_VALID_BITS, XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED, XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED, XLH_UPDATE_PREFIX_FROM_OLD, XLH_UPDATE_SUFFIX_FROM_OLD, XLOG_HEAP_INIT_PAGE, XLogInitBufferForRedo(), XLogReadBufferForRedo(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetBlockTagExtended(), XLogRecGetData, XLogRecGetInfo, XLogRecGetXid, and XLogRecordPageWithFreeSpace().
Referenced by heap_redo().
|
static |
Definition at line 8849 of file heapam.c.
References generate_unaccent_rules::action, Assert(), BLK_NEEDS_REDO, BufferGetPage(), BufferIsValid(), XLogReaderState::EndRecPtr, i, ItemIdHasStorage, ItemIdIsDead, ItemIdSetUnused, MarkBufferDirty(), xl_heap_vacuum::nunused, PageGetHeapFreeSpace(), PageGetItemId(), PageSetLSN(), PageTruncateLinePointerArray(), RBM_NORMAL, UnlockReleaseBuffer(), XLogReadBufferForRedoExtended(), XLogRecGetBlockData(), XLogRecGetBlockTag(), XLogRecGetData, and XLogRecordPageWithFreeSpace().
Referenced by heap2_redo().
|
static |
Definition at line 8924 of file heapam.c.
References generate_unaccent_rules::action, Assert(), BLK_NEEDS_REDO, BLK_RESTORED, BUFFER_LOCK_UNLOCK, BufferGetPage(), BufferIsValid(), CreateFakeRelcacheEntry(), XLogReaderState::EndRecPtr, xl_heap_visible::flags, FreeFakeRelcacheEntry(), InHotStandby, InvalidBuffer, LockBuffer(), MarkBufferDirty(), PageGetFreeSpace(), PageInit(), PageIsNew(), PageSetAllVisible(), PageSetLSN(), RBM_ZERO_ON_ERROR, ReleaseBuffer(), ResolveRecoveryConflictWithSnapshot(), xl_heap_visible::snapshotConflictHorizon, UnlockReleaseBuffer(), visibilitymap_pin(), visibilitymap_set(), VISIBILITYMAP_VALID_BITS, VISIBILITYMAP_XLOG_CATALOG_REL, VISIBILITYMAP_XLOG_VALID_BITS, XLogHintBitIsNeeded, XLogReadBufferForRedo(), XLogReadBufferForRedoExtended(), XLogRecGetBlockTag(), XLogRecGetData, and XLogRecordPageWithFreeSpace().
Referenced by heap2_redo().
void HeapCheckForSerializableConflictOut | ( | bool | visible, |
Relation | relation, | ||
HeapTuple | tuple, | ||
Buffer | buffer, | ||
Snapshot | snapshot | ||
) |
Definition at line 10153 of file heapam.c.
References Assert(), CheckForSerializableConflictOut(), CheckForSerializableConflictOutNeeded(), elog, ERROR, GetTopTransactionIdIfAny(), HEAPTUPLE_DEAD, HEAPTUPLE_DELETE_IN_PROGRESS, HEAPTUPLE_INSERT_IN_PROGRESS, HEAPTUPLE_LIVE, HEAPTUPLE_RECENTLY_DEAD, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleSatisfiesVacuum(), InvalidTransactionId, SubTransGetTopmostTransaction(), HeapTupleData::t_data, TransactionIdEquals, TransactionIdFollowsOrEquals(), TransactionIdIsValid, TransactionIdPrecedes(), and TransactionXmin.
Referenced by heap_fetch(), heap_get_latest_tid(), heap_hot_search_buffer(), heapam_scan_bitmap_next_block(), heapam_scan_sample_next_tuple(), heapgetpage(), and heapgettup().
|
static |
Definition at line 3961 of file heapam.c.
References attlen, bms_add_member(), bms_is_member(), bms_next_member(), DatumGetPointer(), FirstLowInvalidHeapAttributeNumber, heap_attr_equals(), heap_getattr(), RelationGetDescr, TableOidAttributeNumber, TupleDescAttr, and VARATT_IS_EXTERNAL.
Referenced by heap_update().
void heapgetpage | ( | TableScanDesc | sscan, |
BlockNumber | block | ||
) |
Definition at line 373 of file heapam.c.
References Assert(), BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferGetPage(), BufferIsValid(), CHECK_FOR_INTERRUPTS, FirstOffsetNumber, heap_page_prune_opt(), HeapCheckForSerializableConflictOut(), HeapTupleSatisfiesVisibility(), InvalidBuffer, ItemIdGetLength, ItemIdIsNormal, ItemPointerSet(), LockBuffer(), MAIN_FORKNUM, MaxHeapTuplesPerPage, PageGetItem(), PageGetItemId(), PageGetMaxOffsetNumber(), PageIsAllVisible(), RBM_NORMAL, ReadBufferExtended(), RelationGetRelid, ReleaseBuffer(), HeapScanDescData::rs_base, HeapScanDescData::rs_cblock, HeapScanDescData::rs_cbuf, TableScanDescData::rs_flags, HeapScanDescData::rs_ntuples, TableScanDescData::rs_rd, TableScanDescData::rs_snapshot, HeapScanDescData::rs_strategy, HeapScanDescData::rs_vistuples, SO_ALLOW_PAGEMODE, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, HeapTupleData::t_tableOid, and SnapshotData::takenDuringRecovery.
Referenced by heapam_scan_sample_next_block(), heapgettup(), and heapgettup_pagemode().
|
static |
Definition at line 720 of file heapam.c.
References Assert(), BUFFER_LOCK_SHARE, BUFFER_LOCK_UNLOCK, BufferIsValid(), HeapCheckForSerializableConflictOut(), heapgetpage(), heapgettup_advance_block(), heapgettup_continue_page(), heapgettup_initial_block(), heapgettup_start_page(), HeapKeyTest(), HeapTupleSatisfiesVisibility(), InvalidBlockNumber, InvalidBuffer, ItemIdGetLength, ItemIdIsNormal, ItemPointerSet(), sort-test::key, LockBuffer(), PageGetItem(), PageGetItemId(), RelationGetDescr, ReleaseBuffer(), HeapScanDescData::rs_cblock, HeapScanDescData::rs_cbuf, HeapScanDescData::rs_ctup, HeapScanDescData::rs_inited, TableScanDescData::rs_rd, TableScanDescData::rs_snapshot, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, and unlikely.
Referenced by heap_getnext(), heap_getnextslot(), and heap_getnextslot_tidrange().
|
inlinestatic |
Definition at line 629 of file heapam.c.
References InvalidBlockNumber, HeapScanDescData::rs_base, TableScanDescData::rs_flags, HeapScanDescData::rs_nblocks, HeapScanDescData::rs_numblocks, TableScanDescData::rs_parallel, HeapScanDescData::rs_parallelworkerdata, TableScanDescData::rs_rd, HeapScanDescData::rs_startblock, ScanDirectionIsForward, SO_ALLOW_SYNC, ss_report_location(), and table_block_parallelscan_nextpage().
Referenced by heapgettup(), and heapgettup_pagemode().
|
inlinestatic |
Definition at line 583 of file heapam.c.
References Assert(), BufferGetPage(), BufferIsValid(), Min, OffsetNumberNext, OffsetNumberPrev, PageGetMaxOffsetNumber(), HeapScanDescData::rs_cbuf, HeapScanDescData::rs_coffset, HeapScanDescData::rs_inited, and ScanDirectionIsForward.
Referenced by heapgettup().
|
static |
Definition at line 489 of file heapam.c.
References Assert(), InvalidBlockNumber, HeapScanDescData::rs_base, TableScanDescData::rs_flags, HeapScanDescData::rs_inited, HeapScanDescData::rs_nblocks, HeapScanDescData::rs_numblocks, TableScanDescData::rs_parallel, HeapScanDescData::rs_parallelworkerdata, TableScanDescData::rs_rd, HeapScanDescData::rs_startblock, ScanDirectionIsForward, SO_ALLOW_SYNC, table_block_parallelscan_nextpage(), and table_block_parallelscan_startblock_init().
Referenced by heapgettup(), and heapgettup_pagemode().
|
static |
Definition at line 835 of file heapam.c.
References Assert(), BufferGetPage(), BufferIsValid(), heapgetpage(), heapgettup_advance_block(), heapgettup_initial_block(), HeapKeyTest(), InvalidBlockNumber, InvalidBuffer, ItemIdGetLength, ItemIdIsNormal, ItemPointerSet(), sort-test::key, PageGetItem(), PageGetItemId(), RelationGetDescr, ReleaseBuffer(), HeapScanDescData::rs_cblock, HeapScanDescData::rs_cbuf, HeapScanDescData::rs_cindex, HeapScanDescData::rs_ctup, HeapScanDescData::rs_inited, HeapScanDescData::rs_ntuples, TableScanDescData::rs_rd, ScanDirectionIsForward, HeapTupleData::t_data, HeapTupleData::t_len, HeapTupleData::t_self, and unlikely.
Referenced by heap_getnext(), heap_getnextslot(), and heap_getnextslot_tidrange().
|
static |
Definition at line 552 of file heapam.c.
References Assert(), BufferGetPage(), BufferIsValid(), FirstOffsetNumber, PageGetMaxOffsetNumber(), HeapScanDescData::rs_cbuf, HeapScanDescData::rs_inited, and ScanDirectionIsForward.
Referenced by heapgettup().
TransactionId HeapTupleGetUpdateXid | ( | HeapTupleHeader | tuple | ) |
Definition at line 7106 of file heapam.c.
References HeapTupleHeaderGetRawXmax, MultiXactIdGetUpdateXid(), and HeapTupleHeaderData::t_infomask.
Referenced by check_tuple_visibility(), heap_update(), HeapTupleHeaderIsOnlyLocked(), HeapTupleSatisfiesDirty(), HeapTupleSatisfiesHistoricMVCC(), HeapTupleSatisfiesMVCC(), HeapTupleSatisfiesSelf(), HeapTupleSatisfiesUpdate(), and HeapTupleSatisfiesVacuumHorizon().
void HeapTupleHeaderAdvanceConflictHorizon | ( | HeapTupleHeader | tuple, |
TransactionId * | snapshotConflictHorizon | ||
) |
Definition at line 7498 of file heapam.c.
References HEAP_MOVED, HeapTupleHeaderGetUpdateXid, HeapTupleHeaderGetXmin, HeapTupleHeaderGetXvac, HeapTupleHeaderXminCommitted, HeapTupleHeaderXminInvalid, HeapTupleHeaderData::t_infomask, TransactionIdDidCommit(), TransactionIdFollows(), and TransactionIdPrecedes().
Referenced by heap_index_delete_tuples(), and heap_prune_chain().
|
inlinestatic |
Definition at line 7583 of file heapam.c.
References Assert(), ereport, errcode(), errmsg_internal(), ERROR, HeapTupleHeaderIsHeapOnly, TM_IndexDeleteOp::iblknum, TM_IndexStatus::idxoffnum, TM_IndexDeleteOp::irel, ItemIdHasStorage, ItemIdIsNormal, ItemIdIsUsed, ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), OffsetNumberIsValid, PageGetItem(), PageGetItemId(), RelationGetRelationName, and unlikely.
Referenced by heap_index_delete_tuples().
|
static |
Definition at line 7988 of file heapam.c.
References TM_IndexDeleteOp::deltids, i, index_delete_sort_cmp(), j, lengthof, TM_IndexDeleteOp::ndeltids, and StaticAssertDecl.
Referenced by heap_index_delete_tuples().
|
inlinestatic |
Definition at line 7952 of file heapam.c.
References Assert(), ItemPointerGetBlockNumber(), ItemPointerGetOffsetNumber(), and TM_IndexDelete::tid.
Referenced by index_delete_sort().
|
static |
Definition at line 229 of file heapam.c.
References BAS_BULKREAD, FreeAccessStrategy(), GetAccessStrategy(), InvalidBlockNumber, InvalidBuffer, ItemPointerSetInvalid(), sort-test::key, NBuffers, pgstat_count_heap_scan, ParallelBlockTableScanDescData::phs_nblocks, ParallelTableScanDescData::phs_syncscan, RelationGetNumberOfBlocks, RelationUsesLocalBuffers, HeapScanDescData::rs_base, HeapScanDescData::rs_cblock, HeapScanDescData::rs_cbuf, HeapScanDescData::rs_ctup, TableScanDescData::rs_flags, HeapScanDescData::rs_inited, TableScanDescData::rs_key, HeapScanDescData::rs_nblocks, TableScanDescData::rs_nkeys, HeapScanDescData::rs_numblocks, TableScanDescData::rs_parallel, TableScanDescData::rs_rd, HeapScanDescData::rs_startblock, HeapScanDescData::rs_strategy, SO_ALLOW_STRAT, SO_ALLOW_SYNC, SO_TYPE_SEQSCAN, ss_get_location(), synchronize_seqscans, HeapTupleData::t_data, and HeapTupleData::t_self.
Referenced by heap_beginscan(), and heap_rescan().
|
static |
Definition at line 8586 of file heapam.c.
References Assert(), xl_heap_new_cid::cmax, xl_heap_new_cid::cmin, xl_heap_new_cid::combocid, GetTopTransactionId(), HEAP_COMBOCID, HEAP_XMAX_INVALID, HEAP_XMAX_IS_LOCKED_ONLY, HeapTupleHeaderGetCmax(), HeapTupleHeaderGetCmin(), HeapTupleHeaderGetRawCommandId, HeapTupleHeaderXminInvalid, InvalidCommandId, InvalidOid, ItemPointerIsValid(), RelationData::rd_locator, SizeOfHeapNewCid, HeapTupleData::t_data, HeapTupleHeaderData::t_infomask, HeapTupleData::t_self, HeapTupleData::t_tableOid, xl_heap_new_cid::target_locator, xl_heap_new_cid::target_tid, xl_heap_new_cid::top_xid, XLOG_HEAP2_NEW_CID, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by heap_delete(), heap_insert(), heap_multi_insert(), and heap_update().
|
static |
Definition at line 8364 of file heapam.c.
References Assert(), BufferGetPage(), compute_infobits(), FirstOffsetNumber, xl_heap_update::flags, HeapTupleHeaderGetRawXmax, HeapTupleIsHeapOnly, init, ItemPointerGetOffsetNumber(), Min, xl_heap_update::new_offnum, xl_heap_update::new_xmax, xl_heap_update::old_infobits_set, xl_heap_update::old_offnum, xl_heap_update::old_xmax, PageGetMaxOffsetNumber(), RelationData::rd_rel, REGBUF_KEEP_DATA, REGBUF_STANDARD, REGBUF_WILL_INIT, RelationIsLogicallyLogged, RelationNeedsWAL, SizeOfHeapHeader, SizeofHeapTupleHeader, SizeOfHeapUpdate, HeapTupleData::t_data, xl_heap_header::t_hoff, HeapTupleHeaderData::t_hoff, xl_heap_header::t_infomask, HeapTupleHeaderData::t_infomask, xl_heap_header::t_infomask2, HeapTupleHeaderData::t_infomask2, HeapTupleData::t_len, HeapTupleData::t_self, XLH_UPDATE_CONTAINS_NEW_TUPLE, XLH_UPDATE_CONTAINS_OLD_KEY, XLH_UPDATE_CONTAINS_OLD_TUPLE, XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED, XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED, XLH_UPDATE_PREFIX_FROM_OLD, XLH_UPDATE_SUFFIX_FROM_OLD, XLOG_HEAP_HOT_UPDATE, XLOG_HEAP_INIT_PAGE, XLOG_HEAP_UPDATE, XLOG_INCLUDE_ORIGIN, XLogBeginInsert(), XLogCheckBufferNeedsBackup(), XLogInsert(), XLogRegisterBufData(), XLogRegisterBuffer(), XLogRegisterData(), and XLogSetRecordFlags().
Referenced by heap_update().
XLogRecPtr log_heap_visible | ( | Relation | rel, |
Buffer | heap_buffer, | ||
Buffer | vm_buffer, | ||
TransactionId | snapshotConflictHorizon, | ||
uint8 | vmflags | ||
) |
Definition at line 8330 of file heapam.c.
References Assert(), BufferIsValid(), xl_heap_visible::flags, REGBUF_NO_IMAGE, REGBUF_STANDARD, RelationIsAccessibleInLogicalDecoding, SizeOfHeapVisible, xl_heap_visible::snapshotConflictHorizon, VISIBILITYMAP_XLOG_CATALOG_REL, XLOG_HEAP2_VISIBLE, XLogBeginInsert(), XLogHintBitIsNeeded, XLogInsert(), XLogRegisterBuffer(), and XLogRegisterData().
Referenced by visibilitymap_set().
|
static |
Definition at line 7054 of file heapam.c.
References Assert(), GetMultiXactIdMembers(), HEAP_XMAX_IS_MULTI, HEAP_XMAX_LOCK_ONLY, i, InvalidTransactionId, ISUPDATE_from_mxstatus, pfree(), and MultiXactMember::xid.
Referenced by compute_new_xmax_infomask(), FreezeMultiXactId(), and HeapTupleGetUpdateXid().
|
static |
Definition at line 7299 of file heapam.c.
References Do_MultiXactIdWait(), oper(), and remaining.
Referenced by heap_delete(), heap_lock_tuple(), and heap_update().
void ReleaseBulkInsertStatePin | ( | BulkInsertState | bistate | ) |
Definition at line 1786 of file heapam.c.
References BulkInsertStateData::current_buf, InvalidBlockNumber, InvalidBuffer, BulkInsertStateData::last_free, BulkInsertStateData::next_free, and ReleaseBuffer().
Referenced by CopyFrom().
void simple_heap_delete | ( | Relation | relation, |
ItemPointer | tid | ||
) |
Definition at line 2934 of file heapam.c.
References elog, ERROR, GetCurrentCommandId(), heap_delete(), InvalidSnapshot, TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.
Referenced by CatalogTupleDelete(), and toast_delete_datum().
Definition at line 2455 of file heapam.c.
References GetCurrentCommandId(), and heap_insert().
Referenced by CatalogTupleInsert(), CatalogTupleInsertWithInfo(), and InsertOneTuple().
void simple_heap_update | ( | Relation | relation, |
ItemPointer | otid, | ||
HeapTuple | tup, | ||
TU_UpdateIndexes * | update_indexes | ||
) |
Definition at line 4051 of file heapam.c.
References elog, ERROR, GetCurrentCommandId(), heap_update(), InvalidSnapshot, TM_Deleted, TM_Ok, TM_SelfModified, and TM_Updated.
Referenced by CatalogTupleUpdate(), and CatalogTupleUpdateWithInfo().
|
static |
Definition at line 5168 of file heapam.c.
References DoLockModesConflict(), get_mxact_status_for_lock(), ISUPDATE_from_mxstatus, ItemPointerEquals(), LOCKMODE_from_mxstatus, mode, HeapTupleHeaderData::t_ctid, HeapTupleData::t_data, HeapTupleData::t_self, TM_Deleted, TM_Ok, TM_SelfModified, TM_Updated, TransactionIdDidAbort(), TransactionIdDidCommit(), TransactionIdIsCurrentTransactionId(), and TransactionIdIsInProgress().
Referenced by heap_lock_updated_tuple_rec().
|
static |
Definition at line 1735 of file heapam.c.
References Assert(), HEAP_XMAX_COMMITTED, HEAP_XMAX_INVALID, HEAP_XMAX_IS_LOCKED_ONLY, HEAP_XMAX_IS_MULTI, HeapTupleHeaderGetRawXmax, HeapTupleSetHintBits(), InvalidTransactionId, HeapTupleHeaderData::t_infomask, TransactionIdDidCommit(), and TransactionIdEquals.
Referenced by heap_delete(), heap_lock_tuple(), and heap_update().
Definition at line 2490 of file heapam.c.
References HEAP_LOCK_MASK, HEAP_XMAX_IS_MULTI, and HEAP_XMAX_LOCK_ONLY.
Referenced by heap_delete(), heap_lock_tuple(), and heap_update().
|
static |
const { ... } tupleLockExtraInfo[MaxLockTupleMode + 1] |
Referenced by DoesMultiXactIdConflict(), and get_mxact_status_for_lock().