Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-6911

Constraint violation on failover (Postgresql)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Bug
    • 5.15.2
    • None
    • JDBC
    • None

    Description

      We have ActiveMq 5.15.2 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:

       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)

      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

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            mac.miklas Maciej Miklas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: