We have ActiveMQ Classic 5.18.3 running on two servers - S564 and S563. They are configured in a failover setup utilizing SQL Server as their back-end data store.
At random intervals, the following sequence of events occurs:
- S564 logs
no longer able to keep the exclusive lock so giving up being a master - S563 logs
S563, becoming master with lease expiry .....and got exclusive lock for the database. - S564 logs
Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 293 seconds. Inflights per route: [route3 = 1, route2 = 1] - S564 Keeps on logging
Waiting as there are still 2 inflight and pending exchanges to complete...until the timeout is elapsed. - Server S563 logs:
Ignoring SQLException, java.io.IOException: Violation of PRIMARY KEY constraint 'PK__ACTIVEMQ__3214EC27C'. Cannot insert duplicate key in object 'dbo.ACTIVEMQ_MSGS'. The duplicate key value is (513793323).'
What is the reason for the SQL Server Primary Key Violation? How to resolve this?