12 #ifndef _WALRECEIVER_H
13 #define _WALRECEIVER_H
38 #define MAXCONNINFO 1024
41 #define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
119 char sender_host[NI_MAXHOST];
244 bool must_use_password,
254 bool must_use_password);
290 typedef char *(*walrcv_get_dbname_from_conninfo_fn) (
const char *conninfo);
365 const char *slotname,
379 const char *slotname,
380 const bool *failover,
402 const Oid *retTypes);
434 #define walrcv_connect(conninfo, replication, logical, must_use_password, appname, err) \
435 WalReceiverFunctions->walrcv_connect(conninfo, replication, logical, must_use_password, appname, err)
436 #define walrcv_check_conninfo(conninfo, must_use_password) \
437 WalReceiverFunctions->walrcv_check_conninfo(conninfo, must_use_password)
438 #define walrcv_get_conninfo(conn) \
439 WalReceiverFunctions->walrcv_get_conninfo(conn)
440 #define walrcv_get_senderinfo(conn, sender_host, sender_port) \
441 WalReceiverFunctions->walrcv_get_senderinfo(conn, sender_host, sender_port)
442 #define walrcv_identify_system(conn, primary_tli) \
443 WalReceiverFunctions->walrcv_identify_system(conn, primary_tli)
444 #define walrcv_get_dbname_from_conninfo(conninfo) \
445 WalReceiverFunctions->walrcv_get_dbname_from_conninfo(conninfo)
446 #define walrcv_server_version(conn) \
447 WalReceiverFunctions->walrcv_server_version(conn)
448 #define walrcv_readtimelinehistoryfile(conn, tli, filename, content, size) \
449 WalReceiverFunctions->walrcv_readtimelinehistoryfile(conn, tli, filename, content, size)
450 #define walrcv_startstreaming(conn, options) \
451 WalReceiverFunctions->walrcv_startstreaming(conn, options)
452 #define walrcv_endstreaming(conn, next_tli) \
453 WalReceiverFunctions->walrcv_endstreaming(conn, next_tli)
454 #define walrcv_receive(conn, buffer, wait_fd) \
455 WalReceiverFunctions->walrcv_receive(conn, buffer, wait_fd)
456 #define walrcv_send(conn, buffer, nbytes) \
457 WalReceiverFunctions->walrcv_send(conn, buffer, nbytes)
458 #define walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn) \
459 WalReceiverFunctions->walrcv_create_slot(conn, slotname, temporary, two_phase, failover, snapshot_action, lsn)
460 #define walrcv_alter_slot(conn, slotname, failover, two_phase) \
461 WalReceiverFunctions->walrcv_alter_slot(conn, slotname, failover, two_phase)
462 #define walrcv_get_backend_pid(conn) \
463 WalReceiverFunctions->walrcv_get_backend_pid(conn)
464 #define walrcv_exec(conn, exec, nRetTypes, retTypes) \
465 WalReceiverFunctions->walrcv_exec(conn, exec, nRetTypes, retTypes)
466 #define walrcv_disconnect(conn) \
467 WalReceiverFunctions->walrcv_disconnect(conn)
499 const char *conninfo,
const char *slotname,
500 bool create_temp_slot);
#define pg_attribute_noreturn()
void err(int eval, const char *fmt,...)
void pfree(void *pointer)
static pg_noinline void Size size
TimestampTz lastMsgReceiptTime
TimeLineID receiveStartTLI
XLogRecPtr latestChunkStart
ConditionVariable walRcvStoppedCV
pg_atomic_uint64 writtenUpto
TimestampTz lastMsgSendTime
TimestampTz latestWalEndTime
Tuplestorestate * tuplestore
walrcv_identify_system_fn walrcv_identify_system
walrcv_receive_fn walrcv_receive
walrcv_server_version_fn walrcv_server_version
walrcv_disconnect_fn walrcv_disconnect
walrcv_get_backend_pid_fn walrcv_get_backend_pid
walrcv_connect_fn walrcv_connect
walrcv_get_dbname_from_conninfo_fn walrcv_get_dbname_from_conninfo
walrcv_get_senderinfo_fn walrcv_get_senderinfo
walrcv_check_conninfo_fn walrcv_check_conninfo
walrcv_send_fn walrcv_send
walrcv_get_conninfo_fn walrcv_get_conninfo
walrcv_exec_fn walrcv_exec
walrcv_startstreaming_fn walrcv_startstreaming
walrcv_create_slot_fn walrcv_create_slot
walrcv_readtimelinehistoryfile_fn walrcv_readtimelinehistoryfile
walrcv_alter_slot_fn walrcv_alter_slot
walrcv_endstreaming_fn walrcv_endstreaming
void FreeTupleDesc(TupleDesc tupdesc)
void tuplestore_end(Tuplestorestate *state)
WalRcvExecResult *(* walrcv_exec_fn)(WalReceiverConn *conn, const char *query, const int nRetTypes, const Oid *retTypes)
void ProcessWalRcvInterrupts(void)
XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI)
char *(* walrcv_create_slot_fn)(WalReceiverConn *conn, const char *slotname, bool temporary, bool two_phase, bool failover, CRSSnapshotAction snapshot_action, XLogRecPtr *lsn)
char *(* walrcv_get_dbname_from_conninfo_fn)(const char *conninfo)
void(* walrcv_endstreaming_fn)(WalReceiverConn *conn, TimeLineID *next_tli)
bool WalRcvStreaming(void)
struct WalRcvExecResult WalRcvExecResult
void(* walrcv_send_fn)(WalReceiverConn *conn, const char *buffer, int nbytes)
void RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo, const char *slotname, bool create_temp_slot)
PGDLLIMPORT int wal_receiver_status_interval
char *(* walrcv_get_conninfo_fn)(WalReceiverConn *conn)
char *(* walrcv_identify_system_fn)(WalReceiverConn *conn, TimeLineID *primary_tli)
pid_t(* walrcv_get_backend_pid_fn)(WalReceiverConn *conn)
void WalReceiverMain(char *startup_data, size_t startup_data_len) pg_attribute_noreturn()
XLogRecPtr GetWalRcvWriteRecPtr(void)
void ShutdownWalRcv(void)
bool(* walrcv_startstreaming_fn)(WalReceiverConn *conn, const WalRcvStreamOptions *options)
int(* walrcv_receive_fn)(WalReceiverConn *conn, char **buffer, pgsocket *wait_fd)
void(* walrcv_readtimelinehistoryfile_fn)(WalReceiverConn *conn, TimeLineID tli, char **filename, char **content, int *size)
PGDLLIMPORT int wal_receiver_timeout
static void walrcv_clear_result(WalRcvExecResult *walres)
void(* walrcv_check_conninfo_fn)(const char *conninfo, bool must_use_password)
PGDLLIMPORT WalReceiverFunctionsType * WalReceiverFunctions
void(* walrcv_disconnect_fn)(WalReceiverConn *conn)
struct WalReceiverFunctionsType WalReceiverFunctionsType
WalReceiverConn *(* walrcv_connect_fn)(const char *conninfo, bool replication, bool logical, bool must_use_password, const char *appname, char **err)
void(* walrcv_get_senderinfo_fn)(WalReceiverConn *conn, char **sender_host, int *sender_port)
int GetReplicationApplyDelay(void)
PGDLLIMPORT WalRcvData * WalRcv
void WalRcvShmemInit(void)
Size WalRcvShmemSize(void)
void(* walrcv_alter_slot_fn)(WalReceiverConn *conn, const char *slotname, const bool *failover, const bool *two_phase)
PGDLLIMPORT bool hot_standby_feedback
int(* walrcv_server_version_fn)(WalReceiverConn *conn)
void WalRcvForceReply(void)
int GetReplicationTransferLatency(void)
static TimeLineID receiveTLI