2011-03-07 00:39:14 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* syncrep.h
|
|
|
|
* Exports from replication/syncrep.c.
|
|
|
|
*
|
2011-03-10 07:05:33 +01:00
|
|
|
* Portions Copyright (c) 2010-2011, PostgreSQL Global Development Group
|
2011-03-07 00:39:14 +01:00
|
|
|
*
|
2011-03-10 07:05:33 +01:00
|
|
|
* IDENTIFICATION
|
|
|
|
* src/include/replication/syncrep.h
|
2011-03-07 00:39:14 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef _SYNCREP_H
|
|
|
|
#define _SYNCREP_H
|
|
|
|
|
|
|
|
#include "access/xlog.h"
|
|
|
|
#include "storage/proc.h"
|
|
|
|
#include "storage/shmem.h"
|
|
|
|
#include "storage/spin.h"
|
|
|
|
#include "utils/guc.h"
|
|
|
|
|
2011-03-10 21:38:39 +01:00
|
|
|
#define SyncRepRequested() \
|
|
|
|
(synchronous_replication && max_wal_senders > 0)
|
2011-03-07 00:39:14 +01:00
|
|
|
|
|
|
|
/* syncRepState */
|
|
|
|
#define SYNC_REP_NOT_WAITING 0
|
|
|
|
#define SYNC_REP_WAITING 1
|
|
|
|
#define SYNC_REP_WAIT_COMPLETE 2
|
|
|
|
#define SYNC_REP_MUST_DISCONNECT 3
|
|
|
|
|
|
|
|
/* user-settable parameters for synchronous replication */
|
2011-03-10 21:38:39 +01:00
|
|
|
extern bool synchronous_replication;
|
2011-03-07 00:39:14 +01:00
|
|
|
extern char *SyncRepStandbyNames;
|
|
|
|
|
|
|
|
/* called by user backend */
|
|
|
|
extern void SyncRepWaitForLSN(XLogRecPtr XactCommitLSN);
|
|
|
|
|
|
|
|
/* callback at backend exit */
|
|
|
|
extern void SyncRepCleanupAtProcExit(int code, Datum arg);
|
|
|
|
|
|
|
|
/* called by wal sender */
|
|
|
|
extern void SyncRepInitConfig(void);
|
|
|
|
extern void SyncRepReleaseWaiters(void);
|
|
|
|
|
|
|
|
/* called by various procs */
|
|
|
|
extern int SyncRepWakeQueue(bool all);
|
2011-03-10 20:57:02 +01:00
|
|
|
extern const char *assign_synchronous_standby_names(const char *newval, bool doit, GucSource source);
|
2011-03-07 00:39:14 +01:00
|
|
|
|
|
|
|
#endif /* _SYNCREP_H */
|