diff options
| author | Robert Haas | 2011-03-10 20:38:39 +0000 |
|---|---|---|
| committer | Robert Haas | 2011-03-10 20:43:37 +0000 |
| commit | b8bb8dbf20e13087f8e57ff4c42e81776ae5e545 (patch) | |
| tree | d36a6d8bedd1eeece5ee980f116c12698bd37648 /src/include/replication | |
| parent | e397d2ee6474865becb8f99ac28586736788f1f2 (diff) | |
More synchronous replication tweaks.
SyncRepRequested() must check not only the value of the
synchronous_replication GUC but also whether max_wal_senders > 0.
Otherwise, we might end up waiting for sync rep even when there's no
possibility of a standby ever managing to connect. There are some
existing cross-checks to prevent this, but they're not quite sufficient:
the user can start the server with max_wal_senders=0,
synchronous_standby_names='', and synchronous_replication=off and then
subsequent make synchronous_standby_names not empty using pg_ctl reload,
and then SET synchronous_standby=on, leading to an indefinite hang.
Along the way, rename the global variable for the synchronous_replication
GUC to match the name of the GUC itself, for clarity.
Report by Fujii Masao, though I didn't use his patch.
Diffstat (limited to 'src/include/replication')
| -rw-r--r-- | src/include/replication/syncrep.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/replication/syncrep.h b/src/include/replication/syncrep.h index 1c6d39238c4..9171eb61766 100644 --- a/src/include/replication/syncrep.h +++ b/src/include/replication/syncrep.h @@ -19,7 +19,8 @@ #include "storage/spin.h" #include "utils/guc.h" -#define SyncRepRequested() (sync_rep_mode) +#define SyncRepRequested() \ + (synchronous_replication && max_wal_senders > 0) /* syncRepState */ #define SYNC_REP_NOT_WAITING 0 @@ -28,7 +29,7 @@ #define SYNC_REP_MUST_DISCONNECT 3 /* user-settable parameters for synchronous replication */ -extern bool sync_rep_mode; +extern bool synchronous_replication; extern char *SyncRepStandbyNames; /* called by user backend */ |
