summaryrefslogtreecommitdiff
path: root/src/backend/storage/ipc/standby.c
diff options
context:
space:
mode:
authorTom Lane2013-03-17 03:22:17 +0000
committerTom Lane2013-03-17 03:22:57 +0000
commitd43837d03067487560af481474ae985df894f786 (patch)
tree7289d038a184fa3dc59195aaa27538714ea85ad9 /src/backend/storage/ipc/standby.c
parentd2bef5f7db5f3afdbbb3f58b8eff49f0bc7ef790 (diff)
Add lock_timeout configuration parameter.
This GUC allows limiting the time spent waiting to acquire any one heavyweight lock. In support of this, improve the recently-added timeout infrastructure to permit efficiently enabling or disabling multiple timeouts at once. That reduces the performance hit from turning on lock_timeout, though it's still not zero. Zoltán Böszörményi, reviewed by Tom Lane, Stephen Frost, and Hari Babu
Diffstat (limited to 'src/backend/storage/ipc/standby.c')
-rw-r--r--src/backend/storage/ipc/standby.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
index a903f127660..fcf08f42b36 100644
--- a/src/backend/storage/ipc/standby.c
+++ b/src/backend/storage/ipc/standby.c
@@ -428,8 +428,15 @@ ResolveRecoveryConflictWithBufferPin(void)
* Wake up at ltime, and check for deadlocks as well if we will be
* waiting longer than deadlock_timeout
*/
- enable_timeout_after(STANDBY_DEADLOCK_TIMEOUT, DeadlockTimeout);
- enable_timeout_at(STANDBY_TIMEOUT, ltime);
+ EnableTimeoutParams timeouts[2];
+
+ timeouts[0].id = STANDBY_TIMEOUT;
+ timeouts[0].type = TMPARAM_AT;
+ timeouts[0].fin_time = ltime;
+ timeouts[1].id = STANDBY_DEADLOCK_TIMEOUT;
+ timeouts[1].type = TMPARAM_AFTER;
+ timeouts[1].delay_ms = DeadlockTimeout;
+ enable_timeouts(timeouts, 2);
}
/* Wait to be signaled by UnpinBuffer() */