Datasource Forward Transaction Error

Since updating to the 8.0.0 release I have started to see some error in my log labeled Datasource Forward Transaction, Error Forwarding Data. The stack is below.

java.sql.BatchUpdateException: Violation of PRIMARY KEY constraint ‘PK__sqlt_dat__BE126DD1CF6D48CC’. Cannot insert duplicate key in object ‘dbo.sqlt_data_1_2019_04’. The duplicate key value is (1, 1554998302618).

at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:2065)

at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223)

at org.apache.commons.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:223)

at com.inductiveautomation.ignition.gateway.datasource.DelegatingStatement.executeBatch(DelegatingStatement.java:60)

at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRStatement.executeBatch(SRConnectionWrapper.java:735)

at com.inductiveautomation.gateway.tags.history.storage.TagHistoryDatasourceSink.insertTagValues(TagHistoryDatasourceSink.java:987)

at com.inductiveautomation.gateway.tags.history.storage.TagHistoryDatasourceSink.storeScanClassSet(TagHistoryDatasourceSink.java:479)

at com.inductiveautomation.gateway.tags.history.storage.TagHistoryDatasourceSink.storeDataToDatasource(TagHistoryDatasourceSink.java:457)

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AbstractDatasourceSink.storeToDatasource(AbstractDatasourceSink.java:137)

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AbstractDatasourceSink.storeData(AbstractDatasourceSink.java:115)

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AggregateSink.storeData(AggregateSink.java:170)

Do you have a second Ignition system running elsewhere, with a .gwbk from this system? This primary key violation is 99% of the time due to two Ignition systems with the same database and tags configured.

1 Like

No, we just have the one gateway, we do have other gateways that we have remote tag providers set up for, but the tags are not the same and they are not running from the same backup. I have dropped the history tables and restarted history to test out the history bugs fresh when the gateway was updated.

I think I found the tag that was causing the issue. I feel like there was an issue when I was restarting the history and something was caught in the store and forward as I found an error there and deleted the data and it at least looks like it is solved for now.

2 Likes