|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <signal.h>#include <unistd.h>#include "miscadmin.h"#include "storage/ipc.h"#include "storage/proc.h"#include "storage/procnumber.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 |
| #define | NumProcStateSlots (MaxBackends + NUM_AUXILIARY_PROCS) |
Typedefs | |
| typedef struct ProcState | ProcState |
| typedef struct SISeg | SISeg |
Functions | |
| static void | CleanupInvalidationState (int status, Datum arg) |
| Size | SharedInvalShmemSize (void) |
| void | SharedInvalShmemInit (void) |
| void | SharedInvalBackendInit (bool sendOnly) |
| 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 131 of file sinvaladt.c.
| #define CLEANUP_QUANTUM (MAXNUMMESSAGES / 16) |
Definition at line 132 of file sinvaladt.c.
| #define MAXNUMMESSAGES 4096 |
Definition at line 129 of file sinvaladt.c.
| #define MSGNUMWRAPAROUND (MAXNUMMESSAGES * 262144) |
Definition at line 130 of file sinvaladt.c.
| #define NumProcStateSlots (MaxBackends + NUM_AUXILIARY_PROCS) |
Definition at line 204 of file sinvaladt.c.
| #define SIG_THRESHOLD (MAXNUMMESSAGES / 2) |
Definition at line 133 of file sinvaladt.c.
| #define WRITE_QUANTUM 64 |
Definition at line 134 of file sinvaladt.c.
|
static |
Definition at line 328 of file sinvaladt.c.
References arg, Assert(), DatumGetPointer(), elog, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcNumber, nextLocalTransactionId, ProcState::nextLXID, ProcState::nextMsgNum, SISeg::numProcs, PANIC, SISeg::pgprocnos, ProcState::procPid, SISeg::procState, ProcState::resetState, and ProcState::signaled.
Referenced by SharedInvalBackendInit().
| LocalTransactionId GetNextLocalTransactionId | ( | void | ) |
Definition at line 701 of file sinvaladt.c.
References LocalTransactionIdIsValid, and nextLocalTransactionId.
Referenced by InitRecoveryTransactionEnvironment(), and StartTransaction().
| void SharedInvalBackendInit | ( | bool | sendOnly | ) |
Definition at line 272 of file sinvaladt.c.
References CleanupInvalidationState(), elog, ERROR, ProcState::hasMessages, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MyProcNumber, MyProcPid, nextLocalTransactionId, ProcState::nextLXID, ProcState::nextMsgNum, SISeg::numProcs, NumProcStateSlots, on_shmem_exit(), PANIC, SISeg::pgprocnos, PointerGetDatum(), ProcState::procPid, SISeg::procState, ProcState::resetState, ProcState::sendOnly, shmInvalBuffer, and ProcState::signaled.
Referenced by InitPostgres(), and InitRecoveryTransactionEnvironment().
| void SharedInvalShmemInit | ( | void | ) |
Definition at line 234 of file sinvaladt.c.
References CLEANUP_MIN, ProcState::hasMessages, i, InvalidLocalTransactionId, SISeg::maxMsgNum, SISeg::minMsgNum, SISeg::msgnumLock, ProcState::nextLXID, ProcState::nextMsgNum, SISeg::nextThreshold, SISeg::numProcs, NumProcStateSlots, SISeg::pgprocnos, ProcState::procPid, SISeg::procState, ProcState::resetState, SharedInvalShmemSize(), ShmemInitStruct(), shmInvalBuffer, ProcState::signaled, and SpinLockInit.
Referenced by CreateOrAttachShmemStructs().
| Size SharedInvalShmemSize | ( | void | ) |
Definition at line 218 of file sinvaladt.c.
References add_size(), mul_size(), and NumProcStateSlots.
Referenced by CalculateShmemSize(), and SharedInvalShmemInit().
| void SICleanupQueue | ( | bool | callerHasWriteLock, |
| int | minFree | ||
| ) |
Definition at line 577 of file sinvaladt.c.
References Assert(), CLEANUP_MIN, CLEANUP_QUANTUM, DEBUG4, elog, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, SISeg::minMsgNum, MSGNUMWRAPAROUND, ProcState::nextMsgNum, SISeg::nextThreshold, SISeg::numProcs, SISeg::pgprocnos, 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 473 of file sinvaladt.c.
References SISeg::buffer, data, ProcState::hasMessages, LW_SHARED, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, SISeg::msgnumLock, MyProcNumber, 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 370 of file sinvaladt.c.
References SISeg::buffer, data, ProcState::hasMessages, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SISeg::maxMsgNum, MAXNUMMESSAGES, Min, SISeg::minMsgNum, SISeg::msgnumLock, SISeg::nextThreshold, SISeg::numProcs, SISeg::pgprocnos, SISeg::procState, shmInvalBuffer, SICleanupQueue(), SpinLockAcquire, SpinLockRelease, and WRITE_QUANTUM.
Referenced by SendSharedInvalidMessages().
|
static |
Definition at line 209 of file sinvaladt.c.
Referenced by CleanupInvalidationState(), GetNextLocalTransactionId(), and SharedInvalBackendInit().
|
static |
Definition at line 206 of file sinvaladt.c.
Referenced by SharedInvalBackendInit(), SharedInvalShmemInit(), SICleanupQueue(), SIGetDataEntries(), and SIInsertDataEntries().