I refer to the question # “478 - How to cleanup old Cases / Tasks?” with my questions:
The Timestampstring contains the number of days the finished cases will be stored. For example: “DELETE FROM IWA_Case WHERE DATEDIFF(dd, EndTimestamp, GETDATE()) > 7” will delete all finished cases older than 7 days. As mentioned in my first question, all Delete-Statements in the CASE-DELETE-Trigger and all the nested Delete-Statements in the TASK-DELETE-Trigger will be executed automatically. This causes to Database-Deadlocks – see one Message of our Nagios tool: 5 deadlocks detected on LUXDB004
What is wrong? What must we do to avoid this deadlocks? Thanks in advance. Dieter asked 08.06.2017 at 07:34 Dieter Staudt Reguel Werme... ♦♦ |
Normally, a database detects deadlock itself and then throws an exception to one of the deadlock owners. Do you see such an deadlock error in your ivy logs too? How many cases are deleted? If there are many it may take some time to delete them on the database. Maybe that is why Nagios thinks its a deadlock. In this case try to reduce the amount of cases that are deleted in one statement. After one statement is executed commit the transaction. Then execute the next statement. This will reduce the the amount of memory and transaction log that is necessary to delete the cases. For example read the id's of the cases to delete. Then delete each case one after the other. answered 09.06.2017 at 05:28 Reto Weiss ♦♦ Hello Mr. Weiss. for example, for one day there will be about 7250 Case records that will be deleted. I think the main problem is the "mixed arrangement" of the sql statements in both triggers: If a case record is deleted, the trigger deletes also the associated task record BUT in the trigger for deleting tasks there is an update for the field IWA_Case.CreatorTaskId=NULL in the case record that is deleted??? Pleas can you or your team check the content of both triggers for deleting cases and tasks. Thank you. BR Dieter.
(14.06.2017 at 04:40)
Dieter Staudt
PS: In the meantime I have found a way to avoid deadlock situations: I execute the delete statment manually by using the SQL Management Studio with the Parameter TOP. DELETE top (1000) FROM IWA_Case WHERE DATEDIFF(dd, EndTimestamp, GETDATE()) > 20 (DAYS) To delete 1,000 cases with all associated records (by trigger function) taks about 10 Seconds.
(14.06.2017 at 04:45)
Dieter Staudt
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 08.06.2017 at 07:34
Seen: 2,787 times
Last updated: 14.06.2017 at 04:45
What kind of database are you using as system database?
We are using for IVY the SQL-Server 2008 R2