summaryrefslogtreecommitdiff
path: root/src/include/storage/proc.h
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2011-03-06 22:49:16 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2011-03-06 22:49:16 +0000
commita8a8a3e0965201df88bdfdff08f50e5c06c552b7 (patch)
treec29687748fa9d5e9bc335e11bf3d8446563184c3 /src/include/storage/proc.h
parent149b2673c244b92b59411dd2292d6ddcfb03d5d4 (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/storage/proc.h')
-rw-r--r--src/include/storage/proc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index 78dbadef4cf..1d6642c6c7b 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -14,6 +14,9 @@
#ifndef _PROC_H_
#define _PROC_H_
+#include "access/xlog.h"
+#include "replication/syncrep.h"
+#include "storage/latch.h"
#include "storage/lock.h"
#include "storage/pg_sema.h"
#include "utils/timestamp.h"
@@ -116,6 +119,17 @@ struct PGPROC
* lock object by this backend */
/*
+ * Info to allow us to wait for synchronous replication, if needed.
+ * waitLSN is InvalidXLogRecPtr if not waiting; set only by user backend.
+ * syncRepState must not be touched except by owning process or WALSender.
+ * syncRep_links used only while holding SyncRepLock.
+ */
+ Latch waitLatch; /* allow us to wait for sync rep */
+ XLogRecPtr waitLSN; /* waiting for this LSN or higher */
+ int syncRepState; /* wait state for sync rep */
+ SHM_QUEUE syncRepLinks; /* list link if process is in syncrep queue */
+
+ /*
* All PROCLOCK objects for locks held or awaited by this backend are
* linked into one of these lists, according to the partition number of
* their lock.