mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
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
This commit is contained in:
@ -2883,7 +2883,22 @@ ProcessInterrupts(void)
|
||||
(errcode(ERRCODE_QUERY_CANCELED),
|
||||
errmsg("canceling authentication due to timeout")));
|
||||
}
|
||||
if (get_timeout_indicator(STATEMENT_TIMEOUT))
|
||||
|
||||
/*
|
||||
* If LOCK_TIMEOUT and STATEMENT_TIMEOUT indicators are both set, we
|
||||
* prefer to report the former; but be sure to clear both.
|
||||
*/
|
||||
if (get_timeout_indicator(LOCK_TIMEOUT, true))
|
||||
{
|
||||
ImmediateInterruptOK = false; /* not idle anymore */
|
||||
(void) get_timeout_indicator(STATEMENT_TIMEOUT, true);
|
||||
DisableNotifyInterrupt();
|
||||
DisableCatchupInterrupt();
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_QUERY_CANCELED),
|
||||
errmsg("canceling statement due to lock timeout")));
|
||||
}
|
||||
if (get_timeout_indicator(STATEMENT_TIMEOUT, true))
|
||||
{
|
||||
ImmediateInterruptOK = false; /* not idle anymore */
|
||||
DisableNotifyInterrupt();
|
||||
|
Reference in New Issue
Block a user