Here, Read_item(B); and B;=B+temp; have written parallelly. what happen here? What is the problem associated with the above transaction schedule?
1 Answer
If the transaction isolation level is set to read uncommitted or read committed, the writes in T2 would be overwritten by T1. When the transaction isolation level is set to repeatable read or serializable T1 would be rolled back because the record it tries to update has changed since it's transaction started and an error is thrown.
My answer is based on postgresql. You can read more about transaction isolation in the link below. Make sure you read the documentation for the right dbms and version for there are differences between them.
https://www.postgresql.org/docs/current/transaction-iso.html