Four characteristics of the transaction database

A: Atomicity (Atomicity)

A transaction is the smallest unit of execution of the database can not be divided, this unit contains a series of operations (DML), atomic data transactions to ensure the successful implementation of either simultaneously or failed at the same time, in simple terms: when the database will operate on the data write operations to a log (this log may be non-traditional log cache may file) saved, if the middle of a transaction fails, the database will be back through the log, will perform a successful operation revoked jargon termed is (rollback), if all transactions are executed successfully, can be submitted to the database by saving the successful implementation of the commit operation, technical terms (persistent), once the data is persisted during the rollback will not

PS: To sum up the word atomic transaction guarantees colleagues while performing either succeeds or fails at the same time

Two: Consistency (Consistemcy)

If the transaction is likened to a door, a, b, c as a whole through the door, after a successful pass through, it becomes the A, B, C; then we run, before the transaction is finished, abc three remain consistent, after the transaction is finished, ABC three remain consistent. For database transaction, the inconsistent AbC or abC and other impossible;

Then we can consider: atomicity is to ensure transactional consistency! !
PS: To sum up the results of a word read the same data for different transactions before and after the transaction execution is the same

Three: Persistent (Durability)

In simple terms, the transaction is committed, the data is actually stored in the database (What is done can not be undone up), you can not roll back the (then still ended up cooked raw rice ??)

 PS: To sum up in a word for the data in the database will be permanent rollback may not have changed after the transaction submitted by commit

Four: Isolation

This feature Let me give an example: There is a bathroom (not peek out), assume that you can only go in one person, before this came out, another person can not go, then have that person go simply do not have to worry about being others see the light, because the bathroom. he was alone. But others will wait outside, obviously not enough bathrooms; then we are not separated into the bathroom room partition, it is not a lot of people can together into the bathroom, cut off between the use of different bath ~ (of course, a room partition or just allow a person to go)

We returned to the transaction database, the database will think of a way to open concurrently executing transaction isolation, does not affect each other before the execution! If there are two identical transactions, in the same period of time, perform the same function, this time the transaction isolation play a role, it will ensure that only you can use the system each transaction believe in the system. This property is sometimes referred to as serialization, in order to prevent confusion between the transaction operations, or be serialized serialized request, so that only one request at the same time for the same data. By setting the isolation level of the database, you can achieve different effects of isolation (the latter chapters will talk about the isolation level and transaction propagation mechanism spring).
PS: To sum up in one sentence between different transactions are completely independent operation of different transaction operation is not to harass the rest of the affairs

 

Guess you like

Origin www.cnblogs.com/SR-Program/p/11995700.html