Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8bb8db

Browse files
committed
More synchronous replication tweaks.
SyncRepRequested() must check not only the value of thesynchronous_replication GUC but also whether max_wal_senders > 0.Otherwise, we might end up waiting for sync rep even when there's nopossibility of a standby ever managing to connect. There are someexisting 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 thensubsequent 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_replicationGUC to match the name of the GUC itself, for clarity.Report by Fujii Masao, though I didn't use his patch.
1 parente397d2e commitb8bb8db

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

‎src/backend/replication/syncrep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
#include"utils/ps_status.h"
6363

6464
/* User-settable parameters for sync rep */
65-
boolsync_rep_mode= false;/* Only set in user backends */
65+
boolsynchronous_replication= false;/* Only set in user backends */
6666
char*SyncRepStandbyNames;
6767

6868
staticboolsync_standbys_defined= false;/* Is there at least one name? */

‎src/backend/utils/misc/guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ static struct config_bool ConfigureNamesBool[] =
759759
gettext_noop("Requests synchronous replication."),
760760
NULL
761761
},
762-
&sync_rep_mode,
762+
&synchronous_replication,
763763
false,NULL,NULL
764764
},
765765
{

‎src/include/replication/syncrep.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#include"storage/spin.h"
2020
#include"utils/guc.h"
2121

22-
#defineSyncRepRequested()(sync_rep_mode)
22+
#defineSyncRepRequested() \
23+
(synchronous_replication && max_wal_senders > 0)
2324

2425
/* syncRepState */
2526
#defineSYNC_REP_NOT_WAITING0
@@ -28,7 +29,7 @@
2829
#defineSYNC_REP_MUST_DISCONNECT3
2930

3031
/* user-settable parameters for synchronous replication */
31-
externboolsync_rep_mode;
32+
externboolsynchronous_replication;
3233
externchar*SyncRepStandbyNames;
3334

3435
/* called by user backend */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp