|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <float.h>#include <math.h>#include "access/xlog.h"#include "access/xlogrecovery.h"#include "access/xlogwait.h"#include "miscadmin.h"#include "pgstat.h"#include "storage/latch.h"#include "storage/proc.h"#include "storage/shmem.h"#include "utils/fmgrprotos.h"#include "utils/pg_lsn.h"#include "utils/snapmgr.h"
Go to the source code of this file.
Macros | |
| #define | WAKEUP_PROC_STATIC_ARRAY_SIZE (16) |
Functions | |
| static int | waitlsn_cmp (const pairingheap_node *a, const pairingheap_node *b, void *arg) |
| Size | WaitLSNShmemSize (void) |
| void | WaitLSNShmemInit (void) |
| static void | updateMinWaitedLSN (WaitLSNType lsnType) |
| static void | addLSNWaiter (XLogRecPtr lsn, WaitLSNType lsnType) |
| static void | deleteLSNWaiter (WaitLSNType lsnType) |
| static void | wakeupWaiters (WaitLSNType lsnType, XLogRecPtr currentLSN) |
| void | WaitLSNWakeup (WaitLSNType lsnType, XLogRecPtr currentLSN) |
| void | WaitLSNCleanup (void) |
| WaitLSNResult | WaitForLSN (WaitLSNType lsnType, XLogRecPtr targetLSN, int64 timeout) |
Variables | |
| struct WaitLSNState * | waitLSNState = NULL |
| #define WAKEUP_PROC_STATIC_ARRAY_SIZE (16) |
Definition at line 195 of file xlogwait.c.
|
static |
Definition at line 145 of file xlogwait.c.
References Assert(), WaitLSNProcInfo::heapNode, i, WaitLSNProcInfo::inHeap, WaitLSNProcInfo::lsnType, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcNumber, pairingheap_add(), WaitLSNState::procInfos, WaitLSNProcInfo::procno, updateMinWaitedLSN(), WAIT_LSN_TYPE_COUNT, WaitLSNState::waitersHeap, WaitLSNProcInfo::waitLSN, and waitLSNState.
Referenced by WaitForLSN().
|
static |
Definition at line 170 of file xlogwait.c.
References Assert(), WaitLSNProcInfo::heapNode, i, WaitLSNProcInfo::inHeap, WaitLSNProcInfo::lsnType, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcNumber, pairingheap_remove(), WaitLSNState::procInfos, updateMinWaitedLSN(), WAIT_LSN_TYPE_COUNT, WaitLSNState::waitersHeap, and waitLSNState.
Referenced by WaitForLSN(), and WaitLSNCleanup().
|
static |
Definition at line 124 of file xlogwait.c.
References Assert(), i, WaitLSNState::minWaitedLSN, pairingheap_container, pairingheap_first(), pairingheap_is_empty, pg_atomic_write_u64(), PG_UINT64_MAX, WAIT_LSN_TYPE_COUNT, WaitLSNState::waitersHeap, WaitLSNProcInfo::waitLSN, and waitLSNState.
Referenced by addLSNWaiter(), deleteLSNWaiter(), and wakeupWaiters().
| WaitLSNResult WaitForLSN | ( | WaitLSNType | lsnType, |
| XLogRecPtr | targetLSN, | ||
| int64 | timeout | ||
| ) |
Definition at line 314 of file xlogwait.c.
References addLSNWaiter(), Assert(), CHECK_FOR_INTERRUPTS, deleteLSNWaiter(), ereport, errcode(), errcontext, errmsg(), FATAL, GetCurrentTimestamp(), GetFlushRecPtr(), GetXLogReplayRecPtr(), MaxBackends, MyLatch, MyProcNumber, NUM_AUXILIARY_PROCS, PromoteIsTriggered(), RecoveryInProgress(), ResetLatch(), TimestampDifferenceMilliseconds(), TimestampTzPlusMilliseconds, WAIT_LSN_RESULT_NOT_IN_RECOVERY, WAIT_LSN_RESULT_SUCCESS, WAIT_LSN_RESULT_TIMEOUT, WAIT_LSN_TYPE_REPLAY, WaitLatch(), waitLSNState, WL_LATCH_SET, WL_POSTMASTER_DEATH, and WL_TIMEOUT.
Referenced by ExecWaitStmt().
|
static |
Definition at line 107 of file xlogwait.c.
References a, b, pairingheap_const_container, and WaitLSNProcInfo::waitLSN.
Referenced by WaitLSNShmemInit().
| void WaitLSNCleanup | ( | void | ) |
Definition at line 290 of file xlogwait.c.
References deleteLSNWaiter(), WaitLSNProcInfo::inHeap, WaitLSNProcInfo::lsnType, MyProcNumber, WaitLSNState::procInfos, and waitLSNState.
Referenced by AbortTransaction(), and ProcKill().
| void WaitLSNShmemInit | ( | void | ) |
Definition at line 78 of file xlogwait.c.
References i, MaxBackends, WaitLSNState::minWaitedLSN, NUM_AUXILIARY_PROCS, pairingheap_initialize(), pg_atomic_init_u64(), PG_UINT64_MAX, WaitLSNState::procInfos, ShmemInitStruct(), WAIT_LSN_TYPE_COUNT, WaitLSNState::waitersHeap, waitlsn_cmp(), WaitLSNShmemSize(), and waitLSNState.
Referenced by CreateOrAttachShmemStructs().
| Size WaitLSNShmemSize | ( | void | ) |
Definition at line 67 of file xlogwait.c.
References add_size(), MaxBackends, mul_size(), NUM_AUXILIARY_PROCS, and WaitLSNState::procInfos.
Referenced by CalculateShmemSize(), and WaitLSNShmemInit().
| void WaitLSNWakeup | ( | WaitLSNType | lsnType, |
| XLogRecPtr | currentLSN | ||
| ) |
Definition at line 269 of file xlogwait.c.
References Assert(), i, WaitLSNState::minWaitedLSN, pg_atomic_read_u64(), WAIT_LSN_TYPE_COUNT, waitLSNState, wakeupWaiters(), and XLogRecPtrIsValid.
Referenced by PerformWalRecovery(), and StartupXLOG().
|
static |
Definition at line 210 of file xlogwait.c.
References Assert(), GetPGProcByNumber, i, WaitLSNProcInfo::inHeap, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pairingheap_container, pairingheap_first(), pairingheap_is_empty, pairingheap_remove_first(), WaitLSNProcInfo::procno, SetLatch(), updateMinWaitedLSN(), WAIT_LSN_TYPE_COUNT, WaitLSNState::waitersHeap, WaitLSNProcInfo::waitLSN, waitLSNState, WAKEUP_PROC_STATIC_ARRAY_SIZE, and XLogRecPtrIsValid.
Referenced by WaitLSNWakeup().
| struct WaitLSNState* waitLSNState = NULL |
Definition at line 63 of file xlogwait.c.
Referenced by addLSNWaiter(), deleteLSNWaiter(), PerformWalRecovery(), updateMinWaitedLSN(), WaitForLSN(), WaitLSNCleanup(), WaitLSNShmemInit(), WaitLSNWakeup(), and wakeupWaiters().