PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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-2017, 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 #include "fmgr.h"
18 
19 /*
20  * What to do with a snapshot in create replication slot command.
21  */
22 typedef enum
23 {
28 
29 /* global state */
30 extern bool am_walsender;
31 extern bool am_cascading_walsender;
32 extern bool am_db_walsender;
33 extern bool wake_wal_senders;
34 
35 /* user-settable parameters */
36 extern int max_wal_senders;
37 extern int wal_sender_timeout;
38 extern bool log_replication_commands;
39 
40 extern void InitWalSender(void);
41 extern bool exec_replication_command(const char *query_string);
42 extern void WalSndErrorCleanup(void);
43 extern void WalSndSignals(void);
44 extern Size WalSndShmemSize(void);
45 extern void WalSndShmemInit(void);
46 extern void WalSndWakeup(void);
47 extern void WalSndRqstFileReload(void);
48 
49 /*
50  * Remember that we want to wakeup walsenders later
51  *
52  * This is separated from doing the actual wakeup because the writeout is done
53  * while holding contended locks.
54  */
55 #define WalSndWakeupRequest() \
56  do { wake_wal_senders = true; } while (0)
57 
58 /*
59  * wakeup walsenders if there is work to be done
60  */
61 #define WalSndWakeupProcessRequests() \
62  do \
63  { \
64  if (wake_wal_senders) \
65  { \
66  wake_wal_senders = false; \
67  if (max_wal_senders > 0) \
68  WalSndWakeup(); \
69  } \
70  } while (0)
71 
72 #endif /* _WALSENDER_H */
void WalSndSignals(void)
Definition: walsender.c:2860
bool log_replication_commands
Definition: walsender.c:117
void WalSndRqstFileReload(void)
Definition: walsender.c:2796
bool am_db_walsender
Definition: walsender.c:111
bool exec_replication_command(const char *query_string)
Definition: walsender.c:1364
int max_wal_senders
Definition: walsender.c:114
bool am_cascading_walsender
Definition: walsender.c:109
int wal_sender_timeout
Definition: walsender.c:115
void InitWalSender(void)
void WalSndShmemInit(void)
Definition: walsender.c:2896
bool wake_wal_senders
Definition: walsender.c:122
void WalSndWakeup(void)
Definition: walsender.c:2928
size_t Size
Definition: c.h:356
Size WalSndShmemSize(void)
Definition: walsender.c:2884
void WalSndErrorCleanup(void)
Definition: walsender.c:284
CRSSnapshotAction
Definition: walsender.h:22
bool am_walsender
Definition: walsender.c:108