aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorFujii Masao <fujii@postgresql.org>2016-03-06 02:29:04 +0900
committerFujii Masao <fujii@postgresql.org>2016-03-06 02:43:17 +0900
commitf95f1ce003d1453d78a8dd05577d6c61b251d48d (patch)
tree36284f72129c49e7ecc15ca0a619f0dce424478d /src/backend/access/transam/xlog.c
parent763b8f5d904517c3dffaaa43331a719c80d6e5b0 (diff)
downloadpostgresql-f95f1ce003d1453d78a8dd05577d6c61b251d48d.tar.gz
postgresql-f95f1ce003d1453d78a8dd05577d6c61b251d48d.zip
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
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 06a361a9ed9..e92a0ada9da 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -5672,6 +5672,10 @@ recoveryApplyDelay(XLogReaderState *record)
if (recovery_min_apply_delay <= 0)
return false;
+ /* no delay is applied on a database not yet consistent */
+ if (!reachedConsistency)
+ return false;
+
/*
* Is it a COMMIT record?
*