Lets say there are 3 transactions that got triggered at the same time
T1 => BEGIN -> w1(A) -> w1(B) -> w1(C) -> COMMIT
T2 => BEGIN -> r2(A) -> w2(B) -> r2(C) -> COMMIT
T3 => BEGIN -> w3(A) -> w3(C) -> COMMIT
A,B,C being rows
What happens in these scenarios
If T1 starts executing w1(A), will T2 be blocked for r2(A)? What kind of lock does T1 acquire for row A ? If T2 is allowed to read, what kind of lock does T2 acquire on row A
If T1 starts executing w1(A), will T3 be blocked for w3(A)?
I am expecting in scenario 1] T1 will acquire shared lock on row A, so that T2 is allowed to read. And assuming the lock will be upgraded to exclusive lock when T1 starts committing the changes and released after completion of transaction.
In scenario 2] T3 will wait till T1 releases the lock on row A (on committing the changes).
Are these expectations correct?