Improve stability of TAP test for synchronous replication
authorMichael Paquier <michael@paquier.xyz>
Wed, 24 Jul 2019 01:54:26 +0000 (10:54 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 24 Jul 2019 01:54:26 +0000 (10:54 +0900)
commitca553394b2efcf0a551b1fe2ae82a1515f90f2cb
tree208ae1aba93b89d8aae12a116e2d5958bf289eb0
parentec7f9a7407d3f6e0d27033b026bcb966eebe8e71
Improve stability of TAP test for synchronous replication

Slow buildfarm machines have run into issues with this TAP test caused
by a race condition related to the startup of a set of standbys, where
it is possible to finish with an unexpected order in the WAL sender
array of the primary.

This closes the race condition by making sure that any standby started
is registered into the WAL sender array of the primary before starting
the next one based on lookups of pg_stat_replication.

Backpatch down to 9.6 where the test has been introduced.

Author: Michael Paquier
Reviewed-by: Álvaro Herrera, Noah Misch
Discussion: https://postgr.es/m/20190617055145.GB18917@paquier.xyz
Backpatch-through: 9.6
src/test/recovery/t/007_sync_rep.pl