Share via

Deadlock XML - Mode displays

Mark Gordon 926 Reputation points
2021-05-04T18:57:57.16+00:00

Fellow SQL dBAa,

I am trying to understand the difference between the MODE values in the XML dump.

I have solved the deadlock but trying to understand why it displayed a certain way in the graph or even shows what it does in the XML.

User 1 had an exclusive lock on table A - which was for an update. User 2 wanted a shared lock on table A for a Select (The select was reading table A and B).

User 2 had a shared lock on table B for a select (believe to be same select as above). User1 wanted an exclusive lock on table B and, if it got it, was going to do an update.

In the xml, when I look at resource section, I see a keylock with MODE of U but a U does not appear on the Modes for the two connections/processes - one has an S and one has an X.

What makes the MODE on the keylock lines different then the owner line and waiter line? Neither of those had a U.

thx

MG

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


Answer accepted by question author

Erland Sommarskog 134.7K Reputation points MVP Volunteer Moderator
2021-05-05T21:01:50.68+00:00

The waiter process1bed1e4108 holds an update-lock on this index key.
Typically, an UPDATE statement will first acquire U locks on rows that are may be in for an update, and if they are, the U locks are converted to X locks, and that is what is happening here. Notice the part requestType="convert". The U lock is compatible with the S lock, so blocking occurred at that point. But it is not possible to convert it to an X lock, because of the other process.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.