PostgreSQL Source Code  git master
walsender.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * walsender.h
4  * Exports from replication/walsender.c.
5  *
6  * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group
7  *
8  * src/include/replication/walsender.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef _WALSENDER_H
13 #define _WALSENDER_H
14 
15 #include "access/xlogdefs.h"
16 
17 /*
18  * What to do with a snapshot in create replication slot command.
19  */
20 typedef enum
21 {
26 
27 /* global state */
28 extern PGDLLIMPORT bool am_walsender;
30 extern PGDLLIMPORT bool am_db_walsender;
31 extern PGDLLIMPORT bool wake_wal_senders;
32 
33 /* user-settable parameters */
34 extern PGDLLIMPORT int max_wal_senders;
37 
38 extern void InitWalSender(void);
39 extern bool exec_replication_command(const char *cmd_string);
40 extern void WalSndErrorCleanup(void);
41 extern void PhysicalWakeupLogicalWalSnd(void);
43 extern void WalSndSignals(void);
44 extern Size WalSndShmemSize(void);
45 extern void WalSndShmemInit(void);
46 extern void WalSndWakeup(bool physical, bool logical);
47 extern void WalSndInitStopping(void);
48 extern void WalSndWaitStopping(void);
49 extern void HandleWalSndInitStopping(void);
50 extern void WalSndRqstFileReload(void);
51 
52 /*
53  * Remember that we want to wakeup walsenders later
54  *
55  * This is separated from doing the actual wakeup because the writeout is done
56  * while holding contended locks.
57  */
58 #define WalSndWakeupRequest() \
59  do { wake_wal_senders = true; } while (0)
60 
61 /*
62  * wakeup walsenders if there is work to be done
63  */
64 static inline void
65 WalSndWakeupProcessRequests(bool physical, bool logical)
66 {
67  if (wake_wal_senders)
68  {
69  wake_wal_senders = false;
70  if (max_wal_senders > 0)
71  WalSndWakeup(physical, logical);
72  }
73 }
74 
75 #endif /* _WALSENDER_H */
#define PGDLLIMPORT
Definition: c.h:1295
size_t Size
Definition: c.h:584
PGDLLIMPORT bool wake_wal_senders
Definition: walsender.c:130
void PhysicalWakeupLogicalWalSnd(void)
Definition: walsender.c:1708
void WalSndErrorCleanup(void)
Definition: walsender.c:325
PGDLLIMPORT bool am_cascading_walsender
Definition: walsender.c:116
void WalSndWakeup(bool physical, bool logical)
Definition: walsender.c:3638
void WalSndShmemInit(void)
Definition: walsender.c:3593
PGDLLIMPORT bool am_db_walsender
Definition: walsender.c:118
bool exec_replication_command(const char *cmd_string)
Definition: walsender.c:1952
void InitWalSender(void)
static void WalSndWakeupProcessRequests(bool physical, bool logical)
Definition: walsender.h:65
void WalSndInitStopping(void)
Definition: walsender.c:3717
void WalSndWaitStopping(void)
Definition: walsender.c:3743
PGDLLIMPORT int max_wal_senders
Definition: walsender.c:121
PGDLLIMPORT bool log_replication_commands
Definition: walsender.c:125
void WalSndRqstFileReload(void)
Definition: walsender.c:3509
Size WalSndShmemSize(void)
Definition: walsender.c:3581
void HandleWalSndInitStopping(void)
Definition: walsender.c:3532
PGDLLIMPORT int wal_sender_timeout
Definition: walsender.c:123
PGDLLIMPORT bool am_walsender
Definition: walsender.c:115
void WalSndSignals(void)
Definition: walsender.c:3562
CRSSnapshotAction
Definition: walsender.h:21
@ CRS_USE_SNAPSHOT
Definition: walsender.h:24
@ CRS_NOEXPORT_SNAPSHOT
Definition: walsender.h:23
@ CRS_EXPORT_SNAPSHOT
Definition: walsender.h:22
XLogRecPtr GetStandbyFlushRecPtr(TimeLineID *tli)
Definition: walsender.c:3476
uint64 XLogRecPtr
Definition: xlogdefs.h:21
uint32 TimeLineID
Definition: xlogdefs.h:59