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-2020, 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 <signal.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 bool am_walsender;
29 extern bool am_cascading_walsender;
30 extern bool am_db_walsender;
31 extern bool wake_wal_senders;
32 
33 /* user-settable parameters */
34 extern int max_wal_senders;
35 extern int wal_sender_timeout;
36 extern bool log_replication_commands;
37 
38 extern void InitWalSender(void);
39 extern bool exec_replication_command(const char *query_string);
40 extern void WalSndErrorCleanup(void);
41 extern void WalSndResourceCleanup(bool isCommit);
42 extern void WalSndSignals(void);
43 extern Size WalSndShmemSize(void);
44 extern void WalSndShmemInit(void);
45 extern void WalSndWakeup(void);
46 extern void WalSndInitStopping(void);
47 extern void WalSndWaitStopping(void);
48 extern void HandleWalSndInitStopping(void);
49 extern void WalSndRqstFileReload(void);
50 
51 /*
52  * Remember that we want to wakeup walsenders later
53  *
54  * This is separated from doing the actual wakeup because the writeout is done
55  * while holding contended locks.
56  */
57 #define WalSndWakeupRequest() \
58  do { wake_wal_senders = true; } while (0)
59 
60 /*
61  * wakeup walsenders if there is work to be done
62  */
63 #define WalSndWakeupProcessRequests() \
64  do \
65  { \
66  if (wake_wal_senders) \
67  { \
68  wake_wal_senders = false; \
69  if (max_wal_senders > 0) \
70  WalSndWakeup(); \
71  } \
72  } while (0)
73 
74 #endif /* _WALSENDER_H */
void WalSndSignals(void)
Definition: walsender.c:3056
bool log_replication_commands
Definition: walsender.c:125
void WalSndWaitStopping(void)
Definition: walsender.c:3174
void HandleWalSndInitStopping(void)
Definition: walsender.c:3022
void WalSndRqstFileReload(void)
Definition: walsender.c:2999
bool am_db_walsender
Definition: walsender.c:118
bool exec_replication_command(const char *query_string)
Definition: walsender.c:1512
void WalSndInitStopping(void)
Definition: walsender.c:3148
int max_wal_senders
Definition: walsender.c:121
bool am_cascading_walsender
Definition: walsender.c:116
int wal_sender_timeout
Definition: walsender.c:123
void InitWalSender(void)
void WalSndShmemInit(void)
Definition: walsender.c:3087
bool wake_wal_senders
Definition: walsender.c:130
void WalSndWakeup(void)
Definition: walsender.c:3119
size_t Size
Definition: c.h:473
Size WalSndShmemSize(void)
Definition: walsender.c:3075
void WalSndErrorCleanup(void)
Definition: walsender.c:295
CRSSnapshotAction
Definition: walsender.h:20
void WalSndResourceCleanup(bool isCommit)
Definition: walsender.c:330
bool am_walsender
Definition: walsender.c:115