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 "postmaster/startup.h"
#include "replication/walreceiver.h"
#include "storage/pmsignal.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 38 of file walreceiverfuncs.c.
Referenced by WalRcvRunning(), and WalRcvStreaming().
int GetReplicationApplyDelay | ( | void | ) |
Definition at line 349 of file walreceiverfuncs.c.
References WalRcvData::flushedUpto, GetCurrentChunkReplayStartTime(), GetCurrentTimestamp(), GetXLogReplayRecPtr(), WalRcvData::mutex, SpinLockAcquire, SpinLockRelease, TimestampDifferenceMilliseconds(), and WalRcv.
Referenced by ProcessWalSndrMessage(), and walrcv_clear_result().
int GetReplicationTransferLatency | ( | void | ) |
Definition at line 379 of file walreceiverfuncs.c.
References WalRcvData::lastMsgReceiptTime, WalRcvData::lastMsgSendTime, WalRcvData::mutex, SpinLockAcquire, SpinLockRelease, TimestampDifferenceMilliseconds(), and WalRcv.
Referenced by ProcessWalSndrMessage(), and walrcv_clear_result().
XLogRecPtr GetWalRcvFlushRecPtr | ( | XLogRecPtr * | latestChunkStart, |
TimeLineID * | receiveTLI | ||
) |
Definition at line 316 of file walreceiverfuncs.c.
References WalRcvData::flushedUpto, WalRcvData::latestChunkStart, WalRcvData::mutex, WalRcvData::receivedTLI, SpinLockAcquire, SpinLockRelease, and WalRcv.
Referenced by CreateRestartPoint(), GetStandbyFlushRecPtr(), pg_last_wal_receive_lsn(), WaitForWALToBecomeAvailable(), and walrcv_clear_result().
XLogRecPtr GetWalRcvWriteRecPtr | ( | void | ) |
Definition at line 337 of file walreceiverfuncs.c.
References pg_atomic_read_u64(), WalRcv, and WalRcvData::writtenUpto.
Referenced by walrcv_clear_result().
void RequestXLogStreaming | ( | TimeLineID | tli, |
XLogRecPtr | recptr, | ||
const char * | conninfo, | ||
const char * | slotname, | ||
bool | create_temp_slot | ||
) |
Definition at line 230 of file walreceiverfuncs.c.
References Assert, WalRcvData::conninfo, WalRcvData::flushedUpto, WalRcvData::is_temp_slot, WalRcvData::latch, WalRcvData::latestChunkStart, MAXCONNINFO, WalRcvData::mutex, NAMEDATALEN, now(), PMSIGNAL_START_WALRECEIVER, 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(), and walrcv_clear_result().
void ShutdownWalRcv | ( | void | ) |
Definition at line 164 of file walreceiverfuncs.c.
References HandleStartupProcInterrupts(), kill, WalRcvData::mutex, pg_usleep(), WalRcvData::pid, SpinLockAcquire, SpinLockRelease, WalRcv, WALRCV_RESTARTING, WALRCV_STARTING, WALRCV_STOPPED, WALRCV_STOPPING, WALRCV_STREAMING, WALRCV_WAITING, WalRcvRunning(), and WalRcvData::walRcvState.
Referenced by StartupXLOG(), WaitForWALToBecomeAvailable(), and walrcv_clear_result().
bool WalRcvRunning | ( | void | ) |
Definition at line 73 of file walreceiverfuncs.c.
References WalRcvData::mutex, now(), SpinLockAcquire, SpinLockRelease, WalRcvData::startTime, WalRcv, WALRCV_STARTING, WALRCV_STARTUP_TIMEOUT, WALRCV_STOPPED, and WalRcvData::walRcvState.
Referenced by ShutdownWalRcv(), StartupRequestWalReceiverRestart(), and walrcv_clear_result().
void WalRcvShmemInit | ( | void | ) |
Definition at line 53 of file walreceiverfuncs.c.
References WalRcvData::latch, MemSet, WalRcvData::mutex, pg_atomic_init_u64(), ShmemInitStruct(), SpinLockInit, WALRCV_STOPPED, WalRcvShmemSize(), WalRcvData::walRcvState, and WalRcvData::writtenUpto.
Referenced by CreateSharedMemoryAndSemaphores(), and walrcv_clear_result().
Size WalRcvShmemSize | ( | void | ) |
Definition at line 42 of file walreceiverfuncs.c.
References add_size().
Referenced by CreateSharedMemoryAndSemaphores(), walrcv_clear_result(), and WalRcvShmemInit().
bool WalRcvStreaming | ( | void | ) |
Definition at line 118 of file walreceiverfuncs.c.
References WalRcvData::mutex, now(), SpinLockAcquire, SpinLockRelease, WalRcvData::startTime, WalRcv, WALRCV_RESTARTING, WALRCV_STARTING, WALRCV_STARTUP_TIMEOUT, WALRCV_STOPPED, WALRCV_STREAMING, and WalRcvData::walRcvState.
Referenced by StartupXLOG(), WaitForWALToBecomeAvailable(), and walrcv_clear_result().
WalRcvData* WalRcv = NULL |
Definition at line 32 of file walreceiverfuncs.c.
Referenced by GetReplicationApplyDelay(), GetReplicationTransferLatency(), GetWalRcvFlushRecPtr(), GetWalRcvWriteRecPtr(), pg_stat_get_wal_receiver(), ProcessWalSndrMessage(), RequestXLogStreaming(), ShutdownWalRcv(), WalRcvDie(), WalRcvForceReply(), WalRcvRunning(), WalRcvStreaming(), WalRcvWaitForStartPosition(), WalReceiverMain(), XLogWalRcvFlush(), and XLogWalRcvWrite().