Concept of transaction processing

xiaoxiao2021-03-06  105

What is a transaction? In most environments, the transaction is actually a business process, which consists of a database operation of a set of logical work units, which typically requires cross-object operation, or accessing multiple resources, such as: 1, inserted in the table New record. 2, insert a new record in the table. 3, update the C table a few records ... Waiting for a series of operations If the database system does not encounter an error during the run, all modifications in the transaction will take effect, permanently submit to the database. If the system encounters an error or a crash, all the operations in the transaction will roll back, and no modifications will be made to the database data in the database. One sentence is: all the operations in the transaction, either all take effect, or all do not take effect.

The ACID attribute of the transaction, guarantees a business that will never be incomplete, the data will never be inconsistent, concurrent a business is independent, and the effect of a transaction is lasting. # Atomicity: A transaction is to be completely unspetructed or undo. In the case where an error occurs in any operation, the effect of all operations constituting the transaction must be revoked, and the data should be rolled back to the previous state. # Consisters: A transaction should protect all unchanged properties defined on the data (eg, integrity constraints). When a successful transaction is completed, the data should be in a consistent state. In other words, a transaction should switch the system from one consistent state to another. For example, in the case of a relational database, a consistent transaction will protect all integrity constraints on the data. # Isolation: There may be multiple transactions in the same environment, and each transaction should be independently executed. The effect of serial execution a series of transactions should be performed with concurrent execution. This requires two things: 1. During a transaction execution, the middle of the data (possibly inconsistent) status should not be exposed to all other transactions. 2. Two concurrent transactions should not operate the same data. The database management system usually uses a lock to implement this feature. # 持 性 (Durability): The effect of a completed transaction should be lasting.

转载请注明原文地址:https://www.9cbs.com/read-104101.html

New Post(0)