activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Krebs <cake...@gmx.de>
Subject stale transaction using journaled jdbc and postgresql
Date Fri, 21 Sep 2007 16:36:12 GMT

Hi,

I have a curious problem, when running ActiveMQ 4.1.1 with a journaled jdbc
adapter using a PostgreSQL as long term persistence store. It looks like,
that ActiveMQ starts a transaction on the database an never commits it. At
present ActiveMQ is able to deliver almost all messages right after arrival,
so there is no need to store any messages in the PostgreSQL, the journal is
sufficient.
Is this the normal behaviour of ActiveMQ? or is there a way to configure
ActiveMQ to just start the transaction on demand and to commit it after some
time?

The problem of the very long running transaction is, that the transaction
locks a transaction id in the database and prevents the database from wiping
out dead rows (VACUUM). For the ActiveMQ schema it doesn't matter, but I
have some more heavily updated tables in other schemas, which needed to be
cleaned up periodically, but as long ActiveMQ doesn't commits the
transaction, the database have no chance to do so.


  Carsten

Below, the broker configuration used.

<beans>

	<!-- Allows us to use system properties as variables in this configuration
file -->
	<bean
	
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
/>

	<bean id="dataSource"
		class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="org.postgresql.Driver" />
		<property name="url" value="jdbc:postgresql://${db.host}:5432/gd" />
		<property name="defaultCatalog" value="gd" />
		<property name="username" value="activemq" />
		<property name="password" value="activemq" />
		<property name="maxActive" value="15" />
		<property name="initialSize" value="0" />
 		<property name="poolPreparedStatements" value="true" />
		<property name="maxWait" value="0" />
		<property name="defaultAutoCommit" value="false" />
		<property name="minIdle" value="0" />
		<property name="maxIdle" value="0" />
		<property name="timeBetweenEvictionRunsMillis" value="60000" />
		<property name="minEvictableIdleTimeMillis" value="600000" />
	</bean>

	<bean name="jdbcPersistenceAdapter"
		class="org.apache.activemq.store.jdbc.JDBCPersistenceAdapter">
		<property name="adapter">
			<bean
class="org.apache.activemq.store.jdbc.adapter.PostgresqlJDBCAdapter">
				<property name="batchStatments" value="true" />
			</bean>
		</property>
	</bean>
	<!-- 
		JMS Broker 
	-->
	<broker brokerName="jmsBroker" useJmx="true" persistent="true"
		xmlns="http://activemq.org/config/1.0">
		<!-- Use the following to configure how ActiveMQ is exposed in JMX -->
		<managementContext>
			<managementContext connectorPort="1616"
				jmxDomainName="org.apache.activemq" />
		</managementContext>

		<persistenceAdapter>
			<journaledJDBC journalLogFiles="10"
				jdbcAdapter="#jdbcPersistenceAdapter"
				dataSource="#dataSource" />
		</persistenceAdapter>
		
		<transportConnectors>
			<transportConnector name="openwire"
				uri="tcp://${activemq.host}:61616" />
			<transportConnector name="ssl" uri="ssl://${activemq.host}:61617" />
			<transportConnector name="stomp"
				uri="stomp://${activemq.host}:61613" />
		</transportConnectors>

		<networkConnectors>
			<networkConnector uri="multicast://default" />
		</networkConnectors>

	</broker>
</beans>


-- 
View this message in context: http://www.nabble.com/stale-transaction-using-journaled-jdbc-and-postgresql-tf4497201s2354.html#a12825214
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message