Reputation: 25312
Am I right in the following?
Transaction in Serializable IsolationLevel sets read locks for select statements. There are two transactions selecting some range. Both get read locks. But then first transaction updates or adds new value inside the selected range and commits. What will happen with the second transaction? Will it fail if tries to update or add value inside selected range after first transaction has commited?
Upvotes: 1
Views: 857
Reputation: 453897
You don't say RDBMS so I am assuming a simple locking scheme with S
and X
locks. You say.
Transaction in Serializable IsolationLevel sets read locks for select statements. There are two transactions selecting some range. Both get read locks.
But then first transaction updates or adds new value inside the selected range and commits.
This wouldn't be possible if the second transaction already has a read lock on the range. It would have to wait until the second transaction released its lock. If the second transaction also attempted to update the range then deadlock would result.
Upvotes: 2
Reputation: 802
yes, the second transaction will fail because the second transaction will only see datas commited before the begin of the transaction.
Upvotes: 0