In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Four characteristics of business
Atomicity: All operations after the transaction starts are either done or not done, and it is impossible to stop at the intermediate link. An error during transaction execution rolls back to the state before the transaction started, and all operations are as if they never happened.
Consistency: The integrity constraints of the database are not broken before and after the transaction begins.
Isolation: Only one transaction is allowed to request the same data at a time, and different transactions do not interfere with each other.
Durability: After a transaction completes, all updates to the database are saved to the database and cannot be rolled back.
2. Concurrency of transactions
Dirty read: Transaction A reads the updated data of transaction B, and then B rolls back the operation, then the data read by A is dirty data.
Non-repeatable reads: (Transaction A reads the same data multiple times, and transaction B updates and commits the data during the multiple reads of transaction A, resulting in inconsistent results when transaction A reads the same data multiple times.) (emphasis: data modification)
Fantasy Reading: System Administrator A changed the scores of all students in the database from specific scores to ABCDE grades, but System Administrator B inserted a record of specific scores at this time. When System Administrator A finished changing, he found that there was still one record that had not been changed, as if an illusion had occurred. This was called illusion reading. (emphasis added or deleted)
Summary: Non-repeatable and phantom readings are easily confused. Non-repeatable readings focus on modification, while phantom readings focus on addition or deletion. To solve the problem of non-repeatable reading, we only need to lock the rows that meet the conditions. To solve the problem of magic reading, we need to lock the table.
MySQL transaction isolation level
READ UNCOMMITTED (uncommitted data readable, dirty read, these data are called dirty data)
READ COMMITTED (Submitted data readable, not re-read)
RePEATABLE READ The data seen during the execution of a transaction is always consistent with the data seen at the start of the transaction. Of course, uncommitted changes are invisible to other transactions at the repeatable read isolation level.
SERIALIZABLE (read operation will implicitly acquire shared lock, which can ensure mutual exclusion between different transactions, lock table, shortcomings are also obvious, efficiency problems)
The above is the four isolation levels in MySQL transactions in detail, more please pay attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.