Jim Gray于1981年VLDB描述了事务的原子性、一致性和持久性,在此基础上,Haerder和Reuter在1983年中提出了事务的隔离性并提出术语 “ACID”,自此,事务的ACID四个性质成为业内标准术语 。 磁盘IO能力决定数据库事务能力上限
WAL技术在实现AD同时,通过下面优化解决数据库性能问题:
把磁盘的随机操作改为顺序读写
引入缓存,尽量减少读写磁盘操作
PostgreSQL的WAL实现
WAL(Write Ahead Logging )
All log records pertaining to an updated page are written to non-volatile storage before the page itself is allowed to be overwritten in non-volatile storage.
A transaction is not considered to be committed until all of its log records(including its commit record) have been written to stable storage.
采用WAL协议的恢复算法: Dr. C. Mohan ARIES: Algorithms for Recovery and Isolation Exploiting Semantics, 1993, IBM DB2 MySQL的WAL实现
-- Scenario to test
Fix 2PC may be committed on coordinator, aborted on segments
— 1. session 1: COMMIT is blocked at start_insertedDistributedCommitted
-- 2. checkpointer: Start a CHECKPOINT and wait to reach before_wait_VirtualXIDsDelayingChkpt
-- 3. session 1: COMMIT is resumed
-- 4. checkpointer: CHECKPOINT is resumed and executes to keep_log_seg to finally introduce panic and perform crash recovery
核心点:
模拟并发
模拟故障注入,覆盖各种故障类型。
覆盖设计的全流程
一致性测试
ACID与CAP中的“C”的差别
https://jepsen.io/consistency
Highly Available Transactions: Virtues and Limitations 还有什么可以做的? 长稳测试&压力测试
组织保障: