Subject Re: [firebird-support] Re: Deadlock exception occurs but it shouldn't?
Author Walter R. Ojeda Valiente
Hello Bruce

Yes, transaction T1 can block a row and transaction T2 will wait. But if transaction T2 blocks a row then transaction T1 can not wait and dead.

Greetings.

Walter.


On Thu, Dec 25, 2014 at 7:27 AM, brucedickinson@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
 

Walter,

thank you very much for trying to explain that to me. Unfortunately I've got lost somewhere in the middle of your response...


>>- If you are updating or deleting just one row, then no conflict can happen with your settings. But if you want >>to update or delete several rows then conflicts can happens.

In my test case I have two threads (or applications, I do not think that does have matter) which are constantly updating the same row.

>>- Transaction T1 starts, transaction T2 starts, transaction T1 wants to update some rows, transaction T2 >>wants to update some different rows. No problems until now.

This is not my case because my transactions are working on the same row but so far I understand that, and I agree with you. Different rows, no deadlock should happen.

>>Transaction T2 wants to update (and therefore blocks) a row and after that transaction T1 wants to update >>that row. Deadlock because transaction T1 is older than transaction T2.

I do not understand, why deadlock? Why T1 does not wait for T2 to commit/rollback?

>>If transaction T1 blocks a row and after that transaction T2 wants to update that row then transaction T2 will >>wait. But if transaction T2 blocks a row and after that transaction T1 wants to update that row will have a >>deadlock.

I do not understand this, why there will be a deadlock? Because the older transaction could not be first to block the row?

I thought I've had all figured out:(