Home > database > Mysql isolation level level whether the loss and the first update is the second lost updates problem
Mysql isolation level level whether the loss and the first update is the second lost updates problem
Time:10-13
Recently looked back, suddenly found a problem: Said a lot of data are four isolation levels have solved the problem of the first kind of lost updates (rolled back cover), but did not find to look a lot of information under the read uncommitted isolation level, is how to dispose of the rollback covering this problem
In mysql - under the innoDB, for example, read uncommited level will not apply for the lock is read, writing to apply for long locks - exclusive locks, it can solve the rolled back cover?
And such as two transaction concurrency:
T1 start transaction - & gt; T2 start transaction - & gt; T2 update data X and commit - & gt; T1 update data X, then roll back
The concurrent T1 and T2 above can disappear from T2 updated data, this kind of circumstance is reading under the level of uncommitted how may not appear? Can appear? Why so many materials are said four isolation levels are not be "the first kind of lost updates"?
CodePudding user response:
Read uncommited this level means a transaction can be read by another transaction did not commit point data, by your example, T2 read the T1 uncommitted data, T2 after completion, submit the T1 rollback data, resulting in T2 read data is not the actual data, could trigger a logical judgment on the transaction, this phenomenon has a name, dirty data, the individual thinks, update the lost is easy to cause misunderstanding, with dirty data to presentation is more clear, Other isolation constituency limits the uncommitted data cannot be read, also won't appear dirty data, but there are other problems, such as repeated reading, T1 reading data transaction execution, T2 modified the T1 read data transaction execution and successfully submitted, and T1 may once again read the data found that data has changed, this can lead to inconsistent,