1 | /*------------------------------------------------------------------------- |
2 | * |
3 | * walsender.h |
4 | * Exports from replication/walsender.c. |
5 | * |
6 | * Portions Copyright (c) 2010-2019, 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 | { |
24 | CRS_EXPORT_SNAPSHOT, |
25 | CRS_NOEXPORT_SNAPSHOT, |
26 | CRS_USE_SNAPSHOT |
27 | } ; |
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 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 | #define WalSndWakeupProcessRequests() \ |
65 | do \ |
66 | { \ |
67 | if (wake_wal_senders) \ |
68 | { \ |
69 | wake_wal_senders = false; \ |
70 | if (max_wal_senders > 0) \ |
71 | WalSndWakeup(); \ |
72 | } \ |
73 | } while (0) |
74 | |
75 | #endif /* _WALSENDER_H */ |
76 | |