mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -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() */
|
||||
|
Reference in New Issue
Block a user