PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <float.h>
#include <math.h>
#include "pgstat.h"
#include "access/xlog.h"
#include "access/xlogrecovery.h"
#include "commands/waitlsn.h"
#include "funcapi.h"
#include "miscadmin.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"
#include "utils/wait_event_types.h"
Go to the source code of this file.
Functions | |
static int | waitlsn_cmp (const pairingheap_node *a, const pairingheap_node *b, void *arg) |
Size | WaitLSNShmemSize (void) |
void | WaitLSNShmemInit (void) |
static void | updateMinWaitedLSN (void) |
static void | addLSNWaiter (XLogRecPtr lsn) |
static void | deleteLSNWaiter (void) |
void | WaitLSNSetLatches (XLogRecPtr currentLSN) |
void | WaitLSNCleanup (void) |
static void | WaitForLSNReplay (XLogRecPtr targetLSN, int64 timeout) |
Datum | pg_wal_replay_wait (PG_FUNCTION_ARGS) |
Variables | |
struct WaitLSNState * | waitLSNState = NULL |
|
static |
Definition at line 108 of file waitlsn.c.
References Assert, WaitLSNProcInfo::inHeap, WaitLSNProcInfo::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyLatch, MyProcNumber, pairingheap_add(), WaitLSNProcInfo::phNode, WaitLSNState::procInfos, updateMinWaitedLSN(), WaitLSNState::waitersHeap, WaitLSNProcInfo::waitLSN, and waitLSNState.
Referenced by WaitForLSNReplay().
|
static |
Definition at line 130 of file waitlsn.c.
References WaitLSNProcInfo::inHeap, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProcNumber, pairingheap_remove(), WaitLSNProcInfo::phNode, WaitLSNState::procInfos, updateMinWaitedLSN(), WaitLSNState::waitersHeap, and waitLSNState.
Referenced by WaitForLSNReplay(), and WaitLSNCleanup().
Datum pg_wal_replay_wait | ( | PG_FUNCTION_ARGS | ) |
Definition at line 341 of file waitlsn.c.
References ActiveSnapshotSet(), Assert, ereport, errcode(), errdetail(), errmsg(), ERROR, GetOldestSnapshot(), InvalidateCatalogSnapshot(), InvalidTransactionId, MyProc, PG_GETARG_INT64, PG_GETARG_LSN, PG_RETURN_VOID, PopActiveSnapshot(), WaitForLSNReplay(), and PGPROC::xmin.
|
static |
Definition at line 90 of file waitlsn.c.
References WaitLSNState::minWaitedLSN, pairingheap_container, pairingheap_first(), pairingheap_is_empty, pg_atomic_write_u64(), PG_UINT64_MAX, WaitLSNState::waitersHeap, and waitLSNState.
Referenced by addLSNWaiter(), deleteLSNWaiter(), and WaitLSNSetLatches().
|
static |
Definition at line 221 of file waitlsn.c.
References addLSNWaiter(), Assert, CHECK_FOR_INTERRUPTS, deleteLSNWaiter(), ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, GetCurrentTimestamp(), GetXLogReplayRecPtr(), LSN_FORMAT_ARGS, MaxBackends, MyLatch, MyProcNumber, RecoveryInProgress(), ResetLatch(), TimestampDifferenceMilliseconds(), TimestampTzPlusMilliseconds, WaitLatch(), waitLSNState, WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_TIMEOUT.
Referenced by pg_wal_replay_wait().
|
static |
Definition at line 72 of file waitlsn.c.
References a, b, pairingheap_const_container, and WaitLSNProcInfo::waitLSN.
Referenced by WaitLSNShmemInit().
void WaitLSNCleanup | ( | void | ) |
Definition at line 204 of file waitlsn.c.
References deleteLSNWaiter(), WaitLSNProcInfo::inHeap, MyProcNumber, WaitLSNState::procInfos, and waitLSNState.
Referenced by AbortTransaction(), and ProcKill().
void WaitLSNSetLatches | ( | XLogRecPtr | currentLSN | ) |
Definition at line 155 of file waitlsn.c.
References i, WaitLSNProcInfo::inHeap, WaitLSNProcInfo::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MaxBackends, pairingheap_container, pairingheap_first(), pairingheap_is_empty, pairingheap_remove_first(), palloc(), pfree(), SetLatch(), updateMinWaitedLSN(), WaitLSNState::waitersHeap, WaitLSNProcInfo::waitLSN, waitLSNState, and XLogRecPtrIsInvalid.
Referenced by PerformWalRecovery(), and StartupXLOG().
void WaitLSNShmemInit | ( | void | ) |
Definition at line 52 of file waitlsn.c.
References MaxBackends, WaitLSNState::minWaitedLSN, pairingheap_initialize(), pg_atomic_init_u64(), PG_UINT64_MAX, WaitLSNState::procInfos, ShmemInitStruct(), WaitLSNState::waitersHeap, waitlsn_cmp(), WaitLSNShmemSize(), and waitLSNState.
Referenced by CreateOrAttachShmemStructs().
Size WaitLSNShmemSize | ( | void | ) |
Definition at line 41 of file waitlsn.c.
References add_size(), MaxBackends, mul_size(), WaitLSNState::procInfos, and size.
Referenced by CalculateShmemSize(), and WaitLSNShmemInit().
struct WaitLSNState* waitLSNState = NULL |
Definition at line 37 of file waitlsn.c.
Referenced by addLSNWaiter(), deleteLSNWaiter(), PerformWalRecovery(), updateMinWaitedLSN(), WaitForLSNReplay(), WaitLSNCleanup(), WaitLSNSetLatches(), and WaitLSNShmemInit().