summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-04-04 16:13:01 -0400
committerRobert Haas <rhaas@postgresql.org>2011-04-04 16:25:52 -0400
commit240067b3b0ff989d2b28f4f917f7958f2ec76b05 (patch)
tree385e0e13abda1024fc6a5cd8a81583a3a86366bd /src/include
parentfc3459d70c5d842fe6519522649c8a47454f25bb (diff)
Merge synchronous_replication setting into synchronous_commit.
This means one less thing to configure when setting up synchronous replication, and also avoids some ambiguity around what the behavior should be when the settings of these variables conflict. Fujii Masao, with additional hacking by me.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/xact.h11
-rw-r--r--src/include/replication/syncrep.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 1685a0167f5..44101453445 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -52,8 +52,15 @@ extern bool XactReadOnly;
extern bool DefaultXactDeferrable;
extern bool XactDeferrable;
-/* Asynchronous commits */
-extern bool XactSyncCommit;
+typedef enum
+{
+ SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */
+ SYNCHRONOUS_COMMIT_LOCAL, /* wait for only local flush */
+ SYNCHRONOUS_COMMIT_ON /* wait for local flush and sync rep */
+} SyncCommitLevel;
+
+/* Synchronous commit level */
+extern int synchronous_commit;
/* Kluge for 2PC support */
extern bool MyXactAccessedTempRel;
diff --git a/src/include/replication/syncrep.h b/src/include/replication/syncrep.h
index 188ec65745c..696edccb120 100644
--- a/src/include/replication/syncrep.h
+++ b/src/include/replication/syncrep.h
@@ -20,7 +20,7 @@
#include "utils/guc.h"
#define SyncRepRequested() \
- (synchronous_replication && max_wal_senders > 0)
+ (max_wal_senders > 0 && synchronous_commit == SYNCHRONOUS_COMMIT_ON)
/* syncRepState */
#define SYNC_REP_NOT_WAITING 0
@@ -28,7 +28,6 @@
#define SYNC_REP_WAIT_COMPLETE 2
/* user-settable parameters for synchronous replication */
-extern bool synchronous_replication;
extern char *SyncRepStandbyNames;
/* called by user backend */