Skip to content

Commit d0cc433

Browse files
authored
Merge pull request ANXS#300 from gclough/sync_standby_v9.6_syntax
Updated synchronous_standby_names to be correct
2 parents 643e19a + 01293e1 commit d0cc433

8 files changed

+9
-8
lines changed

defaults/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ postgresql_track_commit_timestamp: off # (>= 9.5)
311311

312312
# standby servers that provide sync rep.
313313
# number of sync standbys (>= 9.6) and comma-separated list of application_name from standby(s)
314-
postgresql_synchronous_standby_num_sync: ""
314+
postgresql_synchronous_standby_num_sync: "" # >= 9.6 (NOTE: If you use the ANY/ALL syntax in v10, then note the new variable below)
315+
postgresql_synchronous_standby_choose_sync: "FIRST" # >= 10
315316
postgresql_synchronous_standby_names: [] # '*' means 'all'
316317

317318
# number of xacts by which cleanup is delayed

templates/postgresql.conf-10.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ track_commit_timestamp = {{'on' if postgresql_track_commit_timestamp else 'off'
251251

252252
# These settings are ignored on a standby server.
253253

254-
synchronous_standby_names = '{{postgresql_synchronous_standby_num_sync}}{% if postgresql_synchronous_standby_names != [] %} ({{postgresql_synchronous_standby_names|join(',')}}){% endif %}' # standby servers that provide sync rep
254+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}{% if postgresql_synchronous_standby_choose_sync != "" and postgresql_synchronous_standby_num_sync != "" %}{{ postgresql_synchronous_standby_choose_sync }} {% endif %}{% if postgresql_synchronous_standby_num_sync != "" %}{{ postgresql_synchronous_standby_num_sync }} ({% endif %}"{{ postgresql_synchronous_standby_names | join('\",\"') }}"{% if postgresql_synchronous_standby_num_sync != "" %}){% endif %}{% endif %}' # standby servers that provide sync rep
255255
# method to choose sync standbys, number of sync standbys,
256256
# and comma-separated list of application_name
257257
# from standby(s); '*' = all

templates/postgresql.conf-9.1.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ wal_sender_delay = {{postgresql_wal_sender_delay}} # walsender cycle time, 1-10
200200
wal_keep_segments = {{postgresql_wal_keep_segments}} # in logfile segments, 16MB each; 0 disables
201201
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed
202202
replication_timeout = {{postgresql_replication_timeout or postgresql_wal_sender_timeout}} # in milliseconds; 0 disables
203-
synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # standby servers that provide sync rep
203+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}"{{postgresql_synchronous_standby_names|join('\",\"')}}"{% endif %}' # standby servers that provide sync rep
204204
# comma-separated list of application_name
205205
# from standby(s); '*' = all
206206

templates/postgresql.conf-9.2.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ replication_timeout = {{postgresql_replication_timeout or postgresql_wal_sender_
216216

217217
# These settings are ignored on a standby server.
218218

219-
synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # standby servers that provide sync rep
219+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}"{{postgresql_synchronous_standby_names|join('\",\"')}}"{% endif %}' # standby servers that provide sync rep
220220
# comma-separated list of application_name
221221
# from standby(s); '*' = all
222222
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed

templates/postgresql.conf-9.3.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ wal_sender_timeout = {{postgresql_wal_sender_timeout}} # in milliseconds; 0 disa
217217

218218
# These settings are ignored on a standby server.
219219

220-
synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # standby servers that provide sync rep
220+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}"{{postgresql_synchronous_standby_names|join('\",\"')}}"{% endif %}' # standby servers that provide sync rep
221221
# comma-separated list of application_name
222222
# from standby(s); '*' = all
223223
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed

templates/postgresql.conf-9.4.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ max_replication_slots = {{postgresql_max_replication_slots}} # max number of rep
234234

235235
# These settings are ignored on a standby server.
236236

237-
synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # standby servers that provide sync rep
237+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}"{{postgresql_synchronous_standby_names|join('\",\"')}}"{% endif %}' # standby servers that provide sync rep
238238
# comma-separated list of application_name
239239
# from standby(s); '*' = all
240240
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed

templates/postgresql.conf-9.5.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ track_commit_timestamp = {{'on' if postgresql_track_commit_timestamp else 'off'
237237

238238
# These settings are ignored on a standby server.
239239

240-
synchronous_standby_names = '{{postgresql_synchronous_standby_names|join(',')}}' # standby servers that provide sync rep
240+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}"{{postgresql_synchronous_standby_names|join('\",\"')}}"{% endif %}' # standby servers that provide sync rep
241241
# comma-separated list of application_name
242242
# from standby(s); '*' = all
243243
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed

templates/postgresql.conf-9.6.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ track_commit_timestamp = {{'on' if postgresql_track_commit_timestamp else 'off'
244244

245245
# These settings are ignored on a standby server.
246246

247-
synchronous_standby_names = '{{postgresql_synchronous_standby_num_sync}}{% if postgresql_synchronous_standby_names != [] %} ({{postgresql_synchronous_standby_names|join(',')}}){% endif %}' # standby servers that provide sync rep
247+
synchronous_standby_names = '{% if postgresql_synchronous_standby_names != [] %}{% if postgresql_synchronous_standby_num_sync != "" %}{{ postgresql_synchronous_standby_num_sync }} ({% endif %}"{{ postgresql_synchronous_standby_names | join('\",\"') }}"{% if postgresql_synchronous_standby_num_sync != "" %}){% endif %}{% endif %}' # standby servers that provide sync rep
248248
# number of sync standbys and comma-separated list of application_name
249249
# from standby(s); '*' = all
250250
vacuum_defer_cleanup_age = {{postgresql_vacuum_defer_cleanup_age}} # number of xacts by which cleanup is delayed

0 commit comments

Comments
 (0)