Question 1:
I wanted to get an understanding of the expectations on the behavior given the following scenario.
In this example, two processes are updating an the same resource.
If one (the first one) is in a transaction and the other is attempting to update the same record, the second must wait until the first one commits.
if the first one is updates again or performs a select, all things being equal, SQL Server chooses process 2 as the "kill victim".
I just want to be clear what the expectations are in terms of data integrity. Is the rule that the victim's data will never be persisted (and committed).
Should data base applications always look for this SQLSTATE=40001 and retry the persistence logic?
Question 2:
I know we can call SET DEADLOCK_PRIORITY n (where n can be LOW, NORMAL, HIGH or a value between -10 to 10) as a hint to sql server to decide which process should be the kill victim. Having said this, is there any problems with setting a particular process to be ( SET DEADLOCK_PRIORITY=) 10. In the scenario, the expectation is that all other processes are helper processes and in a better position to handle the SQLSTATE=40001. What do we loose by doing this?
Thanks