Maciej Miklas created AMQ-6911:
----------------------------------

             Summary: Constraint violation on failover (Postgresql)
                 Key: AMQ-6911
                 URL: https://issues.apache.org/jira/browse/AMQ-6911
             Project: ActiveMQ
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 5.15.3
            Reporter: Maciej Miklas


We have ActiveMq 5.12 in following configuration:
 * PostgreSQL for persistance
 * two Nodes, one in Standby
 * JDBC Master Slave with shared Database
 * static cluster discovery

Everything seams to be fine, failover works as expected, but sometimes during 
failover we are observing following exception:
{code:java}
 28.02.2018 09:28:54,207 WARN  [ActiveMQ NIO Worker 6] 
org.apache.activemq.transaction.LocalTransaction  - Store COMMIT 
FAILED:java.io.IOException: Batch entry 2 INSERT INTO ACTIVEMQ_MSGS(ID, 
MSGID_PROD, MSGID_SEQ, CONTAINER, EXPIRATION, PRIORITY, MSG, XID) VALUES 
(7095330, 'xxx-1-1519303952070-3:862:8:1', 15, 'queue://abc', 1520411334073, 4, 
?, NULL) was aborted: FEHLER: doppelter Schl▒sselwert verletzt 
Unique-Constraint ▒activemq_msgs_pkey▒  Detail: Schl▒ssel ▒(id)=(7095330)▒ 
existiert bereits.  Call getNextException to see other errors in the batch.     
   at 
org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:46)  
      at 
org.apache.activemq.store.jdbc.TransactionContext.commit(TransactionContext.java:209)
        at 
org.apache.activemq.store.jdbc.JDBCPersistenceAdapter.commitTransaction(JDBCPersistenceAdapter.java:516)
        at 
org.apache.activemq.store.memory.MemoryTransactionStore$Tx.commit(MemoryTransactionStore.java:113)
        at 
org.apache.activemq.store.memory.MemoryTransactionStore.commit(MemoryTransactionStore.java:270){code}
ActiveMQ propagates this exception directly to the client.

I am assuming, that due to a failover some clients did not get acknowledgment 
and message has been resent to a new node.

If I am correct ActiveMq should just ignore duplicated message, or both 
messages should be stored in database. But latest it's not possible, because  
ACTIVEMQ_MSGS#ID is a PK

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to