Ignore recovery_min_apply_delay until recovery has reached consistent state
authorFujii Masao <fujii@postgresql.org>
Sat, 5 Mar 2016 17:29:04 +0000 (02:29 +0900)
committerFujii Masao <fujii@postgresql.org>
Sat, 5 Mar 2016 17:29:04 +0000 (02:29 +0900)
commitd34794f7d5566effd342dd0ebaca3de3b48656f0
treef804e0cd261b3b6b835be1fa0153f00ce63b7f76
parent60690a6fe8351995b1eeb9a53f2b634c3bce3a3d
Ignore recovery_min_apply_delay until recovery has reached consistent state

Previously recovery_min_apply_delay was applied even before recovery
had reached consistency. This could cause us to wait a long time
unexpectedly for read-only connections to be allowed. It's problematic
because the standby was useless during that wait time.

This patch changes recovery_min_apply_delay so that it's applied once
the database has reached the consistent state. That is, even if the delay
is set, the standby tries to replay WAL records as fast as possible until
it has reached consistency.

Author: Michael Paquier
Reviewed-By: Julien Rouhaud
Reported-By: Greg Clough
Backpatch: 9.4, where recovery_min_apply_delay was added
Bug: #13770
Discussion: http://www.postgresql.org/message-id/20151111155006.2644.84564@wrigleys.postgresql.org
doc/src/sgml/recovery-config.sgml
src/backend/access/transam/xlog.c