Vous êtes sur la page 1sur 1

Atomicity.

Atomicity refers to concept that either all of the statements inside a transacti
on are completed, or none of them are performed. As with the previous example, i
n a banking system, the transfer of funds can be completed or it could fail. How
ever, the transfer of funds is not allowed to fail leaving the work half-done.
The atomicity property guarantees that one account will not be debited unless th
e other account is credited. Each transaction is said to be atomic(indivisible)
even though there are actually two statements, they act as if they are one state
ment. If any part of the transaction fails, the entire transaction must fail.
Consistency.
The consistency property ensures that the database moves from one consistent sta
te to another.
If the server were to fail while executing the transfer of money from Ziesel's acc
ount to Hudson's account, the database would be left in an inconsistent state. The
only way to resolve this inconsistency is to undo changes already made. Before
a transaction begins the database should be in a consistent state. Once the tran
saction either completes successfully or is rolled back the
database should still be in a consistent state.
In a transactional system (ACID-compliant by definition), if one or more stateme
nts in the transaction do not succeed, the entire transaction must be rolled bac
k to a consistent state.
If a transaction is successful, the database moves from one consistent state to
another.
Isolation.
The isolation property specifies that data being modified for one transaction ca
nnot be viewed
or modified by a second transaction until the completion of the first transactio
n. This is important to support concurrent execution of queries, which is critic
al in any modern database system. With isolation, separate transactions can run
at the same time without compromising the consistency of the data. In MySQL, the
level of isolation that transactions have can be configured. The meanings of di
fferent isolation levelsand how to set the isolation level are discussed in more
detail in the section ``Using Isolation Levels'' later in this chapter.
Durability.
Durability describes the principle that once a transaction has been successfully
completed, the results are recorded by the database server permanently. After t
his point the transaction is complete, and the data changes must survive even if
the database or operating system fails. This is important, because modern-day o
perating systems do not always perform operations immediately. If there is an op
erating system failure between the time that a transaction successfully complete
s and the time the data is actually written to the disk permanently, the databas
e has marked the transaction as complete but the data has not been changed appro
priately.

Vous aimerez peut-être aussi