At one of the locations, where we’re sending Alarms and Events to Milestone (using MIP SDK’s Component Integration APIs), the Milestone Smart Client hangs as a result of duplicate key-values. This is the error printed in the logs:
2021-06-01 12:34:03 PM UTC+03:00 Error XPathSqlConnection Error importing XML: Error executing SQL command: ‘INSERT INTO [Central].[t001_eventheader_t002] (alarm_t001_ID,class,customtag,id,message,name,priority,timestamp,type,version,priorityname,messageid ) VALUES (484361,‘Analytics’,‘Office’,‘3402c0ae-3032-4242-a1ba-200bfcb02f5d’,‘TRIPWIRE’,‘TRIPWIRE’,1,6/1/2021 9:33:59 AM,‘Person’,‘1.0’,‘New’,) SET = SCOPE_IDENTITY()’. InnerException: Cannot insert duplicate key row in object ‘Central.T001_EventHeader_T002’ with unique index ‘IX_T001_EventHeader_T002_ID’. The duplicate key value is (3402c0ae-3032-4242-a1ba-200bfcb02f5d).
The statement has been terminated.
Skipping import of root node: . EventHeader ID: 3402c0ae-3032-4242-a1ba-200bfcb02f5d
2021-06-01 12:34:03 PM UTC+03:00 Error EventHandler Failed to write event to database.
SqlException: Message: Cannot insert duplicate key row in object ‘Central.Event_Active’ with unique index ‘IX_Event_Active_UniqueId’. The duplicate key value is (f5ad62a0-fc2b-469d-8524-cb1b50befc23).
InnerException.Message: Null
InnerException.Type: Null
Number: 2601
ErrorCode: -2146232060
Procedure: Central.Event_Add
State: 1
Source: .Net SqlClient Data Provider
Please suggest a way to resolve this and also why help me understand as to why is this happening.