activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Taylor (JIRA)" <j...@apache.org>
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

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

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,
ROWLOCK)");
// statement below does not throw or block
ResultSet rs = stmt.executeQuery();
// statement below blocks until lock acquired
rs.next();

I hope this helps.

Regards,
Greg.


> JDBC based Master/Slave not supported for TransactSQL based databases (SQL Server and
Sybase)
> ---------------------------------------------------------------------------------------------
>
>                 Key: AMQ-1191
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1191
>             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
valid...
> SELECT * FROM TABLE WITH XLOCK

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


Mime
View raw message