You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Pat Fox (JIRA)" <ji...@apache.org> on 2013/10/31 20:39:20 UTC

[jira] [Commented] (AMQ-4841) lease-database-locker does not use the configured tablePrefix in UPDATE statement

    [ https://issues.apache.org/jira/browse/AMQ-4841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13810608#comment-13810608 ] 

Pat Fox commented on AMQ-4841:
------------------------------

WORKAROUND
============
A simple workaround to this is to reorder the configured elements within  "jdbcPersistenceAdapter" element so "locker" is after the "statement" element.

{code}

<persistenceAdapter>
    <jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" lockKeepAlivePeriod="5000">
	<statements>
	  <statements tablePrefix="TTT_" messageTableName="AMQ_MSGS" durableSubAcksTableName="AMQ_ACKS" lockTableName="AMQ_LOCK"/>
	</statements>
        <adapter>
	  <mysql-jdbc-adapter/>
	</adapter>
	<locker>
	  <lease-database-locker lockAcquireSleepInterval="10000"/>
	</locker>
  </jdbcPersistenceAdapter>
</persistenceAdapter>

{code}

The above config results in the locker using the prefix table name in the UPDATE statement

{code}
...
2013-10-30 14:36:01,041 | DEBUG | jdbcBroker, lease keepAlive Query is UPDATE TTT_AMQ_LOCK SET BROKER_NAME=?, TIME=? WHERE BROKER_NAME=? AND ID = 1 | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | ActiveMQ JDBC PA Scheduled Task
...
{code}


>  lease-database-locker does not use the configured tablePrefix in UPDATE statement
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-4841
>                 URL: https://issues.apache.org/jira/browse/AMQ-4841
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.0
>         Environment: - tested on latest trunk
>            Reporter: Pat Fox
>         Attachments: JDBCLockTablePrefixTest.java
>
>
> Using the configuration
> {code}
> <persistenceAdapter>
>     <jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" lockKeepAlivePeriod="5000">
>         		       <locker>
> 					<lease-database-locker lockAcquireSleepInterval="10000"/>
> 				</locker>
> 				<statements>
> 					<statements tablePrefix="TTT_" messageTableName="AMQ_MSGS" durableSubAcksTableName="AMQ_ACKS" lockTableName="AMQ_LOCK"/>
> 				</statements>
>         		      <adapter>
> 					<mysql-jdbc-adapter/>
> 				</adapter>
> 			</jdbcPersistenceAdapter>
> 		</persistenceAdapter>
> {code}
> The logging show the Lock table was created WITH the configured prefix but the lease locker UPDATE statement does not use that prefix
> {code}
> 2013-10-30 14:33:03,245 | DEBUG | Executing SQL: CREATE TABLE TTT_AMQ_LOCK( ID BIGINT NOT NULL, TIME BIGINT, BROKER_NAME VARCHAR(250), PRIMARY KEY (ID) ) ENGINE=INNODB | org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter | main
> ...
> 2013-10-30 14:33:10,889 | DEBUG | jdbcBroker, lease keepAlive Query is UPDATE ACTIVEMQ_LOCK SET BROKER_NAME=?, TIME=? WHERE BROKER_NAME=? AND ID = 1 | org.apache.activemq.store.jdbc.LeaseDatabaseLocker | ActiveMQ JDBC PA Scheduled Task
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)