PostgreSQL Source Code git master
|
#include "postgres.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <signal.h>
#include "access/xlog_internal.h"
#include "access/xlogrecovery.h"
#include "pgstat.h"
#include "replication/walreceiver.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "storage/shmem.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Macros | |
#define | WALRCV_STARTUP_TIMEOUT 10 |
Functions | |
Size | WalRcvShmemSize (void) |
void | WalRcvShmemInit (void) |
bool | WalRcvRunning (void) |
bool | WalRcvStreaming (void) |
void | ShutdownWalRcv (void) |
void | RequestXLogStreaming (TimeLineID tli, XLogRecPtr recptr, const char *conninfo, const char *slotname, bool create_temp_slot) |
XLogRecPtr | GetWalRcvFlushRecPtr (XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI) |
XLogRecPtr | GetWalRcvWriteRecPtr (void) |
int | GetReplicationApplyDelay (void) |
int | GetReplicationTransferLatency (void) |
Variables | |
WalRcvData * | WalRcv = NULL |
#define WALRCV_STARTUP_TIMEOUT 10 |
Definition at line 40 of file walreceiverfuncs.c.
int GetReplicationApplyDelay | ( | void | ) |
Definition at line 365 of file walreceiverfuncs.c.
References WalRcvData::flushedUpto, GetCurrentChunkReplayStartTime(), GetCurrentTimestamp(), GetXLogReplayRecPtr(), WalRcvData::mutex, SpinLockAcquire, SpinLockRelease, TimestampDifferenceMilliseconds(), and WalRcv.
Referenced by ProcessWalSndrMessage().
int GetReplicationTransferLatency | ( | void | ) |
Definition at line 395 of file walreceiverfuncs.c.
References WalRcvData::lastMsgReceiptTime, WalRcvData::lastMsgSendTime, WalRcvData::mutex, SpinLockAcquire, SpinLockRelease, TimestampDifferenceMilliseconds(), and WalRcv.
Referenced by ProcessWalSndrMessage().
XLogRecPtr GetWalRcvFlushRecPtr | ( | XLogRecPtr * | latestChunkStart, |
TimeLineID * | receiveTLI | ||
) |
Definition at line 332 of file walreceiverfuncs.c.
References WalRcvData::flushedUpto, WalRcvData::latestChunkStart, WalRcvData::mutex, WalRcvData::receivedTLI, receiveTLI, SpinLockAcquire, SpinLockRelease, and WalRcv.
Referenced by CreateRestartPoint(), GetLatestLSN(), GetStandbyFlushRecPtr(), pg_last_wal_receive_lsn(), reserve_wal_for_local_slot(), and WaitForWALToBecomeAvailable().
XLogRecPtr GetWalRcvWriteRecPtr | ( | void | ) |
Definition at line 353 of file walreceiverfuncs.c.
References pg_atomic_read_u64(), WalRcv, and WalRcvData::writtenUpto.
void RequestXLogStreaming | ( | TimeLineID | tli, |
XLogRecPtr | recptr, | ||
const char * | conninfo, | ||
const char * | slotname, | ||
bool | create_temp_slot | ||
) |
Definition at line 246 of file walreceiverfuncs.c.
References Assert, WalRcvData::conninfo, WalRcvData::flushedUpto, GetPGProcByNumber, INVALID_PROC_NUMBER, WalRcvData::is_temp_slot, WalRcvData::latestChunkStart, MAXCONNINFO, WalRcvData::mutex, NAMEDATALEN, now(), PMSIGNAL_START_WALRECEIVER, WalRcvData::procno, WalRcvData::receivedTLI, WalRcvData::receiveStart, WalRcvData::receiveStartTLI, SendPostmasterSignal(), SetLatch(), WalRcvData::slotname, SpinLockAcquire, SpinLockRelease, WalRcvData::startTime, strlcpy(), wal_segment_size, WalRcv, WALRCV_RESTARTING, WALRCV_STARTING, WALRCV_STOPPED, WALRCV_WAITING, WalRcvData::walRcvState, and XLogSegmentOffset.
Referenced by WaitForWALToBecomeAvailable().
void ShutdownWalRcv | ( | void | ) |
Definition at line 179 of file walreceiverfuncs.c.
References ConditionVariableBroadcast(), ConditionVariableCancelSleep(), ConditionVariablePrepareToSleep(), ConditionVariableSleep(), kill, WalRcvData::mutex, WalRcvData::pid, SpinLockAcquire, SpinLockRelease, WalRcv, WALRCV_RESTARTING, WALRCV_STARTING, WALRCV_STOPPED, WALRCV_STOPPING, WALRCV_STREAMING, WALRCV_WAITING, WalRcvRunning(), WalRcvData::walRcvState, and WalRcvData::walRcvStoppedCV.
Referenced by XLogShutdownWalRcv().
bool WalRcvRunning | ( | void | ) |
Definition at line 76 of file walreceiverfuncs.c.
References ConditionVariableBroadcast(), WalRcvData::mutex, now(), SpinLockAcquire, SpinLockRelease, WalRcvData::startTime, WalRcv, WALRCV_STARTING, WALRCV_STARTUP_TIMEOUT, WALRCV_STOPPED, WalRcvData::walRcvState, and WalRcvData::walRcvStoppedCV.
Referenced by ShutdownWalRcv(), and StartupRequestWalReceiverRestart().
void WalRcvShmemInit | ( | void | ) |
Definition at line 55 of file walreceiverfuncs.c.
References ConditionVariableInit(), INVALID_PROC_NUMBER, MemSet, WalRcvData::mutex, pg_atomic_init_u64(), WalRcvData::procno, ShmemInitStruct(), SpinLockInit, WalRcv, WALRCV_STOPPED, WalRcvShmemSize(), WalRcvData::walRcvState, WalRcvData::walRcvStoppedCV, and WalRcvData::writtenUpto.
Referenced by CreateOrAttachShmemStructs().
Size WalRcvShmemSize | ( | void | ) |
Definition at line 44 of file walreceiverfuncs.c.
References add_size(), and size.
Referenced by CalculateShmemSize(), and WalRcvShmemInit().
bool WalRcvStreaming | ( | void | ) |
Definition at line 127 of file walreceiverfuncs.c.
References ConditionVariableBroadcast(), WalRcvData::mutex, now(), SpinLockAcquire, SpinLockRelease, WalRcvData::startTime, WalRcv, WALRCV_RESTARTING, WALRCV_STARTING, WALRCV_STARTUP_TIMEOUT, WALRCV_STOPPED, WALRCV_STREAMING, WalRcvData::walRcvState, and WalRcvData::walRcvStoppedCV.
Referenced by FinishWalRecovery(), and WaitForWALToBecomeAvailable().
WalRcvData* WalRcv = NULL |
Definition at line 34 of file walreceiverfuncs.c.
Referenced by GetReplicationApplyDelay(), GetReplicationTransferLatency(), GetWalRcvFlushRecPtr(), GetWalRcvWriteRecPtr(), pg_stat_get_wal_receiver(), ProcessWalSndrMessage(), RequestXLogStreaming(), ShutdownWalRcv(), WalRcvDie(), WalRcvForceReply(), WalRcvRunning(), WalRcvShmemInit(), WalRcvStreaming(), WalRcvWaitForStartPosition(), WalReceiverMain(), XLogWalRcvFlush(), and XLogWalRcvWrite().