Ensure that num_sync is greater than zero in synchronous_standby_names.
authorFujii Masao <fujii@postgresql.org>
Fri, 16 Dec 2016 17:20:59 +0000 (02:20 +0900)
committerFujii Masao <fujii@postgresql.org>
Fri, 16 Dec 2016 17:22:15 +0000 (02:22 +0900)
commit93eb619cd35b8adcfe6c86e34ea45d2e8edd322b
tree2ac7ad2e5e5ec4b1cd1124fec584660acb413e57
parent23c75b55aaccddea79545ffaf1cbfc9f1edeaa8c
Ensure that num_sync is greater than zero in synchronous_standby_names.

Previously num_sync could be set to zero and this setting caused
an assertion failure. This means that multiple synchronous standbys
code should assume that num_sync is greater than zero.
Also setting num_sync to zero is nonsense because it's basically
the configuration for synchronous replication. If users want not to
make transaction commits wait for any standbys,
synchronous_standby_names should be emptied to disable synchronous
replication instead of setting num_sync to zero.

This patch forbids users from setting num_sync to zero in
synchronous_standby_names. If zero is specified, an error will
happen during processing the parameter settings.

Back-patch to 9.6 where multiple synchronous standbys feature was added.

Patch by me. Reviewed by Tom Lane.
Discussion: <CAHGQGwHWB3izc6cXuFLh5kOcAbFXaRhhgwd-X5PeN9TEjxqXwg@mail.gmail.com>
src/backend/replication/syncrep.c