1. Transactions have ACID characteristics
2. Transaction isolation level 1) Definition and issues of isolation level
2) If you view the modification and isolation level of MySQL show variables like 'tx_isolation'; # View the isolation level, before MySQL8show variables like 'transaction_isolation'; # View the isolation level, before MySQL8 set global transaction_isolation='READ-COMMITTED'; // Set the isolation level, valve domain READ-UNCOMMITTED, READ-COMMITTED, REPEATABLE-READ, SERIALIZABLE The transaction isolation level can be at the Session level. We can set different levels for different Sessions: set session transaction isolation level read uncommitted; set session transaction isolation level read committed; set session transaction isolation level repeatable read; set session transaction isolation level serializable; 3) Spring transaction isolation level Spring transactions use the database isolation level by default. You can adjust the Session isolation level by annotating the isolation parameter in @Transactional. The isolation level is at the session level, and the JDBC java.sql.Connection interface supports the setting of the isolation level. When Spring starts a transaction (DataSourceTransactionManager.doBegin), it sets the isolation level of the Connection according to the annotation configuration: MySQL driver com.mysql.cj.jdbc.ConnectionImpl executes SQL statements to adjust the session-level isolation level 3. Deadlock Deadlock occurs when two or more transactions occupy the same resource and request to lock the resources occupied by each other, resulting in a vicious cycle. Deadlock example: # Transaction 1 start transaction; update account set money=10 where id=1; update account set money=20 where id=2; commit; # Transaction 2 start transaction; update account set money=10 where id=2; update account set money=20 where id=1; commit; Suppose by chance, transaction 1 and transaction 2 finish executing the first update statement at the same time, and then prepare to execute the second update statement, but find that the record has been locked by the other party. Then the two transactions wait for the other party to release resources while holding the lock required by the other party, which will cause an infinite loop. To avoid deadlock problems, the database implements various deadlock detection and deadlock over-length mechanisms. InnoDB handles deadlock by rolling back the transaction that holds the least row-level exclusive lock. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Xftp download and installation tutorial (graphic tutorial)
>>: Vue implements multiple selections in the bottom pop-up window
Copy code The code is as follows: <div id=&quo...
The worst option is to sort the results by time a...
Tag type (display mode) HTML tags are generally d...
Table of contents 1. A simplest server-side examp...
Table of contents Overview CommonJS Specification...
This article describes how to add or expand a dis...
background A colleague is working on his security...
1. Write a Mysql link setting page first package ...
Function Origin I was recently working on an H5 t...
Permission denied: The reason for this is: there ...
We often need to summarize data without actually ...
Recently, I learned about the Vue project and cam...
Table of contents 1. Generate a certificate 2. En...
Dockerfile is a text file used to build an image....
DCL (Data Control Language): Data control languag...