* if all to-be-deleted tables are temporary though, since they are lost
* anyway if we crash.)
*/
- if ((wrote_xlog && synchronous_commit >= SYNCHRONOUS_COMMIT_LOCAL) ||
+ if ((wrote_xlog && synchronous_commit > SYNCHRONOUS_COMMIT_OFF) ||
forceSyncCommit || nrels > 0)
{
/*
* if we are waiting for standbys to connect. This is important to
* ensure we aren't blocked from performing anti-wraparound tasks.
*/
- if (synchronous_commit == SYNCHRONOUS_COMMIT_ON)
+ if (synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
SetConfigOption("synchronous_commit", "local", PGC_SUSET, PGC_S_OVERRIDE);
/*
* accept all the likely variants of "on" and "off".
*/
static const struct config_enum_entry synchronous_commit_options[] = {
- {"local", SYNCHRONOUS_COMMIT_LOCAL, false},
+ {"local", SYNCHRONOUS_COMMIT_LOCAL_FLUSH, false},
{"on", SYNCHRONOUS_COMMIT_ON, false},
{"off", SYNCHRONOUS_COMMIT_OFF, false},
{"true", SYNCHRONOUS_COMMIT_ON, true},
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 */
+ SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */
+ SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */
+ SYNCHRONOUS_COMMIT_REMOTE_FLUSH /* wait for local and remote flush */
} SyncCommitLevel;
+/* Define the default setting for synchonous_commit */
+#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
+
/* Synchronous commit level */
extern int synchronous_commit;
#include "utils/guc.h"
#define SyncRepRequested() \
- (max_wal_senders > 0 && synchronous_commit == SYNCHRONOUS_COMMIT_ON)
+ (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
/* syncRepState */
#define SYNC_REP_NOT_WAITING 0