PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/multixact.h"
#include "access/slru.h"
#include "access/transam.h"
#include "access/twophase.h"
#include "access/twophase_rmgr.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "commands/dbcommands.h"
#include "funcapi.h"
#include "lib/ilist.h"
#include "miscadmin.h"
#include "pg_trace.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/fmgrprotos.h"
#include "utils/guc_hooks.h"
#include "utils/injection_point.h"
#include "utils/memutils.h"
Go to the source code of this file.
Data Structures | |
struct | MultiXactStateData |
struct | mXactCacheEnt |
struct | mxtruncinfo |
Typedefs | |
typedef struct MultiXactStateData | MultiXactStateData |
typedef struct mXactCacheEnt | mXactCacheEnt |
typedef struct mxtruncinfo | mxtruncinfo |
Variables | |
static SlruCtlData | MultiXactOffsetCtlData |
static SlruCtlData | MultiXactMemberCtlData |
static MultiXactStateData * | MultiXactState |
static MultiXactId * | OldestMemberMXactId |
static MultiXactId * | OldestVisibleMXactId |
static dclist_head | MXactCache = DCLIST_STATIC_INIT(MXactCache) |
static MemoryContext | MXactContext = NULL |
Definition at line 381 of file multixact.c.
Definition at line 382 of file multixact.c.
Definition at line 383 of file multixact.c.
#define MAX_CACHE_ENTRIES 256 |
Definition at line 370 of file multixact.c.
#define MAX_MEMBERS_IN_LAST_MEMBERS_PAGE ((uint32) ((0xFFFFFFFF % MULTIXACT_MEMBERS_PER_PAGE) + 1)) |
Definition at line 168 of file multixact.c.
#define MaxOldestSlot (MaxBackends + max_prepared_xacts) |
Definition at line 337 of file multixact.c.
#define MULTIXACT_FLAGBYTES_PER_GROUP 4 |
Definition at line 148 of file multixact.c.
#define MULTIXACT_MEMBER_DANGER_THRESHOLD (MaxMultiXactOffset - MaxMultiXactOffset / 4) |
Definition at line 217 of file multixact.c.
#define MULTIXACT_MEMBER_SAFE_THRESHOLD (MaxMultiXactOffset / 2) |
Definition at line 216 of file multixact.c.
#define MULTIXACT_MEMBERGROUP_SIZE (sizeof(TransactionId) * MULTIXACT_MEMBERS_PER_MEMBERGROUP + MULTIXACT_FLAGBYTES_PER_GROUP) |
Definition at line 152 of file multixact.c.
#define MULTIXACT_MEMBERGROUPS_PER_PAGE (BLCKSZ / MULTIXACT_MEMBERGROUP_SIZE) |
Definition at line 154 of file multixact.c.
#define MULTIXACT_MEMBERS_PER_MEMBERGROUP (MULTIXACT_FLAGBYTES_PER_GROUP * MXACT_MEMBER_FLAGS_PER_BYTE) |
Definition at line 149 of file multixact.c.
#define MULTIXACT_MEMBERS_PER_PAGE (MULTIXACT_MEMBERGROUPS_PER_PAGE * MULTIXACT_MEMBERS_PER_MEMBERGROUP) |
Definition at line 155 of file multixact.c.
#define MULTIXACT_OFFSETS_PER_PAGE (BLCKSZ / sizeof(MultiXactOffset)) |
Definition at line 110 of file multixact.c.
#define MultiXactMemberCtl (&MultiXactMemberCtlData) |
Definition at line 233 of file multixact.c.
#define MultiXactOffsetCtl (&MultiXactOffsetCtlData) |
Definition at line 232 of file multixact.c.
#define MXACT_MEMBER_BITS_PER_XACT 8 |
Definition at line 143 of file multixact.c.
#define MXACT_MEMBER_FLAGS_PER_BYTE 1 |
Definition at line 144 of file multixact.c.
#define MXACT_MEMBER_XACT_BITMASK ((1 << MXACT_MEMBER_BITS_PER_XACT) - 1) |
Definition at line 145 of file multixact.c.
#define OFFSET_WARN_SEGMENTS 20 |
#define SHARED_MULTIXACT_STATE_SIZE |
typedef struct MultiXactStateData MultiXactStateData |
typedef struct mXactCacheEnt mXactCacheEnt |
typedef struct mxtruncinfo mxtruncinfo |
void AtEOXact_MultiXact | ( | void | ) |
Definition at line 1808 of file multixact.c.
References dclist_init(), InvalidMultiXactId, MXactCache, MXactContext, MyProcNumber, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by AbortTransaction(), CommitTransaction(), and test_read_multixact().
void AtPrepare_MultiXact | ( | void | ) |
Definition at line 1836 of file multixact.c.
References MultiXactIdIsValid, MyProcNumber, OldestMemberMXactId, RegisterTwoPhaseRecord(), and TWOPHASE_RM_MULTIXACT_ID.
Referenced by PrepareTransaction().
void BootStrapMultiXact | ( | void | ) |
Definition at line 2034 of file multixact.c.
References Assert, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactMemberCtl, MultiXactOffsetCtl, SimpleLruGetBankLock(), SimpleLruWritePage(), ZeroMultiXactMemberPage(), and ZeroMultiXactOffsetPage().
Referenced by BootStrapXLOG().
bool check_multixact_member_buffers | ( | int * | newval, |
void ** | extra, | ||
GucSource | source | ||
) |
Definition at line 2023 of file multixact.c.
References check_slru_buffers(), and newval.
bool check_multixact_offset_buffers | ( | int * | newval, |
void ** | extra, | ||
GucSource | source | ||
) |
Definition at line 2014 of file multixact.c.
References check_slru_buffers(), and newval.
void CheckPointMultiXact | ( | void | ) |
Definition at line 2304 of file multixact.c.
References MultiXactMemberCtl, MultiXactOffsetCtl, and SimpleLruWriteAll().
Referenced by CheckPointGuts().
|
static |
Definition at line 2585 of file multixact.c.
References difference(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_MEMBERS_IN_LAST_MEMBERS_PAGE, MaxMultiXactOffset, MULTIXACT_MEMBERS_PER_PAGE, MultiXactMemberCtl, MXOffsetToFlagsBitShift(), MXOffsetToFlagsOffset(), MXOffsetToMemberPage(), SimpleLruGetBankLock(), and ZeroMultiXactMemberPage().
Referenced by GetNewMultiXactId().
|
static |
Definition at line 2553 of file multixact.c.
References FirstMultiXactId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetEntry(), MultiXactIdToOffsetPage(), MultiXactOffsetCtl, SimpleLruGetBankLock(), and ZeroMultiXactOffsetPage().
Referenced by GetNewMultiXactId().
|
static |
Definition at line 2888 of file multixact.c.
References Assert, MultiXactStateData::finishedStartup, LWLockRelease(), MultiXactIdToOffsetEntry(), MultiXactIdToOffsetPage(), MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactState, SimpleLruDoesPhysicalPageExist(), SimpleLruGetBankLock(), SimpleLruReadPage_ReadOnly(), and SimpleLruWriteAll().
Referenced by SetOffsetVacuumLimit(), and TruncateMultiXact().
int GetMultiXactIdMembers | ( | MultiXactId | multi, |
MultiXactMember ** | members, | ||
bool | from_pgupgrade, | ||
bool | isLockOnly | ||
) |
Definition at line 1299 of file multixact.c.
References Assert, CHECK_FOR_INTERRUPTS, ConditionVariableCancelSleep(), ConditionVariableSleep(), DEBUG2, debug_elog2, debug_elog3, ereport, errcode(), errmsg(), ERROR, FirstMultiXactId, i, if(), INJECTION_POINT, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactIdSetOldestVisible(), MultiXactIdToOffsetEntry(), MultiXactIdToOffsetPage(), MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactState, MXACT_MEMBER_XACT_BITMASK, mXactCacheGetById(), mXactCachePut(), mxid_to_string(), MXOffsetToFlagsBitShift(), MXOffsetToFlagsOffset(), MXOffsetToMemberOffset(), MXOffsetToMemberPage(), MyProcNumber, MultiXactStateData::nextMXact, MultiXactStateData::nextoff_cv, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactId, OldestVisibleMXactId, palloc(), SimpleLruGetBankLock(), SimpleLruReadPage(), MultiXactMember::status, TransactionIdIsValid, and MultiXactMember::xid.
Referenced by Do_MultiXactIdWait(), DoesMultiXactIdConflict(), FreezeMultiXactId(), GetMultiXactIdHintBits(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_tuple_should_freeze(), MultiXactIdExpand(), MultiXactIdGetUpdateXid(), MultiXactIdIsRunning(), pg_get_multixact_members(), pgrowlocks(), and test_read_multixact().
|
static |
Definition at line 1032 of file multixact.c.
References DEBUG2, debug_elog3, debug_elog4, elog, ereport, errcode(), errdetail_plural(), errhint(), errmsg(), errmsg_plural(), ERROR, ExtendMultiXactMember(), ExtendMultiXactOffset(), FirstMultiXactId, get_database_name(), IsUnderPostmaster, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactStateData::multiStopLimit, MultiXactStateData::multiVacLimit, MultiXactStateData::multiWarnLimit, MultiXactStateData::multiWrapLimit, MULTIXACT_MEMBER_SAFE_THRESHOLD, MULTIXACT_MEMBERS_PER_PAGE, MultiXactIdPrecedes(), MultiXactOffsetWouldWrap(), MultiXactState, MXOffsetToMemberPage(), MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, OFFSET_WARN_SEGMENTS, MultiXactStateData::offsetStopLimit, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestOffset, MultiXactStateData::oldestOffsetKnown, PMSIGNAL_START_AUTOVAC_LAUNCHER, RecoveryInProgress(), SendPostmasterSignal(), SLRU_PAGES_PER_SEGMENT, START_CRIT_SECTION, and WARNING.
Referenced by MultiXactIdCreateFromMembers().
MultiXactId GetOldestMultiXactId | ( | void | ) |
Definition at line 2660 of file multixact.c.
References FirstMultiXactId, i, LW_SHARED, LWLockAcquire(), LWLockRelease(), MaxOldestSlot, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactState, MultiXactStateData::nextMXact, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by heapam_relation_set_new_filelocator(), vac_update_datfrozenxid(), and vacuum_get_cutoffs().
|
static |
Definition at line 2118 of file multixact.c.
References LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetPage(), MultiXactOffsetCtl, MultiXactState, MultiXactStateData::nextMXact, SimpleLruDoesPhysicalPageExist(), SimpleLruGetBankLock(), SimpleLruWritePage(), and ZeroMultiXactOffsetPage().
Referenced by MultiXactSetNextMXact().
void multixact_redo | ( | XLogReaderState * | record | ) |
Definition at line 3394 of file multixact.c.
References AdvanceNextFullTransactionIdPastXid(), Assert, DEBUG1, elog, xl_multixact_truncate::endTruncMemb, xl_multixact_truncate::endTruncOff, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), xl_multixact_create::members, xl_multixact_create::mid, xl_multixact_create::moff, MultiXactAdvanceNextMXact(), MultiXactIdToOffsetPage(), MultiXactIdToOffsetSegment(), MultiXactMemberCtl, MultiXactOffsetCtl, MXOffsetToMemberSegment(), xl_multixact_create::nmembers, xl_multixact_truncate::oldestMultiDB, PANIC, PerformMembersTruncation(), PerformOffsetsTruncation(), pg_atomic_write_u64(), RecordNewMultiXact(), SetMultiXactIdLimit(), SimpleLruGetBankLock(), SimpleLruWritePage(), SizeOfMultiXactTruncate, xl_multixact_truncate::startTruncMemb, xl_multixact_truncate::startTruncOff, TransactionIdPrecedes(), MultiXactMember::xid, XLOG_MULTIXACT_CREATE_ID, XLOG_MULTIXACT_TRUNCATE_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE, XLOG_MULTIXACT_ZERO_OFF_PAGE, XLogRecGetData, XLogRecGetInfo, XLogRecGetXid, XLogRecHasAnyBlockRefs, XLR_INFO_MASK, ZeroMultiXactMemberPage(), and ZeroMultiXactOffsetPage().
void multixact_twophase_postabort | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 1935 of file multixact.c.
References len, and multixact_twophase_postcommit().
void multixact_twophase_postcommit | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 1920 of file multixact.c.
References Assert, InvalidMultiXactId, len, OldestMemberMXactId, and TwoPhaseGetDummyProcNumber().
Referenced by multixact_twophase_postabort().
void multixact_twophase_recover | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 1899 of file multixact.c.
References Assert, len, OldestMemberMXactId, and TwoPhaseGetDummyProcNumber().
void MultiXactAdvanceNextMXact | ( | MultiXactId | minMulti, |
MultiXactOffset | minMultiOffset | ||
) |
Definition at line 2511 of file multixact.c.
References DEBUG2, debug_elog3, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdPrecedes(), MultiXactOffsetPrecedes(), MultiXactState, MultiXactStateData::nextMXact, and MultiXactStateData::nextOffset.
Referenced by multixact_redo(), and xlog_redo().
void MultiXactAdvanceOldest | ( | MultiXactId | oldestMulti, |
Oid | oldestMultiDB | ||
) |
Definition at line 2536 of file multixact.c.
References Assert, InRecovery, MultiXactIdPrecedes(), MultiXactState, MultiXactStateData::oldestMultiXactId, and SetMultiXactIdLimit().
Referenced by xlog_redo().
void MultiXactGetCheckptMulti | ( | bool | is_shutdown, |
MultiXactId * | nextMulti, | ||
MultiXactOffset * | nextMultiOffset, | ||
MultiXactId * | oldestMulti, | ||
Oid * | oldestMultiDB | ||
) |
Definition at line 2282 of file multixact.c.
References DEBUG2, debug_elog6, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactState, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactDB, and MultiXactStateData::oldestMultiXactId.
Referenced by CreateCheckPoint().
MultiXactId MultiXactIdCreate | ( | TransactionId | xid1, |
MultiXactStatus | status1, | ||
TransactionId | xid2, | ||
MultiXactStatus | status2 | ||
) |
Definition at line 434 of file multixact.c.
References Assert, DEBUG2, debug_elog3, MultiXactIdCreateFromMembers(), MultiXactIdIsValid, mxid_to_string(), MyProcNumber, OldestMemberMXactId, MultiXactMember::status, TransactionIdEquals, TransactionIdIsValid, and MultiXactMember::xid.
Referenced by compute_new_xmax_infomask(), and test_create_multixact().
MultiXactId MultiXactIdCreateFromMembers | ( | int | nmembers, |
MultiXactMember * | members | ||
) |
Definition at line 815 of file multixact.c.
References DEBUG2, debug_elog2, debug_elog3, elog, END_CRIT_SECTION, ERROR, GetNewMultiXactId(), i, INJECTION_POINT_CACHED, INJECTION_POINT_LOAD, InvalidMultiXactId, ISUPDATE_from_mxstatus, xl_multixact_create::mid, xl_multixact_create::moff, MultiXactIdIsValid, mXactCacheGetBySet(), mXactCachePut(), mxid_to_string(), xl_multixact_create::nmembers, RecordNewMultiXact(), SizeOfMultiXactCreate, XLOG_MULTIXACT_CREATE_ID, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by FreezeMultiXactId(), MultiXactIdCreate(), and MultiXactIdExpand().
MultiXactId MultiXactIdExpand | ( | MultiXactId | multi, |
TransactionId | xid, | ||
MultiXactStatus | status | ||
) |
Definition at line 487 of file multixact.c.
References Assert, DEBUG2, debug_elog3, debug_elog4, debug_elog5, GetMultiXactIdMembers(), i, ISUPDATE_from_mxstatus, j, MultiXactIdCreateFromMembers(), MultiXactIdIsValid, mxstatus_to_string(), MyProcNumber, OldestMemberMXactId, palloc(), pfree(), MultiXactMember::status, TransactionIdDidCommit(), TransactionIdEquals, TransactionIdIsInProgress(), TransactionIdIsValid, and MultiXactMember::xid.
Referenced by compute_new_xmax_infomask().
bool MultiXactIdIsRunning | ( | MultiXactId | multi, |
bool | isLockOnly | ||
) |
Definition at line 599 of file multixact.c.
References DEBUG2, debug_elog2, debug_elog3, debug_elog4, GetMultiXactIdMembers(), i, pfree(), TransactionIdIsCurrentTransactionId(), and TransactionIdIsInProgress().
Referenced by compute_new_xmax_infomask(), FreezeMultiXactId(), HeapTupleSatisfiesUpdate(), and HeapTupleSatisfiesVacuumHorizon().
bool MultiXactIdPrecedes | ( | MultiXactId | multi1, |
MultiXactId | multi2 | ||
) |
Definition at line 3317 of file multixact.c.
Referenced by check_mxid_in_range(), copy_table_data(), do_start_worker(), FreezeMultiXactId(), GetMultiXactIdMembers(), GetNewMultiXactId(), GetOldestMultiXactId(), heap_prepare_freeze_tuple(), heap_tuple_should_freeze(), MultiXactAdvanceNextMXact(), MultiXactAdvanceOldest(), MultiXactIdSetOldestVisible(), MultiXactOffsetPagePrecedes(), relation_needs_vacanalyze(), SetMultiXactIdLimit(), TruncateMultiXact(), vac_truncate_clog(), vac_update_datfrozenxid(), vac_update_relstats(), vacuum_get_cutoffs(), and vacuum_xid_failsafe_check().
bool MultiXactIdPrecedesOrEquals | ( | MultiXactId | multi1, |
MultiXactId | multi2 | ||
) |
Definition at line 3331 of file multixact.c.
Referenced by check_mxid_in_range(), heap_tuple_should_freeze(), heap_vacuum_rel(), TruncateMultiXact(), and vacuum_get_cutoffs().
void MultiXactIdSetOldestMember | ( | void | ) |
Definition at line 673 of file multixact.c.
References DEBUG2, debug_elog4, FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MultiXactState, MyProcNumber, MultiXactStateData::nextMXact, and OldestMemberMXactId.
Referenced by heap_delete(), heap_lock_tuple(), heap_lock_updated_tuple(), heap_update(), and test_create_multixact().
|
static |
Definition at line 730 of file multixact.c.
References DEBUG2, debug_elog4, FirstMultiXactId, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxOldestSlot, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactState, MyProcNumber, MultiXactStateData::nextMXact, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by GetMultiXactIdMembers().
|
inlinestatic |
Definition at line 119 of file multixact.c.
References MULTIXACT_OFFSETS_PER_PAGE.
Referenced by ExtendMultiXactOffset(), find_multixact_start(), GetMultiXactIdMembers(), RecordNewMultiXact(), and TrimMultiXact().
|
inlinestatic |
Definition at line 113 of file multixact.c.
References MULTIXACT_OFFSETS_PER_PAGE.
Referenced by ExtendMultiXactOffset(), find_multixact_start(), GetMultiXactIdMembers(), MaybeExtendOffsetSlru(), multixact_redo(), MultiXactIdToOffsetSegment(), PerformOffsetsTruncation(), RecordNewMultiXact(), StartupMultiXact(), and TrimMultiXact().
|
inlinestatic |
Definition at line 125 of file multixact.c.
References MultiXactIdToOffsetPage(), and SLRU_PAGES_PER_SEGMENT.
Referenced by multixact_redo(), and TruncateMultiXact().
int MultiXactMemberFreezeThreshold | ( | void | ) |
Definition at line 2978 of file multixact.c.
References autovacuum_multixact_freeze_max_age, Min, MULTIXACT_MEMBER_DANGER_THRESHOLD, MULTIXACT_MEMBER_SAFE_THRESHOLD, and ReadMultiXactCounts().
Referenced by do_autovacuum(), do_start_worker(), and vacuum_get_cutoffs().
Definition at line 3297 of file multixact.c.
References MULTIXACT_MEMBERS_PER_PAGE, and MultiXactOffsetPrecedes().
Referenced by MultiXactShmemInit().
int multixactmemberssyncfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 3584 of file multixact.c.
References MultiXactMemberCtl, and SlruSyncFileTag().
Definition at line 3277 of file multixact.c.
References FirstMultiXactId, MULTIXACT_OFFSETS_PER_PAGE, and MultiXactIdPrecedes().
Referenced by MultiXactShmemInit().
|
static |
Definition at line 3343 of file multixact.c.
Referenced by MultiXactAdvanceNextMXact(), and MultiXactMemberPagePrecedes().
int multixactoffsetssyncfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 3575 of file multixact.c.
References MultiXactOffsetCtl, and SlruSyncFileTag().
|
static |
void MultiXactSetNextMXact | ( | MultiXactId | nextMulti, |
MultiXactOffset | nextMultiOffset | ||
) |
Definition at line 2328 of file multixact.c.
References DEBUG2, debug_elog4, IsBinaryUpgrade, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaybeExtendOffsetSlru(), MultiXactState, MultiXactStateData::nextMXact, and MultiXactStateData::nextOffset.
Referenced by BootStrapXLOG(), StartupXLOG(), and xlog_redo().
void MultiXactShmemInit | ( | void | ) |
Definition at line 1964 of file multixact.c.
References Assert, ConditionVariableInit(), DEBUG2, debug_elog2, IsUnderPostmaster, LWTRANCHE_MULTIXACTMEMBER_BUFFER, LWTRANCHE_MULTIXACTMEMBER_SLRU, LWTRANCHE_MULTIXACTOFFSET_BUFFER, LWTRANCHE_MULTIXACTOFFSET_SLRU, MaxOldestSlot, MemSet, multixact_member_buffers, multixact_offset_buffers, MULTIXACT_OFFSETS_PER_PAGE, MultiXactMemberCtl, MultiXactMemberPagePrecedes(), MultiXactOffsetCtl, MultiXactOffsetPagePrecedes(), MultiXactState, MultiXactStateData::nextoff_cv, OldestMemberMXactId, OldestVisibleMXactId, MultiXactStateData::perBackendXactIds, SHARED_MULTIXACT_STATE_SIZE, ShmemInitStruct(), SimpleLruInit(), SlruPagePrecedesUnitTests, SYNC_HANDLER_MULTIXACT_MEMBER, and SYNC_HANDLER_MULTIXACT_OFFSET.
Referenced by CreateOrAttachShmemStructs().
Size MultiXactShmemSize | ( | void | ) |
Definition at line 1947 of file multixact.c.
References add_size(), multixact_member_buffers, multixact_offset_buffers, SHARED_MULTIXACT_STATE_SIZE, SimpleLruShmemSize(), and size.
Referenced by CalculateShmemSize().
|
static |
Definition at line 1662 of file multixact.c.
References dlist_iter::cur, dclist_container, dclist_foreach, dclist_move_head(), DEBUG2, debug_elog2, debug_elog3, mXactCacheEnt::members, mXactCacheEnt::multi, MXactCache, mxid_to_string(), mXactCacheEnt::nmembers, palloc(), and size.
Referenced by GetMultiXactIdMembers().
|
static |
Definition at line 1619 of file multixact.c.
References dlist_iter::cur, dclist_container, dclist_foreach, dclist_move_head(), DEBUG2, debug_elog2, debug_elog3, InvalidMultiXactId, mXactCacheEnt::members, mXactCacheEnt::multi, MXactCache, mxactMemberComparator(), mxid_to_string(), mXactCacheEnt::nmembers, and qsort.
Referenced by MultiXactIdCreateFromMembers().
|
static |
Definition at line 1709 of file multixact.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, dclist_container, dclist_count(), dclist_delete_from(), dclist_push_head(), dclist_tail_node(), DEBUG2, debug_elog2, debug_elog3, MAX_CACHE_ENTRIES, mXactCacheEnt::members, MemoryContextAlloc(), mXactCacheEnt::multi, MXactCache, MXactContext, mxactMemberComparator(), mxid_to_string(), mXactCacheEnt::nmembers, mXactCacheEnt::node, pfree(), qsort, and TopTransactionContext.
Referenced by GetMultiXactIdMembers(), and MultiXactIdCreateFromMembers().
|
static |
Definition at line 1589 of file multixact.c.
References MultiXactMember::status, and MultiXactMember::xid.
Referenced by mXactCacheGetBySet(), and mXactCachePut().
char* mxid_to_string | ( | MultiXactId | multi, |
int | nmembers, | ||
MultiXactMember * | members | ||
) |
Definition at line 1777 of file multixact.c.
References appendStringInfo(), appendStringInfoChar(), buf, i, initStringInfo(), MemoryContextStrdup(), mxstatus_to_string(), pfree(), str, and TopMemoryContext.
Referenced by GetMultiXactIdMembers(), MultiXactIdCreate(), MultiXactIdCreateFromMembers(), mXactCacheGetById(), mXactCacheGetBySet(), and mXactCachePut().
|
inlinestatic |
Definition at line 196 of file multixact.c.
References MULTIXACT_MEMBERS_PER_MEMBERGROUP, and MXACT_MEMBER_BITS_PER_XACT.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), and RecordNewMultiXact().
|
inlinestatic |
Definition at line 186 of file multixact.c.
References MULTIXACT_MEMBERGROUP_SIZE, MULTIXACT_MEMBERGROUPS_PER_PAGE, and MULTIXACT_MEMBERS_PER_MEMBERGROUP.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), MXOffsetToMemberOffset(), RecordNewMultiXact(), and TrimMultiXact().
|
inlinestatic |
Definition at line 206 of file multixact.c.
References MULTIXACT_FLAGBYTES_PER_GROUP, MULTIXACT_MEMBERS_PER_MEMBERGROUP, and MXOffsetToFlagsOffset().
Referenced by GetMultiXactIdMembers(), RecordNewMultiXact(), and TrimMultiXact().
|
inlinestatic |
Definition at line 173 of file multixact.c.
References MULTIXACT_MEMBERS_PER_PAGE.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), GetNewMultiXactId(), MXOffsetToMemberSegment(), RecordNewMultiXact(), StartupMultiXact(), and TrimMultiXact().
|
inlinestatic |
Definition at line 179 of file multixact.c.
References MXOffsetToMemberPage(), and SLRU_PAGES_PER_SEGMENT.
Referenced by multixact_redo(), PerformMembersTruncation(), and TruncateMultiXact().
|
static |
Definition at line 1754 of file multixact.c.
References elog, ERROR, MultiXactStatusForKeyShare, MultiXactStatusForNoKeyUpdate, MultiXactStatusForShare, MultiXactStatusForUpdate, MultiXactStatusNoKeyUpdate, and MultiXactStatusUpdate.
Referenced by MultiXactIdExpand(), mxid_to_string(), and pg_get_multixact_members().
|
static |
Definition at line 3048 of file multixact.c.
References DEBUG2, elog, MaxMultiXactOffset, MultiXactMemberCtl, MXOffsetToMemberSegment(), and SlruDeleteSegment().
Referenced by multixact_redo(), and TruncateMultiXact().
|
static |
Definition at line 3077 of file multixact.c.
References MultiXactIdToOffsetPage(), MultiXactOffsetCtl, PreviousMultiXactId(), and SimpleLruTruncate().
Referenced by multixact_redo(), and TruncateMultiXact().
Datum pg_get_multixact_members | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3510 of file multixact.c.
References FuncCallContext::attinmeta, BuildTupleFromCStrings(), elog, ereport, errcode(), errmsg(), ERROR, FirstMultiXactId, get_call_result_type(), GetMultiXactIdMembers(), HeapTupleGetDatum(), MemoryContextSwitchTo(), FuncCallContext::multi_call_memory_ctx, mxstatus_to_string(), palloc(), pfree(), PG_GETARG_TRANSACTIONID, psprintf(), SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, FuncCallContext::tuple_desc, TupleDescGetAttInMetadata(), TYPEFUNC_COMPOSITE, FuncCallContext::user_fctx, values, and while().
void PostPrepare_MultiXact | ( | TransactionId | xid | ) |
Definition at line 1850 of file multixact.c.
References dclist_init(), InvalidMultiXactId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MXactCache, MXactContext, MyProcNumber, OldestMemberMXactId, OldestVisibleMXactId, and TwoPhaseGetDummyProcNumber().
Referenced by PrepareTransaction().
|
inlinestatic |
Definition at line 221 of file multixact.c.
References FirstMultiXactId, and MaxMultiXactId.
Referenced by PerformOffsetsTruncation().
|
static |
Definition at line 2926 of file multixact.c.
References LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactState, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactId, MultiXactStateData::oldestOffset, and MultiXactStateData::oldestOffsetKnown.
Referenced by MultiXactMemberFreezeThreshold().
void ReadMultiXactIdRange | ( | MultiXactId * | oldest, |
MultiXactId * | next | ||
) |
Definition at line 791 of file multixact.c.
References FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactState, next, MultiXactStateData::nextMXact, and MultiXactStateData::oldestMultiXactId.
Referenced by update_cached_mxid_range().
MultiXactId ReadNextMultiXactId | ( | void | ) |
Definition at line 771 of file multixact.c.
References FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactState, and MultiXactStateData::nextMXact.
Referenced by ATRewriteTables(), AutoVacWorkerMain(), do_start_worker(), mxid_age(), refresh_by_heap_swap(), vac_update_datfrozenxid(), vac_update_relstats(), vacuum_get_cutoffs(), and vacuum_xid_failsafe_check().
|
static |
Definition at line 916 of file multixact.c.
References Assert, ConditionVariableBroadcast(), i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetEntry(), MultiXactIdToOffsetPage(), MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactState, MultiXactStatusUpdate, MXACT_MEMBER_BITS_PER_XACT, MXOffsetToFlagsBitShift(), MXOffsetToFlagsOffset(), MXOffsetToMemberOffset(), MXOffsetToMemberPage(), MultiXactStateData::nextoff_cv, SimpleLruGetBankLock(), SimpleLruReadPage(), MultiXactMember::status, and MultiXactMember::xid.
Referenced by multixact_redo(), and MultiXactIdCreateFromMembers().
void SetMultiXactIdLimit | ( | MultiXactId | oldest_datminmxid, |
Oid | oldest_datoid, | ||
bool | is_startup | ||
) |
Definition at line 2362 of file multixact.c.
References Assert, autovacuum_multixact_freeze_max_age, DEBUG1, ereport, errhint(), errmsg_internal(), errmsg_plural(), MultiXactStateData::finishedStartup, FirstMultiXactId, get_database_name(), InRecovery, IsTransactionState(), IsUnderPostmaster, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxMultiXactId, MultiXactStateData::multiStopLimit, MultiXactStateData::multiVacLimit, MultiXactStateData::multiWarnLimit, MultiXactStateData::multiWrapLimit, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactState, MultiXactStateData::nextMXact, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestMultiXactId, PMSIGNAL_START_AUTOVAC_LAUNCHER, SendPostmasterSignal(), SetOffsetVacuumLimit(), and WARNING.
Referenced by BootStrapXLOG(), multixact_redo(), MultiXactAdvanceOldest(), StartupXLOG(), TrimMultiXact(), and vac_truncate_clog().
|
static |
Definition at line 2713 of file multixact.c.
References Assert, DEBUG1, ereport, errmsg(), errmsg_internal(), find_multixact_start(), MultiXactStateData::finishedStartup, LOG, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MULTIXACT_MEMBER_SAFE_THRESHOLD, MULTIXACT_MEMBERS_PER_PAGE, MultiXactState, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::offsetStopLimit, MultiXactStateData::oldestMultiXactId, MultiXactStateData::oldestOffset, MultiXactStateData::oldestOffsetKnown, and SLRU_PAGES_PER_SEGMENT.
Referenced by SetMultiXactIdLimit().
|
static |
Definition at line 3025 of file multixact.c.
References ctl, data, and mxtruncinfo::earliestExistingPage.
Referenced by TruncateMultiXact().
void StartupMultiXact | ( | void | ) |
Definition at line 2153 of file multixact.c.
References MultiXactIdToOffsetPage(), MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactState, MXOffsetToMemberPage(), MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, and pg_atomic_write_u64().
Referenced by StartupXLOG().
void TrimMultiXact | ( | void | ) |
Definition at line 2178 of file multixact.c.
References MultiXactStateData::finishedStartup, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemSet, MultiXactIdToOffsetEntry(), MultiXactIdToOffsetPage(), MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactState, MXOffsetToFlagsOffset(), MXOffsetToMemberOffset(), MXOffsetToMemberPage(), MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestMultiXactId, pg_atomic_write_u64(), SetMultiXactIdLimit(), SimpleLruGetBankLock(), and SimpleLruReadPage().
Referenced by StartupXLOG().
void TruncateMultiXact | ( | MultiXactId | newOldestMulti, |
Oid | newOldestMultiDB | ||
) |
Definition at line 3102 of file multixact.c.
References Assert, DEBUG1, DELAY_CHKPT_START, PGPROC::delayChkptFlags, mxtruncinfo::earliestExistingPage, elog, END_CRIT_SECTION, ereport, errmsg(), find_multixact_start(), MultiXactStateData::finishedStartup, FirstMultiXactId, LOG, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MULTIXACT_OFFSETS_PER_PAGE, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactIdPrecedesOrEquals(), MultiXactIdToOffsetSegment(), MultiXactOffsetCtl, MultiXactState, MXOffsetToMemberSegment(), MyProc, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestMultiXactId, PerformMembersTruncation(), PerformOffsetsTruncation(), RecoveryInProgress(), SlruScanDirCbFindEarliest(), SlruScanDirectory(), START_CRIT_SECTION, and WriteMTruncateXlogRec().
Referenced by vac_truncate_clog().
|
static |
Definition at line 3369 of file multixact.c.
References xl_multixact_truncate::endTruncMemb, xl_multixact_truncate::endTruncOff, xl_multixact_truncate::oldestMultiDB, SizeOfMultiXactTruncate, xl_multixact_truncate::startTruncMemb, xl_multixact_truncate::startTruncOff, XLOG_MULTIXACT_TRUNCATE_ID, XLogBeginInsert(), XLogFlush(), XLogInsert(), and XLogRegisterData().
Referenced by TruncateMultiXact().
Definition at line 3355 of file multixact.c.
References XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by ZeroMultiXactMemberPage(), and ZeroMultiXactOffsetPage().
|
static |
Definition at line 2090 of file multixact.c.
References MultiXactMemberCtl, SimpleLruZeroPage(), WriteMZeroPageXlogRec(), and XLOG_MULTIXACT_ZERO_MEM_PAGE.
Referenced by BootStrapMultiXact(), ExtendMultiXactMember(), and multixact_redo().
|
static |
Definition at line 2074 of file multixact.c.
References MultiXactOffsetCtl, SimpleLruZeroPage(), WriteMZeroPageXlogRec(), and XLOG_MULTIXACT_ZERO_OFF_PAGE.
Referenced by BootStrapMultiXact(), ExtendMultiXactOffset(), MaybeExtendOffsetSlru(), and multixact_redo().
|
static |
Definition at line 230 of file multixact.c.
|
static |
Definition at line 229 of file multixact.c.
|
static |
Definition at line 340 of file multixact.c.
Referenced by find_multixact_start(), GetMultiXactIdMembers(), GetNewMultiXactId(), GetOldestMultiXactId(), MaybeExtendOffsetSlru(), MultiXactAdvanceNextMXact(), MultiXactAdvanceOldest(), MultiXactGetCheckptMulti(), MultiXactIdSetOldestMember(), MultiXactIdSetOldestVisible(), MultiXactSetNextMXact(), MultiXactShmemInit(), ReadMultiXactCounts(), ReadMultiXactIdRange(), ReadNextMultiXactId(), RecordNewMultiXact(), SetMultiXactIdLimit(), SetOffsetVacuumLimit(), StartupMultiXact(), TrimMultiXact(), and TruncateMultiXact().
|
static |
Definition at line 371 of file multixact.c.
Referenced by AtEOXact_MultiXact(), mXactCacheGetById(), mXactCacheGetBySet(), mXactCachePut(), and PostPrepare_MultiXact().
|
static |
Definition at line 372 of file multixact.c.
Referenced by AtEOXact_MultiXact(), mXactCachePut(), and PostPrepare_MultiXact().
|
static |
Definition at line 341 of file multixact.c.
Referenced by AtEOXact_MultiXact(), AtPrepare_MultiXact(), GetOldestMultiXactId(), multixact_twophase_postcommit(), multixact_twophase_recover(), MultiXactIdCreate(), MultiXactIdExpand(), MultiXactIdSetOldestMember(), MultiXactIdSetOldestVisible(), MultiXactShmemInit(), and PostPrepare_MultiXact().
|
static |
Definition at line 342 of file multixact.c.
Referenced by AtEOXact_MultiXact(), GetMultiXactIdMembers(), GetOldestMultiXactId(), MultiXactIdSetOldestVisible(), MultiXactShmemInit(), and PostPrepare_MultiXact().