Docsity

Database System Recovery - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Partial preview of the text

Download Database System Recovery - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

5. Database SystemRecovery^ Transaction Processingfor E-Commerce

Outline

1. Introduction2. Recovery Manager3. Two Non-Logging Algorithms4. Log-based Recovery5. Media Failure

Assumptions

-^ Two-phase locking, holding write locks until after a^ transaction commits. This implies^ –^ recoverability^ –^ no cascading aborts^ –^ strictness (never overwrite uncommitted data) •^ Page-level everything (for now)^ –^ page-granularity locks^ –^ database is a set of pages^ –^ a transaction’s read or write operation operates on an entirepage^ –^ we’ll look at record granularity later

Storage Model • Stable database - survives system failures • Cache (volatile) - contains copies of some pages,which are lost by a system failure Stable DatabaseLog

Read, Write Fetch, FlushPin, Unpin, DeallocateCache Manager

Cache Read, Write

The Cache • Cache is divided into page-sized slots. • Dirty bit tells if the page was updated since it was last written to disk. • Pin count tells number of pin ops without unpins Page Dirty Bit Cache Address^

Pin Count P^1

P^0

P^1

-^ Fetch(P) - read P into a cache slot. Return slot address.•^ Flush(P) - If P’s slot is dirty and unpinned, then write it todisk (i.e. return after the disk acks)

Cache (cont’d) • Pin(P) - make P’s slot non-flushable & non-replaceable. – Non-flushable because P’s content may be inconsistent – Non-replaceable because someone has a pointer into P or isaccessing P’s content. • Unpin(P) - releases it. • Deallocate(P) - allow P’s slot to be reused (even if dirty)

Latches

-^ A latch is a short-term lock that gives its owner^ access to a page. •^ A read latch allows the owner to read thecontent. •^ A write latch allows the owner to modify thecontent. •^ The latch is usually a bit in a control structure,not an entry in the lock manager. It can be setand released much faster than a lock. •^ There’s no deadlock detection for latches.