80 mid-year marriage four pieces: watches, bicycles, sewing machine, radio (three Turn One Ring). It takes four things to get a business home, so the business is mean (ACID), four-piece list: atomicity ( Atom), consistency (Consistent), Isolation (Isolate), persistence (D urable). acid is the abbreviation for the four basic elements that a database transaction performs correctly.
- Atomicity: Either don't talk, want to talk about getting married!
For their data modifications, either all are executed, or none are executed. If the system only performs a subset of these operations, it may break the overall goal of the transaction. The most typical problem is the bank transfer problem.
- Consistency: How to love me when I'm in love;
What kind of constraints the database has, and the need for such a constraint after the transaction is executed, all rules must be applied to the modification of the transaction to maintain the integrity of all the data. At the end of a transaction, all internal data structures (such as B-tree indexes or doubly linked lists), integrity constraints (indexes, primary keys) must be consistent.
- Isolation: After the bridal chamber, it is two people's private affairs.
The state in which the data is located when the transaction is viewing the data, either when another concurrent transaction modifies its state or after another transaction modifies it, and the transaction does not view the data in the middle state. The highest isolation level is obtained when the transaction is serializable. Isolation is relatively complex in the transaction mechanism, as described below.
- Persistence: Once the marriage certificate has been brought, cannot regret.
Modifications are maintained even if a fatal system failure occurs. Do not tell me the system said that the commit succeeded, the phone back to tell me that the server room power outage, my transaction involves the data modification may not enter the database.
MySQL database transaction detailed