You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by bwtaylor <br...@yahoo.com> on 2009/07/24 18:54:06 UTC

AMQ-1191 for 5.3 broke master/slave locking for Oracle

We just tried to port our broker to a 5.3 snapshot and got an exception at
broker startup:

DefaultDatabaseLocker          - Failed to acquire lock:
java.sql.SQLException: statement handle not executed: getMetaData
java.sql.SQLException: statement handle not executed: getMetaData

We use Oracle for our persistence store, and it turns out that the Oracle
JDBC driver will throw an error if getMetaData is called before statement
execution. I dug into this to find which patch changed this, and found this:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?r1=747391&r2=787990&diff_format=h

This shows that revision 787990 added an if() predicated taat calls
statement.getMetaData(), which throws the error since
statement.executeQuery() has not yet been called. If you have Oracle
Metalink, see bug 3917619, which was closed "Not a Bug." (asserting this
behavior is allowed under the JDBC spec) and also see bug 3934162, which
will change this behavior in the 11.2 jdbc driver (not out yet) as an
enhancement request. The normal work around to this problem is to append an
impossible where clause like "where 1=0" and go ahead and execute the query.

Interestingly, the ticket seeks to make master/slave locking work with
SqlServer, and the specific change has a comment about needing to make it
work with derby. We are using Derby in our dev environments and Oracle in
our current production environment, and we are considering SqlServer in some
future production environments. So we'd like 5.3 to work with all of these
RDBMS's :-).

Hope this helps...
-- 
View this message in context: http://www.nabble.com/AMQ-1191-for-5.3-broke-master-slave-locking-for-Oracle-tp24648059p24648059.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: AMQ-1191 for 5.3 broke master/slave locking for Oracle

Posted by Gary Tully <ga...@gmail.com>.
reworked the resolution of AMQ-1191 to split out the locker implementation
for ms sqlserver. The current snapshot should now work with Oracle without
modification.

2009/7/24 Gary Tully <ga...@gmail.com>

> yea, exactly like that, where bean id="mydblocker" is an instance of your
> OracleDatabaseLocker.
>
> 2009/7/24 bwtaylor <br...@yahoo.com>
>
>>
>> We have been using Oracle without issue with activemq 5.1, so prevoius
>> versions worked with Oracle. We can try creating our own
>> OracleDatabaseLocker if needed.
>>
>> I found setDatabaseLocker() on JDBCPersistenceAdapter, so in the custom
>> spring dialect, can I say something like
>>
>>  <persistenceAdapter>
>>    <jdbcPersistenceAdapter dataSource="#mydatasource"
>> databaseLocker="#mydblocker" />
>>  </persistenceAdapter>
>>
>> and then define mydblocker via regular spring config?
>>
>>
>> Gary Tully wrote:
>> >
>> > thanks for the heads up. It looks like it is time to have more than one
>> > database locker implementation in the box.
>> > A database locker implementation can be injected into the persistence
>> > adapter via config if that helps in the short term. Can you validate
>> that
>> > Oracle works fine without the getMetaData call?
>> >
>> > I have reopened AMQ-1191, thanks.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/AMQ-1191-for-5.3-broke-master-slave-locking-for-Oracle-tp24648059p24649622.html
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>
>>
>
>
> --
> http://blog.garytully.com
>
> Open Source Integration
> http://fusesource.com
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: AMQ-1191 for 5.3 broke master/slave locking for Oracle

Posted by Gary Tully <ga...@gmail.com>.
yea, exactly like that, where bean id="mydblocker" is an instance of your
OracleDatabaseLocker.

2009/7/24 bwtaylor <br...@yahoo.com>

