activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Taylor (JIRA)" <>
Subject [jira] Reopened: (AMQ-1191) JDBC based Master/Slave not supported for TransactSQL based databases (SQL Server and Sybase)
Date Sun, 03 May 2009 20:28:38 GMT


Greg Taylor reopened AMQ-1191:

It looks like the original problem (SQL Exception due to FOR UPDATE) has been fixed, however,
there is another problem here.  The new statement (SELECT * FROM ACTIVEMQ_LOCK WITH (UPDLOCK,
ROWLOCK)) does correctly lock the rows, however, when a potential slave fires the query, it
does NOT throw an exception, which is what DefaultDatabaseLocker uses to decide if the lock
failed.  Because the exception is not thrown, the method exits and the broker is told to become
the master, which leaves you with > 1 master.  Not good.

This may be a driver issue, but it appears that the behaviour in SQL Server is to block to
wait for the lock when executing this statement, and it only blocks when you attempt to iterate
over the ResultSet.  So, even if code was added to iterate over the ResultSet, you likely
still wouldn't get the desired effect.  I am using the Microsoft driver.

Here's a code snippet that should show the behaviour:
Connection conn = ...
PreparedStatement stmt = conn.prepareStatement("SELECT * FROM ACTIVEMQ_LOCK WITH (UPDLOCK,
// statement below does not throw or block
ResultSet rs = stmt.executeQuery();
// statement below blocks until lock acquired;

I hope this helps.


> JDBC based Master/Slave not supported for TransactSQL based databases (SQL Server and
> ---------------------------------------------------------------------------------------------
>                 Key: AMQ-1191
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>            Reporter: James Strachan
>            Assignee: Gary Tully
>             Fix For: 5.2.0
>         Attachments: patchfile
> The main issue is figuring out the exclusive lock SQL syntax. I think the following is

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message