You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2012/06/13 23:57:42 UTC

[jira] [Resolved] (AMQ-3654) JDBC Master/Slave : Slave cannot acquire lock when the master loose database connection.

     [ https://issues.apache.org/jira/browse/AMQ-3654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully resolved AMQ-3654.
-----------------------------

    Resolution: Fixed

Added a lease based data base locker. Use as follows from xml config with the 5.7-SNAPSHOT{code}       <ioExceptionHandler>
            <jDBCIOExceptionHandler/>
        </ioExceptionHandler>

        <persistenceAdapter>
            <jdbcPersistenceAdapter lockKeepAlivePeriod="1000" lockAcquireSleepInterval="2000">
                <databaseLocker>
                    <lease-database-locker/>
                </databaseLocker>
            </jdbcPersistenceAdapter>
        </persistenceAdapter>
{code}
The optional IOExceptionHandler will pause/resume the transport connectors on any IO exception related to access to the DB.
The lease based lock is acquired by blocking at start and retained by the keepAlivePeriod. To retain, the lease is extended by the lockAcquireSleepInterval, so in theory the master is always {code}lockAcquireSleepInterval-lockKeepAlivePeriod{code} ahead of the slave w.r.t the lease.
The lease is dropped on normal shutdown.
The broker system clock is not in sync with the db, a maxAllowableDiffFromDBTime > 0 will adjust the lease duration if the skew exceeds the absolute maxAllowableDiffFromDBTime value, allowing the db to dictate the utc basis for the lease.
                
> JDBC Master/Slave : Slave cannot acquire lock when the master loose database connection.
> ----------------------------------------------------------------------------------------
>
>                 Key: AMQ-3654
>                 URL: https://issues.apache.org/jira/browse/AMQ-3654
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.5.0
>         Environment: Unix/Redhat 5.6
> ActiveMQ 5.5.0
> Oracle 10G
>            Reporter: Richard Martin
>            Assignee: Gary Tully
>            Priority: Critical
>             Fix For: 5.7.0
>
>
> Our configuration is JDBC Master/Slave with one master and one slave. When the master is started, he acquire the database lock.
> Then when the slave is started, he wait to acquire the database lock. When the master loose the network connection to the database, the lock in the database is not removed and the slave connot acquire the database lock. In this situation, the master is unable to respond to client (due to network failure)
> and the slave is not started because he can't acquire the database lock.
> When the master is killed, the slave can't acquire the database lock too. After the network connection is restored, when the master starts, it cannot
> acquire lock to the database (because the lod lock is always present) so now, we have two slaves and no master.
> Please, refer to this issue which is the same problem : AMQ-1958 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira