Quarantine database and ACID transactions

A, ACID

A: Atomicity Atomicity

  We divided into atomic transactions, like, say, a transfer of money to b, can not appear a deduction did not receive money b. All aspects of an error in any transaction must be rolled back.

C: Consistency Consistency

  Transaction must make database changes from one consistent state to another consistent state. For example transfer money to each other between a and b, while the total assets of a and b are so many 100w,

So how transfer will not say the sum of the deployment 100w

I: Isolation Isolation

  Isolation is when multiple users concurrent access to the database, for example, when operating with a table, open the database for each user transaction can not be interfered with the affairs of other operations, to be isolated from each other between multiple concurrent transactions.

D: Durability Persistence

  Persistence refers to a transaction once it is submitted changes to the data in the database is permanent, even in the case of a database system experienced a failure of the operation will not be lost on the transaction.

Second, dirty reads, non-repeatability and phantom read

For the above isolation I, because of the following situations, several isolation mechanism can be made

Dirty read:

A read transaction data transaction has not yet been submitted b

Let's say I give you turn a million, have not submitted, this time you see more than one million very happy, but I found the wrong person to withdraw to the turn, you attend to this process did not submit transaction data

Non-repeatable read

For some data in the database, a transaction query has returned multiple different data because the query interval, changed and committed by another transaction.

Non-repeatable reads and dirty reads difference is: the former to read the data submitted by others, which reads that stuff did not commit.

 

Guess you like

Origin www.cnblogs.com/daysn/p/11410625.html