Sql exception - Duplicate key exceptions in core logs


Description

After updating on-premise instance to version 3.22, Orange encountered duplicate key exceptions in core logs
Example: "Duplicate entry 'XXXX' for key 'PRIMARY'" .

Release or Environment

Environment: pre-prod

Release: The exceptions are identified in Sweagle release 3.22

Cause

The root cause was related to an automated migration script which was part of an older release.

Depending on the exact content in the DB that migration caused this behavior

Resolution

Orange has to run below SQL query ONCE and restart cores to avoid the duplicate key exceptions in next upgrade.

1. Run query:

 

insert into COUNTER(ID, STATUS) select (max(ID) + 10), 1 from COUNTER;

 

2. Then restart all core servers.