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 "catalog/pg_type.h"
#include "commands/dbcommands.h"
#include "funcapi.h"
#include "lib/ilist.h"
#include "miscadmin.h"
#include "pg_trace.h"
#include "postmaster/autovacuum.h"
#include "storage/lmgr.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/snapmgr.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 dlist_head | MXactCache = DLIST_STATIC_INIT(MXactCache) |
static int | MXactCacheMembers = 0 |
static MemoryContext | MXactContext = NULL |
#define debug_elog2 | ( | a, | |
b | |||
) |
Definition at line 333 of file multixact.c.
Referenced by GetMultiXactIdMembers(), MultiXactIdCreateFromMembers(), MultiXactIdIsRunning(), MultiXactShmemInit(), mXactCacheGetById(), mXactCacheGetBySet(), and mXactCachePut().
#define debug_elog3 | ( | a, | |
b, | |||
c | |||
) |
Definition at line 334 of file multixact.c.
Referenced by GetMultiXactIdMembers(), GetNewMultiXactId(), MultiXactAdvanceNextMXact(), MultiXactIdCreate(), MultiXactIdCreateFromMembers(), MultiXactIdExpand(), MultiXactIdIsRunning(), mXactCacheGetById(), mXactCacheGetBySet(), and mXactCachePut().
#define debug_elog4 | ( | a, | |
b, | |||
c, | |||
d | |||
) |
Definition at line 335 of file multixact.c.
Referenced by GetNewMultiXactId(), MultiXactIdExpand(), MultiXactIdIsRunning(), MultiXactIdSetOldestMember(), MultiXactIdSetOldestVisible(), and MultiXactSetNextMXact().
Definition at line 336 of file multixact.c.
Referenced by MultiXactIdExpand().
Definition at line 337 of file multixact.c.
Referenced by MultiXactGetCheckptMulti().
#define MAX_CACHE_ENTRIES 256 |
Definition at line 321 of file multixact.c.
Referenced by mXactCachePut().
#define MAX_MEMBERS_IN_LAST_MEMBERS_PAGE ((uint32) ((0xFFFFFFFF % MULTIXACT_MEMBERS_PER_PAGE) + 1)) |
Definition at line 155 of file multixact.c.
Referenced by ExtendMultiXactMember().
#define MaxOldestSlot (MaxBackends + max_prepared_xacts) |
Definition at line 288 of file multixact.c.
Referenced by GetOldestMultiXactId(), MultiXactIdSetOldestVisible(), and MultiXactShmemInit().
#define MULTIXACT_FLAGBYTES_PER_GROUP 4 |
Definition at line 135 of file multixact.c.
#define MULTIXACT_MEMBER_DANGER_THRESHOLD (MaxMultiXactOffset - MaxMultiXactOffset / 4) |
Definition at line 178 of file multixact.c.
Referenced by MultiXactMemberFreezeThreshold().
#define MULTIXACT_MEMBER_SAFE_THRESHOLD (MaxMultiXactOffset / 2) |
Definition at line 177 of file multixact.c.
Referenced by GetNewMultiXactId(), MultiXactMemberFreezeThreshold(), and SetOffsetVacuumLimit().
#define MULTIXACT_MEMBERGROUP_SIZE (sizeof(TransactionId) * MULTIXACT_MEMBERS_PER_MEMBERGROUP + MULTIXACT_FLAGBYTES_PER_GROUP) |
Definition at line 139 of file multixact.c.
#define MULTIXACT_MEMBERGROUPS_PER_PAGE (BLCKSZ / MULTIXACT_MEMBERGROUP_SIZE) |
Definition at line 141 of file multixact.c.
#define MULTIXACT_MEMBERS_PER_MEMBERGROUP (MULTIXACT_FLAGBYTES_PER_GROUP * MXACT_MEMBER_FLAGS_PER_BYTE) |
Definition at line 136 of file multixact.c.
#define MULTIXACT_MEMBERS_PER_PAGE (MULTIXACT_MEMBERGROUPS_PER_PAGE * MULTIXACT_MEMBERS_PER_MEMBERGROUP) |
Definition at line 142 of file multixact.c.
Referenced by ExtendMultiXactMember(), GetNewMultiXactId(), MultiXactMemberPagePrecedes(), and SetOffsetVacuumLimit().
#define MULTIXACT_OFFSETS_PER_PAGE (BLCKSZ / sizeof(MultiXactOffset)) |
Definition at line 109 of file multixact.c.
Referenced by MultiXactOffsetPagePrecedes(), MultiXactShmemInit(), and TruncateMultiXact().
#define MultiXactIdToOffsetEntry | ( | xid | ) | ((xid) % (MultiXactOffset) MULTIXACT_OFFSETS_PER_PAGE) |
Definition at line 113 of file multixact.c.
Referenced by ExtendMultiXactOffset(), find_multixact_start(), GetMultiXactIdMembers(), RecordNewMultiXact(), and TrimMultiXact().
#define MultiXactIdToOffsetPage | ( | xid | ) | ((xid) / (MultiXactOffset) MULTIXACT_OFFSETS_PER_PAGE) |
Definition at line 111 of file multixact.c.
Referenced by ExtendMultiXactOffset(), find_multixact_start(), GetMultiXactIdMembers(), MaybeExtendOffsetSlru(), multixact_redo(), PerformOffsetsTruncation(), RecordNewMultiXact(), StartupMultiXact(), and TrimMultiXact().
#define MultiXactIdToOffsetSegment | ( | xid | ) | (MultiXactIdToOffsetPage(xid) / SLRU_PAGES_PER_SEGMENT) |
Definition at line 115 of file multixact.c.
Referenced by multixact_redo(), and TruncateMultiXact().
#define MultiXactMemberCtl (&MultiXactMemberCtlData) |
Definition at line 191 of file multixact.c.
Referenced by BootStrapMultiXact(), CheckPointMultiXact(), find_multixact_start(), GetMultiXactIdMembers(), multixact_redo(), multixactmemberssyncfiletag(), MultiXactShmemInit(), PerformMembersTruncation(), RecordNewMultiXact(), StartupMultiXact(), TrimMultiXact(), and ZeroMultiXactMemberPage().
#define MultiXactOffsetCtl (&MultiXactOffsetCtlData) |
Definition at line 190 of file multixact.c.
Referenced by BootStrapMultiXact(), CheckPointMultiXact(), find_multixact_start(), GetMultiXactIdMembers(), MaybeExtendOffsetSlru(), multixact_redo(), multixactoffsetssyncfiletag(), MultiXactShmemInit(), PerformOffsetsTruncation(), RecordNewMultiXact(), StartupMultiXact(), TrimMultiXact(), TruncateMultiXact(), and ZeroMultiXactOffsetPage().
#define MXACT_MEMBER_BITS_PER_XACT 8 |
Definition at line 130 of file multixact.c.
Referenced by RecordNewMultiXact().
#define MXACT_MEMBER_FLAGS_PER_BYTE 1 |
Definition at line 131 of file multixact.c.
#define MXACT_MEMBER_XACT_BITMASK ((1 << MXACT_MEMBER_BITS_PER_XACT) - 1) |
Definition at line 132 of file multixact.c.
Referenced by GetMultiXactIdMembers().
#define MXOffsetToFlagsBitShift | ( | xid | ) |
Definition at line 167 of file multixact.c.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), and RecordNewMultiXact().
#define MXOffsetToFlagsOffset | ( | xid | ) |
Definition at line 163 of file multixact.c.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), RecordNewMultiXact(), and TrimMultiXact().
#define MXOffsetToMemberOffset | ( | xid | ) |
Definition at line 172 of file multixact.c.
Referenced by GetMultiXactIdMembers(), RecordNewMultiXact(), and TrimMultiXact().
#define MXOffsetToMemberPage | ( | xid | ) | ((xid) / (TransactionId) MULTIXACT_MEMBERS_PER_PAGE) |
Definition at line 159 of file multixact.c.
Referenced by ExtendMultiXactMember(), GetMultiXactIdMembers(), GetNewMultiXactId(), RecordNewMultiXact(), StartupMultiXact(), and TrimMultiXact().
#define MXOffsetToMemberSegment | ( | xid | ) | (MXOffsetToMemberPage(xid) / SLRU_PAGES_PER_SEGMENT) |
Definition at line 160 of file multixact.c.
Referenced by multixact_redo(), PerformMembersTruncation(), and TruncateMultiXact().
#define OFFSET_WARN_SEGMENTS 20 |
Referenced by GetNewMultiXactId().
#define PreviousMultiXactId | ( | xid | ) | ((xid) == FirstMultiXactId ? MaxMultiXactId : (xid) - 1) |
Definition at line 181 of file multixact.c.
Referenced by PerformOffsetsTruncation().
#define SHARED_MULTIXACT_STATE_SIZE |
Referenced by MultiXactShmemInit(), and MultiXactShmemSize().
typedef struct MultiXactStateData MultiXactStateData |
typedef struct mXactCacheEnt mXactCacheEnt |
typedef struct mxtruncinfo mxtruncinfo |
void AtEOXact_MultiXact | ( | void | ) |
Definition at line 1683 of file multixact.c.
References dlist_init(), InvalidMultiXactId, MXactCacheMembers, MyBackendId, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by AbortTransaction(), and CommitTransaction().
void AtPrepare_MultiXact | ( | void | ) |
Definition at line 1712 of file multixact.c.
References MultiXactIdIsValid, MyBackendId, OldestMemberMXactId, RegisterTwoPhaseRecord(), and TWOPHASE_RM_MULTIXACT_ID.
Referenced by PrepareTransaction().
void BootStrapMultiXact | ( | void | ) |
Definition at line 1891 of file multixact.c.
References Assert, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactMemberCtl, MultiXactOffsetCtl, SimpleLruWritePage(), ZeroMultiXactMemberPage(), and ZeroMultiXactOffsetPage().
Referenced by BootStrapXLOG().
void CheckPointMultiXact | ( | void | ) |
Definition at line 2152 of file multixact.c.
References MultiXactMemberCtl, MultiXactOffsetCtl, and SimpleLruWriteAll().
Referenced by CheckPointGuts().
|
static |
Definition at line 2431 of file multixact.c.
References difference(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_MEMBERS_IN_LAST_MEMBERS_PAGE, MaxMultiXactOffset, MULTIXACT_MEMBERS_PER_PAGE, MXOffsetToFlagsBitShift, MXOffsetToFlagsOffset, MXOffsetToMemberPage, and ZeroMultiXactMemberPage().
Referenced by GetNewMultiXactId().
|
static |
Definition at line 2401 of file multixact.c.
References FirstMultiXactId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetEntry, MultiXactIdToOffsetPage, and ZeroMultiXactOffsetPage().
Referenced by GetNewMultiXactId().
|
static |
Definition at line 2731 of file multixact.c.
References Assert, MultiXactStateData::finishedStartup, LWLockRelease(), MultiXactIdToOffsetEntry, MultiXactIdToOffsetPage, MultiXactMemberCtl, MultiXactOffsetCtl, SimpleLruDoesPhysicalPageExist(), SimpleLruReadPage_ReadOnly(), and SimpleLruWriteAll().
Referenced by SetOffsetVacuumLimit(), and TruncateMultiXact().
int GetMultiXactIdMembers | ( | MultiXactId | multi, |
MultiXactMember ** | members, | ||
bool | from_pgupgrade, | ||
bool | onlyLock | ||
) |
Definition at line 1223 of file multixact.c.
References Assert, CHECK_FOR_INTERRUPTS, DEBUG2, debug_elog2, debug_elog3, ereport, errcode(), errmsg(), ERROR, FirstMultiXactId, i, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactIdSetOldestVisible(), MultiXactIdToOffsetEntry, MultiXactIdToOffsetPage, MultiXactMemberCtl, MultiXactOffsetCtl, MXACT_MEMBER_XACT_BITMASK, mXactCacheGetById(), mXactCachePut(), mxid_to_string(), MXOffsetToFlagsBitShift, MXOffsetToFlagsOffset, MXOffsetToMemberOffset, MXOffsetToMemberPage, MyBackendId, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactId, OldestVisibleMXactId, palloc(), pg_usleep(), SimpleLruReadPage(), MultiXactMember::status, TransactionIdIsValid, and MultiXactMember::xid.
Referenced by Do_MultiXactIdWait(), DoesMultiXactIdConflict(), FreezeMultiXactId(), GetMultiXactIdHintBits(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_tuple_needs_freeze(), MultiXactIdExpand(), MultiXactIdGetUpdateXid(), MultiXactIdIsRunning(), pg_get_multixact_members(), and pgrowlocks().
|
static |
Definition at line 956 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(), 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 2503 of file multixact.c.
References FirstMultiXactId, i, LW_SHARED, LWLockAcquire(), LWLockRelease(), MaxOldestSlot, MultiXactIdIsValid, MultiXactIdPrecedes(), MultiXactStateData::nextMXact, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by heapam_relation_set_new_filenode(), vac_update_datfrozenxid(), and vacuum_set_xid_limits().
|
static |
Definition at line 1972 of file multixact.c.
References LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetPage, MultiXactOffsetCtl, MultiXactStateData::nextMXact, SimpleLruDoesPhysicalPageExist(), SimpleLruWritePage(), and ZeroMultiXactOffsetPage().
Referenced by MultiXactSetNextMXact().
void multixact_redo | ( | XLogReaderState * | record | ) |
Definition at line 3233 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(), RecordNewMultiXact(), SetMultiXactIdLimit(), 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 1812 of file multixact.c.
References multixact_twophase_postcommit().
void multixact_twophase_postcommit | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 1797 of file multixact.c.
References Assert, InvalidMultiXactId, OldestMemberMXactId, and TwoPhaseGetDummyBackendId().
Referenced by multixact_twophase_postabort().
void multixact_twophase_recover | ( | TransactionId | xid, |
uint16 | info, | ||
void * | recdata, | ||
uint32 | len | ||
) |
Definition at line 1776 of file multixact.c.
References Assert, OldestMemberMXactId, and TwoPhaseGetDummyBackendId().
void MultiXactAdvanceNextMXact | ( | MultiXactId | minMulti, |
MultiXactOffset | minMultiOffset | ||
) |
Definition at line 2359 of file multixact.c.
References DEBUG2, debug_elog3, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdPrecedes(), MultiXactOffsetPrecedes(), MultiXactStateData::nextMXact, and MultiXactStateData::nextOffset.
Referenced by multixact_redo(), and xlog_redo().
void MultiXactAdvanceOldest | ( | MultiXactId | oldestMulti, |
Oid | oldestMultiDB | ||
) |
Definition at line 2384 of file multixact.c.
References Assert, InRecovery, MultiXactIdPrecedes(), MultiXactStateData::oldestMultiXactId, and SetMultiXactIdLimit().
Referenced by xlog_redo().
void MultiXactGetCheckptMulti | ( | bool | is_shutdown, |
MultiXactId * | nextMulti, | ||
MultiXactOffset * | nextMultiOffset, | ||
MultiXactId * | oldestMulti, | ||
Oid * | oldestMultiDB | ||
) |
Definition at line 2130 of file multixact.c.
References DEBUG2, debug_elog6, LW_SHARED, LWLockAcquire(), LWLockRelease(), 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 386 of file multixact.c.
References Assert, AssertArg, DEBUG2, debug_elog3, MultiXactIdCreateFromMembers(), MultiXactIdIsValid, mxid_to_string(), MyBackendId, OldestMemberMXactId, MultiXactMember::status, TransactionIdEquals, TransactionIdIsValid, and MultiXactMember::xid.
Referenced by compute_new_xmax_infomask().
MultiXactId MultiXactIdCreateFromMembers | ( | int | nmembers, |
MultiXactMember * | members | ||
) |
Definition at line 767 of file multixact.c.
References DEBUG2, debug_elog2, debug_elog3, elog, END_CRIT_SECTION, ERROR, GetNewMultiXactId(), i, InvalidMultiXactId, ISUPDATE_from_mxstatus, xl_multixact_create::mid, xl_multixact_create::moff, MultiXactIdIsValid, mXactCacheGetBySet(), mXactCachePut(), mxid_to_string(), xl_multixact_create::nmembers, RecordNewMultiXact(), SizeOfMultiXactCreate, status(), 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 439 of file multixact.c.
References Assert, AssertArg, DEBUG2, debug_elog3, debug_elog4, debug_elog5, GetMultiXactIdMembers(), i, ISUPDATE_from_mxstatus, MultiXactIdCreateFromMembers(), MultiXactIdIsValid, mxstatus_to_string(), MyBackendId, OldestMemberMXactId, palloc(), pfree(), MultiXactMember::status, status(), TransactionIdDidCommit(), TransactionIdEquals, TransactionIdIsInProgress(), TransactionIdIsValid, and MultiXactMember::xid.
Referenced by compute_new_xmax_infomask().
bool MultiXactIdIsRunning | ( | MultiXactId | multi, |
bool | isLockOnly | ||
) |
Definition at line 551 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 3156 of file multixact.c.
Referenced by check_mxid_in_range(), copy_table_data(), do_start_worker(), FreezeMultiXactId(), GetMultiXactIdMembers(), GetNewMultiXactId(), GetOldestMultiXactId(), heap_tuple_needs_freeze(), MultiXactAdvanceNextMXact(), MultiXactAdvanceOldest(), MultiXactIdSetOldestVisible(), MultiXactOffsetPagePrecedes(), relation_needs_vacanalyze(), SetMultiXactIdLimit(), TruncateMultiXact(), vac_truncate_clog(), vac_update_datfrozenxid(), vac_update_relstats(), and vacuum_set_xid_limits().
bool MultiXactIdPrecedesOrEquals | ( | MultiXactId | multi1, |
MultiXactId | multi2 | ||
) |
Definition at line 3170 of file multixact.c.
Referenced by check_mxid_in_range(), heap_vacuum_rel(), and TruncateMultiXact().
void MultiXactIdSetOldestMember | ( | void | ) |
Definition at line 625 of file multixact.c.
References DEBUG2, debug_elog4, FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MyBackendId, MultiXactStateData::nextMXact, and OldestMemberMXactId.
Referenced by heap_delete(), heap_lock_tuple(), heap_lock_updated_tuple(), and heap_update().
|
static |
Definition at line 682 of file multixact.c.
References DEBUG2, debug_elog4, FirstMultiXactId, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxOldestSlot, MultiXactIdIsValid, MultiXactIdPrecedes(), MyBackendId, MultiXactStateData::nextMXact, OldestMemberMXactId, and OldestVisibleMXactId.
Referenced by GetMultiXactIdMembers().
int MultiXactMemberFreezeThreshold | ( | void | ) |
Definition at line 2825 of file multixact.c.
References autovacuum_multixact_freeze_max_age, MULTIXACT_MEMBER_DANGER_THRESHOLD, MULTIXACT_MEMBER_SAFE_THRESHOLD, and ReadMultiXactCounts().
Referenced by do_autovacuum(), do_start_worker(), and vacuum_set_xid_limits().
|
static |
Definition at line 3136 of file multixact.c.
References MULTIXACT_MEMBERS_PER_PAGE, and MultiXactOffsetPrecedes().
Referenced by MultiXactShmemInit().
int multixactmemberssyncfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 3421 of file multixact.c.
References MultiXactMemberCtl, and SlruSyncFileTag().
|
static |
Definition at line 3116 of file multixact.c.
References FirstMultiXactId, MULTIXACT_OFFSETS_PER_PAGE, and MultiXactIdPrecedes().
Referenced by MultiXactShmemInit().
|
static |
Definition at line 3182 of file multixact.c.
Referenced by MultiXactAdvanceNextMXact(), and MultiXactMemberPagePrecedes().
int multixactoffsetssyncfiletag | ( | const FileTag * | ftag, |
char * | path | ||
) |
Definition at line 3412 of file multixact.c.
References MultiXactOffsetCtl, and SlruSyncFileTag().
|
static |
void MultiXactSetNextMXact | ( | MultiXactId | nextMulti, |
MultiXactOffset | nextMultiOffset | ||
) |
Definition at line 2176 of file multixact.c.
References DEBUG2, debug_elog4, IsBinaryUpgrade, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaybeExtendOffsetSlru(), MultiXactStateData::nextMXact, and MultiXactStateData::nextOffset.
Referenced by BootStrapXLOG(), StartupXLOG(), and xlog_redo().
void MultiXactShmemInit | ( | void | ) |
Definition at line 1841 of file multixact.c.
References Assert, DEBUG2, debug_elog2, IsUnderPostmaster, LWTRANCHE_MULTIXACTMEMBER_BUFFER, LWTRANCHE_MULTIXACTOFFSET_BUFFER, MaxOldestSlot, MemSet, MULTIXACT_OFFSETS_PER_PAGE, MultiXactMemberCtl, MultiXactMemberPagePrecedes(), MultiXactOffsetCtl, MultiXactOffsetPagePrecedes(), NUM_MULTIXACTMEMBER_BUFFERS, NUM_MULTIXACTOFFSET_BUFFERS, OldestMemberMXactId, OldestVisibleMXactId, MultiXactStateData::perBackendXactIds, SHARED_MULTIXACT_STATE_SIZE, ShmemInitStruct(), SimpleLruInit(), SlruPagePrecedesUnitTests, SYNC_HANDLER_MULTIXACT_MEMBER, and SYNC_HANDLER_MULTIXACT_OFFSET.
Referenced by CreateSharedMemoryAndSemaphores().
Size MultiXactShmemSize | ( | void | ) |
Definition at line 1824 of file multixact.c.
References add_size(), NUM_MULTIXACTMEMBER_BUFFERS, NUM_MULTIXACTOFFSET_BUFFERS, SHARED_MULTIXACT_STATE_SIZE, and SimpleLruShmemSize().
Referenced by CreateSharedMemoryAndSemaphores().
|
static |
Definition at line 1536 of file multixact.c.
References dlist_iter::cur, DEBUG2, debug_elog2, debug_elog3, dlist_container, dlist_foreach, dlist_move_head(), mXactCacheEnt::members, mXactCacheEnt::multi, mxid_to_string(), mXactCacheEnt::nmembers, and palloc().
Referenced by GetMultiXactIdMembers().
|
static |
Definition at line 1494 of file multixact.c.
References dlist_iter::cur, DEBUG2, debug_elog2, debug_elog3, dlist_container, dlist_foreach, dlist_move_head(), InvalidMultiXactId, mXactCacheEnt::members, mXactCacheEnt::multi, mxactMemberComparator(), mxid_to_string(), mXactCacheEnt::nmembers, and qsort.
Referenced by MultiXactIdCreateFromMembers().
|
static |
Definition at line 1582 of file multixact.c.
References ALLOCSET_SMALL_SIZES, AllocSetContextCreate, DEBUG2, debug_elog2, debug_elog3, dlist_container, dlist_delete(), dlist_push_head(), dlist_tail_node(), MAX_CACHE_ENTRIES, mXactCacheEnt::members, MemoryContextAlloc(), mXactCacheEnt::multi, MXactCacheMembers, mxactMemberComparator(), mxid_to_string(), mXactCacheEnt::nmembers, mXactCacheEnt::node, offsetof, pfree(), qsort, and TopTransactionContext.
Referenced by GetMultiXactIdMembers(), and MultiXactIdCreateFromMembers().
|
static |
Definition at line 1464 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 1652 of file multixact.c.
References appendStringInfo(), appendStringInfoChar(), buf, StringInfoData::data, i, initStringInfo(), MemoryContextStrdup(), mxstatus_to_string(), pfree(), status(), generate_unaccent_rules::str, and TopMemoryContext.
Referenced by GetMultiXactIdMembers(), MultiXactIdCreate(), MultiXactIdCreateFromMembers(), mXactCacheGetById(), mXactCacheGetBySet(), and mXactCachePut().
|
static |
Definition at line 1629 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 2888 of file multixact.c.
References DEBUG2, elog, MaxMultiXactOffset, MultiXactMemberCtl, MXOffsetToMemberSegment, and SlruDeleteSegment().
Referenced by multixact_redo(), and TruncateMultiXact().
|
static |
Definition at line 2916 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 3344 of file multixact.c.
References FuncCallContext::attinmeta, BuildTupleFromCStrings(), CreateTemplateTupleDesc(), ereport, errcode(), errmsg(), ERROR, FirstMultiXactId, 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, TupleDescGetAttInMetadata(), TupleDescInitEntry(), FuncCallContext::user_fctx, and values.
void PostPrepare_MultiXact | ( | TransactionId | xid | ) |
Definition at line 1726 of file multixact.c.
References dlist_init(), InvalidMultiXactId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdIsValid, MXactCacheMembers, MyBackendId, OldestMemberMXactId, OldestVisibleMXactId, and TwoPhaseGetDummyBackendId().
Referenced by PrepareTransaction().
|
static |
Definition at line 2769 of file multixact.c.
References LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactId, MultiXactStateData::oldestOffset, and MultiXactStateData::oldestOffsetKnown.
Referenced by MultiXactMemberFreezeThreshold().
void ReadMultiXactIdRange | ( | MultiXactId * | oldest, |
MultiXactId * | next | ||
) |
Definition at line 743 of file multixact.c.
References FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), MultiXactStateData::nextMXact, and MultiXactStateData::oldestMultiXactId.
Referenced by update_cached_mxid_range().
MultiXactId ReadNextMultiXactId | ( | void | ) |
Definition at line 723 of file multixact.c.
References FirstMultiXactId, LW_SHARED, LWLockAcquire(), LWLockRelease(), and MultiXactStateData::nextMXact.
Referenced by ATRewriteTables(), AutoVacWorkerMain(), do_start_worker(), mxid_age(), refresh_by_heap_swap(), vac_update_datfrozenxid(), vac_update_relstats(), and vacuum_set_xid_limits().
|
static |
Definition at line 862 of file multixact.c.
References Assert, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MultiXactIdToOffsetEntry, MultiXactIdToOffsetPage, MultiXactMemberCtl, MultiXactOffsetCtl, MultiXactStatusUpdate, MXACT_MEMBER_BITS_PER_XACT, MXOffsetToFlagsBitShift, MXOffsetToFlagsOffset, MXOffsetToMemberOffset, MXOffsetToMemberPage, SimpleLruReadPage(), MultiXactMember::status, status(), and MultiXactMember::xid.
Referenced by multixact_redo(), and MultiXactIdCreateFromMembers().
void SetMultiXactIdLimit | ( | MultiXactId | oldest_datminmxid, |
Oid | oldest_datoid, | ||
bool | is_startup | ||
) |
Definition at line 2210 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(), 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().
Definition at line 2556 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, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::offsetStopLimit, MultiXactStateData::oldestMultiXactId, MultiXactStateData::oldestOffset, MultiXactStateData::oldestOffsetKnown, and SLRU_PAGES_PER_SEGMENT.
Referenced by SetMultiXactIdLimit().
|
static |
Definition at line 2865 of file multixact.c.
References mxtruncinfo::earliestExistingPage, and SlruCtlData::PagePrecedes.
Referenced by TruncateMultiXact().
void StartupMultiXact | ( | void | ) |
Definition at line 2005 of file multixact.c.
References MultiXactIdToOffsetPage, MultiXactMemberCtl, MultiXactOffsetCtl, MXOffsetToMemberPage, MultiXactStateData::nextMXact, and MultiXactStateData::nextOffset.
Referenced by StartupXLOG().
void TrimMultiXact | ( | void | ) |
Definition at line 2028 of file multixact.c.
References MultiXactStateData::finishedStartup, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), MemSet, MultiXactIdToOffsetEntry, MultiXactIdToOffsetPage, MultiXactMemberCtl, MultiXactOffsetCtl, MXOffsetToFlagsOffset, MXOffsetToMemberOffset, MXOffsetToMemberPage, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestMultiXactId, SetMultiXactIdLimit(), and SimpleLruReadPage().
Referenced by StartupXLOG().
void TruncateMultiXact | ( | MultiXactId | newOldestMulti, |
Oid | newOldestMultiDB | ||
) |
Definition at line 2941 of file multixact.c.
References Assert, DEBUG1, PGPROC::delayChkpt, 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, MXOffsetToMemberSegment, MyProc, MultiXactStateData::nextMXact, MultiXactStateData::nextOffset, MultiXactStateData::oldestMultiXactDB, MultiXactStateData::oldestMultiXactId, MultiXactStateData::oldestOffset, PerformMembersTruncation(), PerformOffsetsTruncation(), RecoveryInProgress(), SlruScanDirCbFindEarliest(), SlruScanDirectory(), START_CRIT_SECTION, and WriteMTruncateXlogRec().
Referenced by vac_truncate_clog().
|
static |
Definition at line 3208 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().
|
static |
Definition at line 3194 of file multixact.c.
References XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by ZeroMultiXactMemberPage(), and ZeroMultiXactOffsetPage().
|
static |
Definition at line 1944 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 1928 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 188 of file multixact.c.
|
static |
Definition at line 187 of file multixact.c.
|
static |
Definition at line 291 of file multixact.c.
|
static |
Definition at line 322 of file multixact.c.
|
static |
Definition at line 323 of file multixact.c.
Referenced by AtEOXact_MultiXact(), mXactCachePut(), and PostPrepare_MultiXact().
|
static |
Definition at line 324 of file multixact.c.
|
static |
Definition at line 292 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 293 of file multixact.c.
Referenced by AtEOXact_MultiXact(), GetMultiXactIdMembers(), GetOldestMultiXactId(), MultiXactIdSetOldestVisible(), MultiXactShmemInit(), and PostPrepare_MultiXact().