PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <signal.h>
#include <unistd.h>
#include "access/transam.h"
#include "miscadmin.h"
#include "storage/backendid.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/procsignal.h"
#include "storage/shmem.h"
#include "storage/sinvaladt.h"
#include "storage/spin.h"
Go to the source code of this file.
Data Structures | |
struct | ProcState |
struct | SISeg |
Macros | |
#define | MAXNUMMESSAGES 4096 |
#define | MSGNUMWRAPAROUND (MAXNUMMESSAGES * 262144) |
#define | CLEANUP_MIN (MAXNUMMESSAGES / 2) |
#define | CLEANUP_QUANTUM (MAXNUMMESSAGES / 16) |
#define | SIG_THRESHOLD (MAXNUMMESSAGES / 2) |
#define | WRITE_QUANTUM 64 |
Typedefs | |
typedef struct ProcState | ProcState |
typedef struct SISeg | SISeg |
Functions | |
static void | CleanupInvalidationState (int status, Datum arg) |
Size | SInvalShmemSize (void) |
void | CreateSharedInvalidationState (void) |
void | SharedInvalBackendInit (bool sendOnly) |
PGPROC * | BackendIdGetProc (int backendID) |
void | BackendIdGetTransactionIds (int backendID, TransactionId *xid, TransactionId *xmin, int *nsubxid, bool *overflowed) |
void | SIInsertDataEntries (const SharedInvalidationMessage *data, int n) |
int | SIGetDataEntries (SharedInvalidationMessage *data, int datasize) |
void | SICleanupQueue (bool callerHasWriteLock, int minFree) |
LocalTransactionId | GetNextLocalTransactionId (void) |
Variables | |
static SISeg * | shmInvalBuffer |
static LocalTransactionId | nextLocalTransactionId |
#define CLEANUP_MIN (MAXNUMMESSAGES / 2) |
Definition at line 132 of file sinvaladt.c.
#define CLEANUP_QUANTUM (MAXNUMMESSAGES / 16) |
Definition at line 133 of file sinvaladt.c.
#define MAXNUMMESSAGES 4096 |
Definition at line 130 of file sinvaladt.c.
#define MSGNUMWRAPAROUND (MAXNUMMESSAGES * 262144) |
Definition at line 131 of file sinvaladt.c.
#define SIG_THRESHOLD (MAXNUMMESSAGES / 2) |
Definition at line 134 of file sinvaladt.c.
#define WRITE_QUANTUM 64 |
Definition at line 135 of file sinvaladt.c.
PGPROC* BackendIdGetProc | ( | int | backendID | ) |
Definition at line 385 of file sinvaladt.c.
References LW_SHARED, LWLockAcquire(), LWLockRelease(), ProcState::proc, SISeg::procState, and shmInvalBuffer.
Referenced by checkTempNamespaceStatus(), LogRecoveryConflict(), VirtualXactLock(), WaitForLockersMultiple(), and WaitForOlderSnapshots().
void BackendIdGetTransactionIds | ( | int | backendID, |
TransactionId * | xid, | ||
TransactionId * | xmin, | ||
int * | nsubxid, | ||
bool * | overflowed | ||
) |
Definition at line 412 of file sinvaladt.c.
References XidCacheStatus::count, InvalidTransactionId, LW_SHARED, LWLockAcquire(), LWLockRelease(), XidCacheStatus::overflowed, ProcState::proc, SISeg::procState, shmInvalBuffer, PGPROC::subxidStatus, PGPROC::xid, and PGPROC::xmin.
Referenced by pgstat_read_current_status().
|
static |
Definition at line 344 of file sinvaladt.c.
References arg, Assert(), DatumGetPointer(), i, SISeg::lastBackend, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyBackendId, nextLocalTransactionId, ProcState::nextLXID, ProcState::nextMsgNum, PointerIsValid, ProcState::proc, ProcState::procPid, SISeg::procState, ProcState::resetState, and ProcState::signaled.
Referenced by SharedInvalBackendInit().
void CreateSharedInvalidationState | ( | void | ) |
Definition at line 227 of file sinvaladt.c.
References CLEANUP_MIN, ProcState::hasMessages, i, InvalidLocalTransactionId, SISeg::lastBackend, SISeg::maxBackends, MaxBackends, SISeg::maxMsgNum, SISeg::minMsgNum, SISeg::msgnumLock, ProcState::nextLXID, ProcState::nextMsgNum, SISeg::nextThreshold, ProcState::proc, ProcState::procPid, SISeg::procState, ProcState::resetState, ShmemInitStruct(), shmInvalBuffer, ProcState::signaled, SInvalShmemSize(), and SpinLockInit.
Referenced by CreateSharedMemoryAndSemaphores().
LocalTransactionId GetNextLocalTransactionId | ( | void | ) |
Definition at line 780 of file sinvaladt.c.
References LocalTransactionIdIsValid, and nextLocalTransactionId.
Referenced by InitRecoveryTransactionEnvironment(), and StartTransaction().
void SharedInvalBackendInit | ( | bool | sendOnly | ) |
Definition at line 266 of file sinvaladt.c.
References Assert(), PGPROC::backendId, CleanupInvalidationState(), DEBUG4, elog(), ereport, errcode(), errmsg(), FATAL, ProcState::hasMessages, InvalidBackendId, SISeg::lastBackend, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxBackends, SISeg::maxMsgNum, MyBackendId, MyProc, MyProcPid, nextLocalTransactionId, ProcState::nextLXID, ProcState::nextMsgNum, on_shmem_exit(), PointerGetDatum(), ProcState::proc, ProcState::procPid, SISeg::procState, ProcState::resetState, ProcState::sendOnly, shmInvalBuffer, and ProcState::signaled.
Referenced by InitPostgres(), and InitRecoveryTransactionEnvironment().
void SICleanupQueue | ( | bool | callerHasWriteLock, |
int | minFree | ||
) |
Definition at line 654 of file sinvaladt.c.
References CLEANUP_MIN, CLEANUP_QUANTUM, DEBUG4, elog(), i, SISeg::lastBackend, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, SISeg::minMsgNum, MSGNUMWRAPAROUND, ProcState::nextMsgNum, SISeg::nextThreshold, ProcState::procPid, PROCSIG_CATCHUP_INTERRUPT, SISeg::procState, ProcState::resetState, ProcState::sendOnly, SendProcSignal(), shmInvalBuffer, SIG_THRESHOLD, and ProcState::signaled.
Referenced by ReceiveSharedInvalidMessages(), and SIInsertDataEntries().
int SIGetDataEntries | ( | SharedInvalidationMessage * | data, |
int | datasize | ||
) |
Definition at line 550 of file sinvaladt.c.
References SISeg::buffer, data, ProcState::hasMessages, LW_SHARED, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, SISeg::msgnumLock, MyBackendId, ProcState::nextMsgNum, SISeg::procState, ProcState::resetState, shmInvalBuffer, ProcState::signaled, SpinLockAcquire, and SpinLockRelease.
Referenced by ReceiveSharedInvalidMessages().
void SIInsertDataEntries | ( | const SharedInvalidationMessage * | data, |
int | n | ||
) |
Definition at line 447 of file sinvaladt.c.
References SISeg::buffer, data, ProcState::hasMessages, i, SISeg::lastBackend, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, Min, SISeg::minMsgNum, SISeg::msgnumLock, SISeg::nextThreshold, SISeg::procState, shmInvalBuffer, SICleanupQueue(), SpinLockAcquire, SpinLockRelease, and WRITE_QUANTUM.
Referenced by SendSharedInvalidMessages().
Size SInvalShmemSize | ( | void | ) |
Definition at line 203 of file sinvaladt.c.
References add_size(), MaxBackends, and mul_size().
Referenced by CalculateShmemSize(), and CreateSharedInvalidationState().
|
static |
Definition at line 194 of file sinvaladt.c.
Referenced by CleanupInvalidationState(), GetNextLocalTransactionId(), and SharedInvalBackendInit().
|
static |
Definition at line 191 of file sinvaladt.c.
Referenced by BackendIdGetProc(), BackendIdGetTransactionIds(), CreateSharedInvalidationState(), SharedInvalBackendInit(), SICleanupQueue(), SIGetDataEntries(), and SIInsertDataEntries().