Header And Logo

PostgreSQL
| The world's most advanced open source database.

walsender.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * walsender.h
00004  *    Exports from replication/walsender.c.
00005  *
00006  * Portions Copyright (c) 2010-2013, PostgreSQL Global Development Group
00007  *
00008  * src/include/replication/walsender.h
00009  *
00010  *-------------------------------------------------------------------------
00011  */
00012 #ifndef _WALSENDER_H
00013 #define _WALSENDER_H
00014 
00015 #include <signal.h>
00016 
00017 #include "fmgr.h"
00018 
00019 /* global state */
00020 extern bool am_walsender;
00021 extern bool am_cascading_walsender;
00022 extern bool wake_wal_senders;
00023 
00024 /* user-settable parameters */
00025 extern int  max_wal_senders;
00026 extern int  wal_sender_timeout;
00027 
00028 extern void InitWalSender(void);
00029 extern void exec_replication_command(const char *query_string);
00030 extern void WalSndErrorCleanup(void);
00031 extern void WalSndSignals(void);
00032 extern Size WalSndShmemSize(void);
00033 extern void WalSndShmemInit(void);
00034 extern void WalSndWakeup(void);
00035 extern void WalSndRqstFileReload(void);
00036 
00037 extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS);
00038 
00039 /*
00040  * Remember that we want to wakeup walsenders later
00041  *
00042  * This is separated from doing the actual wakeup because the writeout is done
00043  * while holding contended locks.
00044  */
00045 #define WalSndWakeupRequest() \
00046     do { wake_wal_senders = true; } while (0)
00047 
00048 /*
00049  * wakeup walsenders if there is work to be done
00050  */
00051 #define WalSndWakeupProcessRequests()       \
00052     do                                      \
00053     {                                       \
00054         if (wake_wal_senders)               \
00055         {                                   \
00056             wake_wal_senders = false;       \
00057             if (max_wal_senders > 0)        \
00058                 WalSndWakeup();             \
00059         }                                   \
00060     } while (0)
00061 
00062 #endif   /* _WALSENDER_H */