c# - DeadLock DbContext Concurrent Transactions -


enter image description here

hi please see deadlock graph portion in above image.i have 2 transactions update same table , 1 of them long transaction update table (same row) 5 times other transaction updates table once , small transaction of 2 db hits .its logically true deadlock graph both transaction have x lock on different rows , attempting u lock . cant understand why shorter transaction acquire x lock though hasn't fired update query yet (as update query causes deadlock means isn't fired yet ). highly appericiable. 1) using isolation level read committed 2) cant understand how second/first transaction can x lock while other transaction got on row.i read on update query first u lock applied , upgraded x lock particular updated row.now when 1 transaction has x lock how transaction can have u lock during table scan (to determine row updated) can not read row has x lock other transaction.3) both transaction updates 1 different row of same table.any possible solution @ db level without changing isolation level.

i cant understand how second/first transaction can x lock while other transaction got on row.

that magic behind databases , performance. locks can issued on different levels , if second transaction didn't use table scan issue x lock without conflicting first transaction. possible records update searched using index , table scan didn't happen there can multiple concurrent x locks in table.

i read on update query first u lock applied , upgraded x lock particular updated row.

no. update should use x lock on record directly. u lock must forced read query reads data udpated (that @marc mentioned in comment). know ef doesn't support because cannot use hints.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -