diff options
| author | Simon Riggs | 2011-03-06 22:49:16 +0000 |
|---|---|---|
| committer | Simon Riggs | 2011-03-06 22:49:16 +0000 |
| commit | a8a8a3e0965201df88bdfdff08f50e5c06c552b7 (patch) | |
| tree | c29687748fa9d5e9bc335e11bf3d8446563184c3 /src/include/replication | |
| parent | 149b2673c244b92b59411dd2292d6ddcfb03d5d4 (diff) | |
Efficient transaction-controlled synchronous replication.
If a standby is broadcasting reply messages and we have named
one or more standbys in synchronous_standby_names then allow
users who set synchronous_replication to wait for commit, which
then provides strict data integrity guarantees. Design avoids
sending and receiving transaction state information so minimises
bookkeeping overheads. We synchronize with the highest priority
standby that is connected and ready to synchronize. Other standbys
can be defined to takeover in case of standby failure.
This version has very strict behaviour; more relaxed options
may be added at a later date.
Simon Riggs and Fujii Masao, with reviews by Yeb Havinga, Jaime
Casanova, Heikki Linnakangas and Robert Haas, plus the assistance
of many other design reviewers.
Diffstat (limited to 'src/include/replication')
| -rw-r--r-- | src/include/replication/walsender.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/replication/walsender.h b/src/include/replication/walsender.h index 5843307c9d..8a8c9398d1 100644 --- a/src/include/replication/walsender.h +++ b/src/include/replication/walsender.h @@ -15,6 +15,7 @@ #include "access/xlog.h" #include "nodes/nodes.h" #include "storage/latch.h" +#include "replication/syncrep.h" #include "storage/spin.h" @@ -52,11 +53,32 @@ typedef struct WalSnd * to do. */ Latch latch; + + /* + * The priority order of the standby managed by this WALSender, as + * listed in synchronous_standby_names, or 0 if not-listed. + * Protected by SyncRepLock. + */ + int sync_standby_priority; } WalSnd; +extern WalSnd *MyWalSnd; + /* There is one WalSndCtl struct for the whole database cluster */ typedef struct { + /* + * Synchronous replication queue. Protected by SyncRepLock. + */ + SHM_QUEUE SyncRepQueue; + + /* + * Current location of the head of the queue. All waiters should have + * a waitLSN that follows this value, or they are currently being woken + * to remove themselves from the queue. Protected by SyncRepLock. + */ + XLogRecPtr lsn; + WalSnd walsnds[1]; /* VARIABLE LENGTH ARRAY */ } WalSndCtlData; |
