ae405be9

By: Tom Sydney Kerckhove <syd@cs-syd.eu>

Stop waiting for a spread checkpoint, and start the standby on demand

Two things made a replica cost far more than taking a copy should.

pg_basebackup waits for a checkpoint, and by default that checkpoint is
spread over the checkpoint interval rather than taken at once. The wait is
proportional to how busy the server is, and a server a standby is taken
from is busy by definition: a suite is running against it. Asking for the
checkpoint immediately is what --checkpoint=fast is for. This package's
own suite goes from 78 seconds to a little over one.

The standby was also started whether or not anything read from it. A
suite that never touches its replica paid for one anyway, which is
invisible amortised over a suite and is the whole cost under mutation
testing, where the suite is rerun once per mutant and each run would take
a base backup to serve tests that never look at it. So replicatedDBStandby
became an IO Standby, started by the first test that asks and by nothing
else, and the bracket became an acquire/release pair so it could be.

StandbySpec asks the primary what is streaming from it: nothing until
something asks for a standby, and the same standby however often it is
asked for after that.
forwardCompatibilitymutation-dead-disablemutation-manifest-examplemutation-sydtest-mutation-examplemutation-sydtest-mutation-example-crosspre-commitreleaseshellconfiguredevShelldefaultmutation-sydtest-mutation-example-diffrelease-to-hackagex86_64-linux