>
> We have been using Oracle without issue with activemq 5.1, so prevoius
> versions worked with Oracle. We can try creating our own
> OracleDatabaseLocker if needed.
>
> I found setDatabaseLocker() on JDBCPersistenceAdapter, so in the custom
> spring dialect, can I say something like
>
>  <persistenceAdapter>
>    <jdbcPersistenceAdapter dataSource="#mydatasource"
> databaseLocker="#mydblocker" />
>  </persistenceAdapter>
>
> and then define mydblocker via regular spring config?
>
>
> Gary Tully wrote:
> >
> > thanks for the heads up. It looks like it is time to have more than one
> > database locker implementation in the box.
> > A database locker implementation can be injected into the persistence
> > adapter via config if that helps in the short term. Can you validate that
> > Oracle works fine without the getMetaData call?
> >
> > I have reopened AMQ-1191, thanks.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/AMQ-1191-for-5.3-broke-master-slave-locking-for-Oracle-tp24648059p24649622.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: AMQ-1191 for 5.3 broke master/slave locking for Oracle

Posted by bwtaylor <br...@yahoo.com>.
We have been using Oracle without issue with activemq 5.1, so prevoius
versions worked with Oracle. We can try creating our own
OracleDatabaseLocker if needed. 

I found setDatabaseLocker() on JDBCPersistenceAdapter, so in the custom
spring dialect, can I say something like

  <persistenceAdapter>
    <jdbcPersistenceAdapter dataSource="#mydatasource"
databaseLocker="#mydblocker" />
  </persistenceAdapter>

and then define mydblocker via regular spring config?


Gary Tully wrote:
> 
> thanks for the heads up. It looks like it is time to have more than one
> database locker implementation in the box.
> A database locker implementation can be injected into the persistence
> adapter via config if that helps in the short term. Can you validate that
> Oracle works fine without the getMetaData call?
> 
> I have reopened AMQ-1191, thanks.
> 
> 

-- 
View this message in context: http://www.nabble.com/AMQ-1191-for-5.3-broke-master-slave-locking-for-Oracle-tp24648059p24649622.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Re: AMQ-1191 for 5.3 broke master/slave locking for Oracle

Posted by Gary Tully <ga...@gmail.com>.
thanks for the heads up. It looks like it is time to have more than one
database locker implementation in the box.
A database locker implementation can be injected into the persistence
adapter via config if that helps in the short term. Can you validate that
Oracle works fine without the getMetaData call?

I have reopened AMQ-1191, thanks.

2009/7/24 bwtaylor <br...@yahoo.com>

>
> We just tried to port our broker to a 5.3 snapshot and got an exception at
> broker startup:
>
> DefaultDatabaseLocker          - Failed to acquire lock:
> java.sql.SQLException: statement handle not executed: getMetaData
> java.sql.SQLException: statement handle not executed: getMetaData
>
> We use Oracle for our persistence store, and it turns out that the Oracle
> JDBC driver will throw an error if getMetaData is called before statement
> execution. I dug into this to find which patch changed this, and found
> this:
>
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/jdbc/DefaultDatabaseLocker.java?r1=747391&r2=787990&diff_format=h
>
> This shows that revision 787990 added an if() predicated taat calls
> statement.getMetaData(), which throws the error since
> statement.executeQuery() has not yet been called. If you have Oracle
> Metalink, see bug 3917619, which was closed "Not a Bug." (asserting this
> behavior is allowed under the JDBC spec) and also see bug 3934162, which
> will change this behavior in the 11.2 jdbc driver (not out yet) as an
> enhancement request. The normal work around to this problem is to append an
> impossible where clause like "where 1=0" and go ahead and execute the
> query.
>
> Interestingly, the ticket seeks to make master/slave locking work with
> SqlServer, and the specific change has a comment about needing to make it
> work with derby. We are using Derby in our dev environments and Oracle in
> our current production environment, and we are considering SqlServer in
> some
> future production environments. So we'd like 5.3 to work with all of these
> RDBMS's :-).
>
> Hope this helps...
> --
> View this message in context:
> http://www.nabble.com/AMQ-1191-for-5.3-broke-master-slave-locking-for-Oracle-tp24648059p24648059.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com