In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Transaction is the basic unit of concurrency control.
The so-called transaction, it is a sequence of operations, these operations are either performed or not performed, it is an indivisible unit of work. For example, bank transfers: deduct money from one account and add money to another account, both of which are either performed or not performed.
Database transactions must have ACID features, and ACID is an acronym for Atomic, Consistency, Isolation and Durability.
Atomicity: means that the entire database transaction is an indivisible unit of work. Only when all the operations in the database are executed successfully can the whole transaction be considered successful; if any SQL statement in the transaction fails, the SQL statement that has been successfully executed must also be undone, and the database state should be returned to the state before the transaction was executed.
Consistency: database transactions cannot break the integrity of relational data and the consistency of business logic. For example, for bank transfer transactions, regardless of the success or failure of the transaction, the total deposits of Tom and Jack in the ACCOUNTS table should be guaranteed to be 2000 yuan after the transaction ends.
Isolation: in a concurrent environment, when different transactions manipulate the same data at the same time, each transaction has its own complete data space. Changes made by concurrent transactions must be isolated from changes made by any other concurrent transactions. When a transaction views data updates, the state of the data is either before another transaction modifies it, or after another transaction modifies it, and the transaction does not view the data in the intermediate state.
Persistence: this means that as long as the transaction ends successfully, the updates it makes to the database must be saved permanently. Even if a system crash occurs, the database can be restored to the state it was when the transaction ended successfully after restarting the database system.
The ACID feature of a transaction is realized by a relational database management system (RDBMS, database system). The database management system uses logs to ensure the atomicity, consistency and persistence of transactions. The log records the updates made by the transaction to the database. If an error occurs during the execution of a transaction, the update made by the transaction to the database can be undone according to the log, making the database return to the initial state before the execution of the transaction.
The database management system uses the lock mechanism to realize the isolation of transactions. When multiple transactions update the same data in the database at the same time, only the transaction that holds the lock is allowed to update the data, and other transactions must wait until the previous transaction releases the lock before other transactions have a chance to update the data.
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.