PostgreSQL Source Code
git master
|
#include "datatype/timestamp.h"
#include "storage/lock.h"
#include "storage/procsignal.h"
#include "storage/relfilelocator.h"
#include "storage/standbydefs.h"
Go to the source code of this file.
Data Structures | |
struct | RunningTransactionsData |
Macros | |
#define | MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) |
Typedefs | |
typedef struct RunningTransactionsData | RunningTransactionsData |
typedef RunningTransactionsData * | RunningTransactions |
Enumerations | |
enum | subxids_array_status { SUBXIDS_IN_ARRAY , SUBXIDS_MISSING , SUBXIDS_IN_SUBTRANS } |
Variables | |
PGDLLIMPORT int | max_standby_archive_delay |
PGDLLIMPORT int | max_standby_streaming_delay |
PGDLLIMPORT bool | log_recovery_conflict_waits |
#define MinSizeOfXactRunningXacts offsetof(xl_running_xacts, xids) |
typedef struct RunningTransactionsData RunningTransactionsData |
enum subxids_array_status |
void CheckRecoveryConflictDeadlock | ( | void | ) |
Definition at line 904 of file standby.c.
References Assert, ereport, errcode(), ERRCODE_T_R_DEADLOCK_DETECTED, errdetail(), errmsg(), ERROR, HoldingBufferPinThatDelaysRecovery(), and InRecovery.
Referenced by ProcSleep().
void InitRecoveryTransactionEnvironment | ( | void | ) |
Definition at line 94 of file standby.c.
References Assert, HASHCTL::entrysize, GetNextLocalTransactionId(), HASH_BLOBS, hash_create(), HASH_ELEM, HASHCTL::keysize, VirtualTransactionId::localTransactionId, MyProc, MyProcNumber, VirtualTransactionId::procNumber, PGPROC::procNumber, RecoveryLockHash, RecoveryLockXidHash, SharedInvalBackendInit(), STANDBY_INITIALIZED, standbyState, VirtualXactLockTableInsert(), and PGPROC::vxid.
Referenced by StartupXLOG().
Definition at line 1423 of file standby.c.
References xl_standby_lock::dbOid, GetCurrentTransactionId(), LogAccessExclusiveLocks(), MyXactFlags, xl_standby_lock::relOid, XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK, and xl_standby_lock::xid.
Referenced by LockAcquireExtended().
void LogAccessExclusiveLockPrepare | ( | void | ) |
Definition at line 1440 of file standby.c.
References GetCurrentTransactionId().
Referenced by LockAcquireExtended().
void LogRecoveryConflict | ( | ProcSignalReason | reason, |
TimestampTz | wait_start, | ||
TimestampTz | now, | ||
VirtualTransactionId * | wait_list, | ||
bool | still_waiting | ||
) |
Definition at line 273 of file standby.c.
References appendStringInfo(), Assert, buf, ereport, errdetail_log_plural(), errmsg(), get_recovery_conflict_desc(), initStringInfo(), LOG, now(), pfree(), PGPROC::pid, VirtualTransactionId::procNumber, ProcNumberGetProc(), TimestampDifference(), and VirtualTransactionIdIsValid.
Referenced by LockBufferForCleanup(), ProcSleep(), and ResolveRecoveryConflictWithVirtualXIDs().
void LogStandbyInvalidations | ( | int | nmsgs, |
SharedInvalidationMessage * | msgs, | ||
bool | relcacheInitFileInval | ||
) |
Definition at line 1462 of file standby.c.
References xl_invalidations::dbId, MinSizeOfInvalidations, MyDatabaseId, MyDatabaseTableSpace, xl_invalidations::nmsgs, xl_invalidations::relcacheInitFileInval, xl_invalidations::tsId, XLOG_INVALIDATIONS, XLogBeginInsert(), XLogInsert(), and XLogRegisterData().
Referenced by RecordTransactionCommit().
XLogRecPtr LogStandbySnapshot | ( | void | ) |
Definition at line 1285 of file standby.c.
References Assert, GetRunningTransactionData(), GetRunningTransactionLocks(), LogAccessExclusiveLocks(), LogCurrentRunningXacts(), LWLockRelease(), pfree(), wal_level, WAL_LEVEL_LOGICAL, and XLogStandbyInfoActive.
Referenced by BackgroundWriterMain(), CreateCheckPoint(), pg_log_standby_snapshot(), ReplicationSlotReserveWal(), and SnapBuildWaitSnapshot().
void ResolveRecoveryConflictWithBufferPin | ( | void | ) |
Definition at line 792 of file standby.c.
References Assert, DeadlockTimeout, EnableTimeoutParams::delay_ms, disable_all_timeouts(), enable_timeouts(), EnableTimeoutParams::fin_time, GetCurrentTimestamp(), GetStandbyLimitTime(), got_standby_deadlock_timeout, got_standby_delay_timeout, EnableTimeoutParams::id, InHotStandby, PROCSIG_RECOVERY_CONFLICT_BUFFERPIN, PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, ProcWaitForSignal(), SendRecoveryConflictWithBufferPin(), STANDBY_DEADLOCK_TIMEOUT, STANDBY_TIMEOUT, TMPARAM_AFTER, TMPARAM_AT, and EnableTimeoutParams::type.
Referenced by LockBufferForCleanup().
void ResolveRecoveryConflictWithDatabase | ( | Oid | dbid | ) |
Definition at line 568 of file standby.c.
References CancelDBBackends(), CountDBBackends(), pg_usleep(), and PROCSIG_RECOVERY_CONFLICT_DATABASE.
Referenced by dbase_redo().
Definition at line 622 of file standby.c.
References AccessExclusiveLock, Assert, cleanup(), DeadlockTimeout, EnableTimeoutParams::delay_ms, disable_all_timeouts(), enable_timeouts(), EnableTimeoutParams::fin_time, GetCurrentTimestamp(), GetLockConflicts(), GetStandbyLimitTime(), got_standby_deadlock_timeout, got_standby_lock_timeout, EnableTimeoutParams::id, InHotStandby, LOCKTAG::locktag_type, MyProc, now(), pg_atomic_read_u64(), pg_atomic_write_u64(), PG_WAIT_LOCK, PROCSIG_RECOVERY_CONFLICT_LOCK, PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK, ProcWaitForSignal(), ResolveRecoveryConflictWithVirtualXIDs(), SignalVirtualTransaction(), STANDBY_DEADLOCK_TIMEOUT, STANDBY_LOCK_TIMEOUT, TMPARAM_AFTER, TMPARAM_AT, EnableTimeoutParams::type, VirtualTransactionIdIsValid, and PGPROC::waitStart.
Referenced by ProcSleep().
void ResolveRecoveryConflictWithSnapshot | ( | TransactionId | snapshotConflictHorizon, |
bool | isCatalogRel, | ||
RelFileLocator | locator | ||
) |
Definition at line 467 of file standby.c.
References Assert, RelFileLocator::dbOid, GetConflictingVirtualXIDs(), InvalidateObsoleteReplicationSlots(), PROCSIG_RECOVERY_CONFLICT_SNAPSHOT, ResolveRecoveryConflictWithVirtualXIDs(), RS_INVAL_HORIZON, TransactionIdIsNormal, TransactionIdIsValid, wal_level, and WAL_LEVEL_LOGICAL.
Referenced by btree_xlog_delete(), gistRedoDeleteRecord(), hash_xlog_vacuum_one_page(), heap_xlog_prune_freeze(), heap_xlog_visible(), ResolveRecoveryConflictWithSnapshotFullXid(), and spgRedoVacuumRedirect().
void ResolveRecoveryConflictWithSnapshotFullXid | ( | FullTransactionId | snapshotConflictHorizon, |
bool | isCatalogRel, | ||
RelFileLocator | locator | ||
) |
Definition at line 511 of file standby.c.
References MaxTransactionId, ReadNextFullTransactionId(), ResolveRecoveryConflictWithSnapshot(), U64FromFullTransactionId, and XidFromFullTransactionId.
Referenced by btree_xlog_reuse_page(), and gistRedoPageReuse().
void ResolveRecoveryConflictWithTablespace | ( | Oid | tsid | ) |
Definition at line 538 of file standby.c.
References GetConflictingVirtualXIDs(), InvalidOid, InvalidTransactionId, PROCSIG_RECOVERY_CONFLICT_TABLESPACE, and ResolveRecoveryConflictWithVirtualXIDs().
Referenced by tblspc_redo().
void ShutdownRecoveryTransactionEnvironment | ( | void | ) |
Definition at line 160 of file standby.c.
References ExpireAllKnownAssignedTransactionIds(), hash_destroy(), RecoveryLockHash, RecoveryLockXidHash, StandbyReleaseAllLocks(), and VirtualXactLockTableCleanup().
Referenced by StartupProcExit(), and StartupXLOG().
void StandbyAcquireAccessExclusiveLock | ( | TransactionId | xid, |
Oid | dbOid, | ||
Oid | relOid | ||
) |
Definition at line 985 of file standby.c.
References AccessExclusiveLock, Assert, DEBUG4, elog, HASH_ENTER, hash_search(), RecoveryLockXidEntry::head, sort-test::key, LockAcquire(), RecoveryLockEntry::next, OidIsValid, RecoveryLockHash, RecoveryLockXidHash, SET_LOCKTAG_RELATION, TransactionIdDidAbort(), TransactionIdDidCommit(), TransactionIdIsValid, and RecoveryLockXidEntry::xid.
Referenced by lock_twophase_standby_recover(), and standby_redo().
void StandbyDeadLockHandler | ( | void | ) |
Definition at line 935 of file standby.c.
References got_standby_deadlock_timeout.
Referenced by StartupProcessMain().
void StandbyLockTimeoutHandler | ( | void | ) |
Definition at line 953 of file standby.c.
References got_standby_lock_timeout.
Referenced by StartupProcessMain().
void StandbyReleaseAllLocks | ( | void | ) |
Definition at line 1105 of file standby.c.
References DEBUG2, elog, HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), RecoveryLockXidHash, and StandbyReleaseXidEntryLocks().
Referenced by ShutdownRecoveryTransactionEnvironment(), and StandbyReleaseLocks().
void StandbyReleaseLockTree | ( | TransactionId | xid, |
int | nsubxids, | ||
TransactionId * | subxids | ||
) |
Definition at line 1091 of file standby.c.
References i, and StandbyReleaseLocks().
Referenced by RecoverPreparedTransactions(), xact_redo_abort(), and xact_redo_commit().
void StandbyReleaseOldLocks | ( | TransactionId | oldxid | ) |
Definition at line 1126 of file standby.c.
References Assert, HASH_REMOVE, hash_search(), hash_seq_init(), hash_seq_search(), RecoveryLockXidHash, StandbyReleaseXidEntryLocks(), StandbyTransactionIdIsPrepared(), TransactionIdIsValid, TransactionIdPrecedes(), and RecoveryLockXidEntry::xid.
Referenced by ProcArrayApplyRecoveryInfo().
void StandbyTimeoutHandler | ( | void | ) |
Definition at line 944 of file standby.c.
References got_standby_delay_timeout.
Referenced by StartupProcessMain().
|
extern |
Definition at line 41 of file standby.c.
Referenced by LockBufferForCleanup(), ProcSleep(), and ResolveRecoveryConflictWithVirtualXIDs().
|
extern |
Definition at line 39 of file standby.c.
Referenced by GetStandbyLimitTime().
|
extern |
Definition at line 40 of file standby.c.
Referenced by GetStandbyLimitTime().