200417 Introduction to databases : Transaction
???? 2020/04/17
????课件 ch17 & 18
graph database
CH17
Transaction
Transaction concept
ACID Properties
Transaction State
Schedules
Schedule 1
Schedule 2
Schedule 3
Schedule 4
Serializability
Simplified view of transactions
Conflicting Instructions
Conflict Serializability
conflict serializable example
NOT conflict serializable example
View Serializability
(prof skip)
Testing for Serializability
vertices 顶点/交点
precedence 优先
Test for Conflict Serializability
Test for View Serializability
(skip)
Recoverable Schedules
Cascading Rollbacks
Concurrency Control
Weak Levels of Consistency
Levels of Consistency in SQL-92
CH18
Concurrency Control
Lock-Based Protocols
Protocols 礼仪/规章制度
You can have multiple share locks at the same time, but you can ONLY have ONE exclusive lock.
Schedule With Lock Grants
Deadlock
The Two-Phase Locking Protocol
Deadlock
Deadlock Handling
Deadlock prevention protocols ensure that the system will never enter into a deadlock state. Some prevention strategies:
- Require that each transaction locks all its data items before it begins execution (pre-declaration).
- Impose partial ordering of all data items and require that a transaction can lock data items only in the order specified by the partial order (graph-based protocol).
Deadlock Detection
Deadlock Recovery
Multiple Granularity
Example of Granularity Hierarchy
Intention Lock Modes
Insert/Delete Operations and Predicate Reads
Phantom Phenomenon
Phantom Phenomenon Example
Handling Phantoms
Index Locking To Prevent Phantoms
Timestamp-Based Protocols
Validation-Based Protocols
NoSQL Databases
Introduction
One Taxonomy
Taxonomy 分类
CAP Theorem
CAP Theorem
Consistency Models
- tradeoff in the CAP theorem
So in a replicated database, I can get consistancy through locking, but I can’t function of this partition caz I can’t lock enough copies. And so that’s where the partition tolerance comes in. For availability, I need multiple copies. For consistency, I need to lock all the copies, which means I can’t tolerate partitions. So I can have consistency and availability, but not partition tolerance. If I have partition tolerance, by definition I can’t lock all the copies, which means I can’t have consistency. I can get partition tolerance and consistency, but not availabilty.