1-Sep-2013
Table of contents 1 Introduction About Berkeley DB Key Features Presence of Berkeley DB 2 Overview The Access Methods 3 Mpool Lock Log Transaction Recovery
About Berkeley DB Key Features Presence of Berkeley DB What is Berkeley Db? Reliable,scalable,flexible,fast data management Library that links directly into your application Enterprise database functionality with: Hands-off administration Programmatic configuration and management Ability to select features you use
About Berkeley DB Key Features Presence of Berkeley DB What is Berkeley Db? Reliable,scalable,flexible,fast data management Library that links directly into your application Enterprise database functionality with: Hands-off administration Programmatic configuration and management Ability to select features you use Data management hidden completely within your application
About Berkeley DB Key Features Presence of Berkeley DB Key Features Fast indexed and sequential lookup Concurrent access Transactional Support High availability Single-master, multi-reader replication Consistent distributed data Failover and load balancing to distributed data Trade network I/O for disk I/O
About Berkeley DB Key Features Presence of Berkeley DB Presence of Berkeley DB Figure: Berkeley Db Users
About Berkeley DB Key Features Presence of Berkeley DB Berkey DB in Open Source Applications Figure: Open source users
- Overview Access Methods Figure: Berkeley DB-5.0.21 Architecture
- Overview Access Methods Buffer Manager: Mpool Figure: Berkeley DB-5.0.21 Architecture
- Overview Access Methods Buffer Manager: Mpool Lock Manager : Lock Figure: Berkeley DB-5.0.21 Architecture
- Overview Access Methods Buffer Manager: Mpool Lock Manager : Lock Log Manager :Log + Dbreg Figure: Berkeley DB-5.0.21 Architecture
- Overview Access Methods Buffer Manager: Mpool Lock Manager : Lock Log Manager :Log + Dbreg Transaction Manager : Transaction Figure: Berkeley DB-5.0.21 Architecture
- Overview Access Methods Buffer Manager: Mpool Lock Manager : Lock Log Manager :Log + Dbreg Transaction Manager : Transaction APIs Figure: Berkeley DB-5.0.21 Architecture
Overview The Access Methods The Access Methods Btree Variable length, sorted, Key/data pairs Recno Integer key,variable or fixed length data Queue Integer Key, fixed length, Highly Concurrent produce/consume access Hash Variable Length,random access for truly huge, unordered data with no locality
The Buffer Manager: Mpool Mpool Lock Log Transaction Recovery in-memory buffer pool of file pages consistent representation format, similar to on-disk exporting filesystem abstraction through API DB-MPOOLFILE Write-Ahead Logging log records be propagated to disk before the actual data updates they describe helps in recovery after failure
The Lock Manager: Lock Mpool Lock Log Transaction Recovery Three key abstractions: locker, lock-object, conflict-matrix 1 Locker: on whose behalf a lock is being acquired 2 Lock-object : the item being locked 3 Conflict- Matrix : Notheld Read Write IWrite IRead IRW Notheld 0 0 0 0 0 0 Read 0 0 1 1 0 1 Write 0 1 1 1 1 1 Intent Write 0 1 1 0 0 0 Intent Read 0 0 1 0 0 0 Intent RW 0 1 1 0 0 0 Table: Conflict-Matrix
The Log Manager: Log Mpool Lock Log Transaction Recovery Provides the abstraction of a structured, append-only file. Log Sequnce Number(LSN) : pair of filenumbers and offset within the file. Provide efficient forward and backward traversal and retrieval by LSN Log-Record formatting: prepend log record header the record s length, the offset of the previous record a checksum for the log record
Mpool Lock Log Transaction Recovery The Transaction Manager: Transaction Transactions provide ACID properties: Atomicity A group of operations are applied to database as sigle unit Consistency Each Transaction sees a consistent view of the data Isolation Transactions are isolated from one another as if they were running sequentially Durability Once committed,transactions persist across application and system failure Checkpoint processing
Recovery Introduction Mpool Lock Log Transaction Recovery Goal : Move on-disk Db from potentially inconsistent state to a consistent state. textbftwo pass scheme:relative to the last checkpoint LSN, undo any txn that never committed and redo any txn that did commit.
Mpool Lock Log Transaction Recovery Thank You!