Home > database >  The MySQL transaction isolation level the Read committed to submit (Read) isolation mechanism failur
The MySQL transaction isolation level the Read committed to submit (Read) isolation mechanism failur

Time:05-12

Finished the MySQL course transaction isolation mechanism, test after class Read committed to submit (Read) the problem, a very interesting phenomenon: the Read committed to submit (Read) can appear isolation mechanism failure, may also appear dirty Read, not Repeatable Read magic, and Repeatable Read (Repeatable Read), but not more stable,
This is the read committed itself to the problems?
Test the steps of
Step 1:
First of all, I was opened two CMD window, enter the mysql
And use the command SET SESSION TRANSACTION ISOLATION LEVEL the READ COMMITTED
Changed one transaction isolation level for the Read committed
When using the select @ @ transaction_isolation (MySQL 8.0) looked at the isolation level

The second part: to enter test01 database, test01. At this time the Cat table is empty table, attribute id and name

Step 3: enter the transaction on both sides start on the left side of the transaction to modify and see if the right Cat can see

In the test article 2 data results as the right to see

Until the left submitted, the right to view the left data submitted

This is normally, then I did a test, the database no Dog table, both sides once again into the transaction, the transaction isolation level on both sides the same

Look at the original Cat table information, and add the attribute

. At this time no test01 Dog table, on the left side of the transaction the create table Dog (id int, ` name ` varchar (32));

After the problem is coming!!!!!!!!!! :
Creates a Dog table after the read committed isolation mechanism failure, also can appear dirty read phenomenon, isolation mechanism failure



Then test the repeatable read (repeatable read)
Modify the right transaction isolation mechanism, delete the Dog form, again into the transaction

Test is added in the Cat on the left, the right to see

On the left to create Dog form

Until both sides are submitted to see


Conclusion: test affairs read committed will be out of the dirty read first, not repeatable read, phantom read, also can appear the transaction isolation mechanism, solve the problem of
  • Related