On 2019-Jun-18, Michael Paquier wrote: > On Mon, Jun 17, 2019 at 10:50:39AM -0400, Alvaro Herrera wrote: > > Hmm, this introduces a bit of latency: it waits for each standby to be > > fully up before initializing the next standby. Maybe it would be more > > convenient to split the primitives: keep the current one to start the > > standby, and add a separate one to wait for it to be registered. Then > > we could do > > standby1->start; > > standby2->start; > > standby3->start; > > foreach my $sby (@standbys) { > > $sby->wait_for_standby > > } > > It seems to me that this sequence could still lead to inconsistencies: > 1) standby 1 starts, reaches consistency so pg_ctl start -w exits. > 2) standby 2 starts, reaches consistency. > 3) standby 2 starts a WAL receiver, gets the first WAL sender slot of > the primary. > 4) standby 1 starts a WAL receiver, gets the second slot.
Ho ho .. you know what misled me into thinking that that would work? Just look at the name of the test that failed, "asterisk comes before another standby name". That doesn't seem to be what the test is testing! # poll_query_until timed out executing this query: # SELECT application_name, sync_priority, sync_state FROM pg_stat_replication ORDER BY application_name; # expecting this output: # standby1|1|sync # standby2|2|sync # standby3|2|potential # standby4|2|potential # last actual query output: # standby1|1|sync # standby2|2|potential # standby3|2|sync # standby4|2|potential # with stderr: # Failed test 'asterisk comes before another standby name' -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services