What is Transaction
- A transaction is a sequence of events that are performed as one indivisible unit
- A transaction either commits ( all of its events are performed at once ) or aborts ( none of its events take effect ) .
ACID property
- Atomicity : either all events of a transaction (Tx) take effect or none of them ( all or nothing).
- Consistency : if a Tx commits, the result is a valid configuration of the system. In other words, each successful Tx commits only legal results.
- Isolation: Events within a Tx must be hidden from other Txs running concurrently
- Durability : Once a Tx has committed, the system must guarantee that this Tx survives any subsequent malfunctions.
- Several challenge in guaranteeing the ACID property
- Failures of disks, servers and communication in both clients and / or server
- Concurrency control: a server deals with multiple Txs ( from different clients ) at the same time
- Transactions may be distributed across multiple servers
Consistency model

一致性模型. 从根结点开始, 左半部分是属于ACID中的Isolation, 右半部分属于CAP中的Consistency
- Unavailable: 当出现⽹络隔离等问题的时候,为了保证数据的⼀致性,不提供服务。
- Sticky Available: 即使⼀些节点出现问题,在⼀些还没出现故障的节点,仍然 保证可⽤,但需要保证 client 的操作是⼀致的。
- Highly Available: 就是⽹络全挂掉,在没有出现问题的节点上⾯,仍然可⽤。
粉色框中的模型属于Unavailable, 黄色框中的模型属于Sticky Available, 蓝色框中的属于Highly Available
Consistency phenomena