bool log_checkpoints = false;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_MINIMAL;
+int replication_mode = REPLICATION_MODE_ASYNC;
#ifdef WAL_DEBUG
bool XLOG_DEBUG = false;
{NULL, 0, false}
};
+const struct config_enum_entry replication_mode_options[] = {
+ {"async", REPLICATION_MODE_ASYNC, false},
+ {"recv", REPLICATION_MODE_RECV, false},
+ {"fsync", REPLICATION_MODE_FSYNC, false},
+ {"apply", REPLICATION_MODE_APPLY, false},
+ {NULL, 0, false}
+};
+
const struct config_enum_entry sync_method_options[] = {
{"fsync", SYNC_METHOD_FSYNC, false},
#ifdef HAVE_FSYNC_WRITETHROUGH
* Options for enum values stored in other modules
*/
extern const struct config_enum_entry wal_level_options[];
+extern const struct config_enum_entry replication_mode_options[];
extern const struct config_enum_entry sync_method_options[];
/*
},
{
+ {"replication_mode", PGC_POSTMASTER, WAL_STANDBY_SERVERS,
+ gettext_noop("Set the synchronization mode of replication."),
+ NULL
+ },
+ &replication_mode,
+ REPLICATION_MODE_ASYNC, replication_mode_options, NULL
+ },
+
+ {
{"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS,
gettext_noop("Selects the method used for forcing WAL updates to disk."),
NULL
#max_standby_streaming_delay = 30s # max delay before canceling queries
# when reading streaming WAL;
# -1 allows indefinite delay
+#replication_mode = async # async, recv, fsync, or apply
+ # (change requires restart)
#------------------------------------------------------------------------------
/* Do we need to WAL-log information required only for Hot Standby? */
#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
+/*
+ * Replication mode. This is used to identify how long transaction
+ * commit should wait for replication.
+ *
+ * REPLICATION_MODE_ASYNC doesn't make transaction commit wait for
+ * replication, i.e., asynchronous replication.
+ *
+ * REPLICATION_MODE_RECV makes transaction commit wait for XLOG
+ * records to be received on the standby.
+ *
+ * REPLICATION_MODE_FSYNC makes transaction commit wait for XLOG
+ * records to be received and fsync'd on the standby.
+ *
+ * REPLICATION_MODE_APPLY makes transaction commit wait for XLOG
+ * records to be received, fsync'd and applied on the standby.
+ */
+typedef enum ReplicationMode
+{
+ REPLICATION_MODE_ASYNC = 0,
+ REPLICATION_MODE_RECV,
+ REPLICATION_MODE_FSYNC,
+ REPLICATION_MODE_APPLY
+} ReplicationMode;
+extern int replication_mode;
+
#ifdef WAL_DEBUG
extern bool XLOG_DEBUG;
#endif