Unique constraint errors are reported by SAS® OnDemand Decision Engine when asynchronous updates are configured


Primary key constraint errors can occur when database locking is disabled on the Multi-entity History (MEH) database and asynchronous updates are enabled for user variable segments. The unique constraint errors occur if transactions with the same entity value are received by two SAS OnDemand Decision Engine servers at the same time and a database insert is required for the entity. The database insert succeeds on the first engine but fails on the second engine because the same key value cannot be inserted twice. On the second engine, a unique key constraint error message is written to the ode.log file. Here is an example:

2021-09-30T16:02:53,263 [V02 Pending Commits] INFO  SQLMEHConnection An error occurred executing pended updates. The updates have been returned to the pending list.
2021-09-30T16:02:53,263 [V02 Pending Commits] ERROR CommitTask Error committing pended updates.
java.sql.BatchUpdateException: ORA-00001: unique constraint (MEHCORE.PKX_V_DATA) violated 
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:12296) ~[ojdbc7.jar:12.1.0.2.0]
 
The second engine continually retries the database insert until that engine is restarted. Each attempted insert writes the error messages to the ode.log. This situation does not prevent transactions from processing correctly.   

Workaround

Remove the config.asyncUpdatesConfig.enabledSegmentsRegex property from the ose.xml file. Below is an example of this property:

<property name="config.asyncUpdatesConfig.enabledSegmentsRegex" value="V02, V06" />