colinwerner opened a new issue, #2663: URL: https://github.com/apache/activemq/issues/2663
`LeaseDatabaseLocker` uses `lockAcquireSleepInterval` for two things: 1. **The lease duration.** The lease row's expiry is set to `now + lockAcquireSleepInterval` when the lease is acquired and on every `keepAlive()` renewal. 2. **The wait between acquire attempts** on a broker that does not hold the lease. `doStart()` sleeps `lockAcquireSleepInterval` after each failed attempt. The lease has to outlive the slowest renewal the master can make (the keep-alive period plus connection and statement time). Otherwise a slow renewal lets the waiting broker take over while the master is still running. Choosing a lease long enough to be safe also makes the waiting broker poll that slowly: - after a clean stop, the old master releases the lease immediately, but the waiting broker can take up to `lockAcquireSleepInterval` to notice; - after a crash, failover can take up to `2 × lockAcquireSleepInterval` (the lease runs out, then the next poll). For example, on a JDBC master/slave pair on PostgreSQL where a renewal can take up to about 13 s, a safe lease is about 20 s. Failover then takes up to about 20 s after a clean stop and about 40 s after a crash. Polling every 2 s would bring these down to about 2 s and 22 s without changing the lease. [AMQ-4347](https://issues.apache.org/jira/browse/AMQ-4347) proposed renaming these properties and was closed as Won't Fix. This proposal leaves the existing properties and their meaning unchanged. ### Proposal Add an optional `lockAcquireRetryInterval` property to `LeaseDatabaseLocker` that sets only the wait between acquire attempts. When it is unset (the default), the locker uses `lockAcquireSleepInterval` as it does today, so existing configurations behave exactly as before. ```xml <jdbcPersistenceAdapter dataSource="#ds" lockKeepAlivePeriod="5000"> <locker> <lease-database-locker lockAcquireSleepInterval="20000" lockAcquireRetryInterval="2000"/> </locker> </jdbcPersistenceAdapter> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information, visit: https://activemq.apache.org/contact
