You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LeaseDatabaseLocker: allow the lease acquire retry interval to be set separately from the lease duration #2663
LeaseDatabaseLocker uses lockAcquireSleepInterval for two things:
The lease duration. The lease row's expiry is set to now + lockAcquireSleepInterval when the lease is acquired and on every keepAlive() renewal.
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 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.
Activity