1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

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.
This commit is contained in:
Robert Haas
2011-03-10 15:38:39 -05:00
parent e397d2ee64
commit b8bb8dbf20
3 changed files with 5 additions and 4 deletions

View File

@@ -62,7 +62,7 @@
#include "utils/ps_status.h"
/* User-settable parameters for sync rep */
bool sync_rep_mode = false; /* Only set in user backends */
bool synchronous_replication = false; /* Only set in user backends */
char *SyncRepStandbyNames;
static bool sync_standbys_defined = false; /* Is there at least one name? */