SlideShare a Scribd company logo
BUFFER MANAGEMENT-
DATABASE BUFFERING
Submitted by
Balasara Kshiar
MCA 4th
Sem
Database Buffering
Database Buffering contd..
• Advantages of no-force policy:
Faster commit of transaction.
Reduce the number of output operations
to disk.
Database Buffering contd..
• No-Steal policy:
– Blocks modified by a transaction that is still active
should not be written to disk.
• Steal-policy:
Modified blocks written to disk even if
transaction has not committed.
Database Buffering contd..
• Disadvantage of no-steal policy:
Buffer may be full of updated pages which
cannot be written to disk.
Database Buffering contd..
Steal policy needs to implement write-ahead logging(WAL)
rule.
• Ti enters commit state after <Ti commit> log record has
been o/p to stable storage
• Before <Ti commit> log record can be o/p to stable storage,
all log records pertaining to transaction Ti must have been
o/p to stable storage
• Before a block of data in main memory can be o/p to
database, all log records pertaining to data in that block
must have been o/p to stable storage
Database Buffering contd..
Example showing the need for WAL rule:
Let To be a transaction that transfers Rs.50
from account A to B
To :
read(A);
A:=A-50;
Write(A);
read(B);
B:=B+50;
write(B);
Database Buffering contd..
• Log record:
<T0 start>
<T0, A, 1000,950>
<T0, B, 2000,2050>
<T0 commit>
Database Buffering contd..
• Suppose state of the log is:
<T0 start>
<T0, A, 1000,950>
To issues a read(B).
B is not in memory and memory is full.
A is output to disk and system crash.
A-950,B-2000 -->inconsistent.
But using WAL rule it will not be inconsistent.
Database Buffering contd..
• No write to the block when the block is being output to
disk.
Lock the block when a write operation is in process. Then
released when done.
• When a block is output,no write operation is
performed.
These are ensured by special means of locking.
– Lock the block.
– log records to stable storage.
– Output block to disk.
– Release the lock.
Database Buffering contd..
• Latches:
Locks that are held for short duration.
• Locks are also needed when checkpoint is
in progress.
THANKYOU…

More Related Content

What's hot

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
sangrampatil81
 
File access method
File access methodFile access method
File access method
GayathriS578276
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
Priyanka bisht
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMSkoolkampus
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
Kumar Pritam
 
Multiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesMultiversion Concurrency Control Techniques
Multiversion Concurrency Control Techniques
Raj vardhan
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
Janki Shah
 
Time advance mehcanism
Time advance mehcanismTime advance mehcanism
Time advance mehcanism
Nikhil Sharma
 
Buffering.pptx
Buffering.pptxBuffering.pptx
Buffering.pptx
HarleenKaur183313
 
Client Centric Consistency Model
Client Centric Consistency ModelClient Centric Consistency Model
Client Centric Consistency Model
Rajat Kumar
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
Prem Kumar Badri
 
Vision of cloud computing
Vision of cloud computingVision of cloud computing
Vision of cloud computing
gaurav jain
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
Chetan Mahawar
 
File organization 1
File organization 1File organization 1
File organization 1
Rupali Rana
 
Dynamic storage allocation techniques
Dynamic storage allocation techniquesDynamic storage allocation techniques
Dynamic storage allocation techniquesShashwat Shriparv
 
Query processing
Query processingQuery processing
Query processing
Dr. C.V. Suresh Babu
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
Rahul Narang
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
duvvuru madhuri
 
Real time and distributed design
Real time and distributed designReal time and distributed design
Real time and distributed design
priyapavi96
 
08 virtual memory
08 virtual memory08 virtual memory
08 virtual memoryKamal Singh
 

What's hot (20)

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
File access method
File access methodFile access method
File access method
 
Presentation on Segmentation
Presentation on SegmentationPresentation on Segmentation
Presentation on Segmentation
 
13. Query Processing in DBMS
13. Query Processing in DBMS13. Query Processing in DBMS
13. Query Processing in DBMS
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Multiversion Concurrency Control Techniques
Multiversion Concurrency Control TechniquesMultiversion Concurrency Control Techniques
Multiversion Concurrency Control Techniques
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Time advance mehcanism
Time advance mehcanismTime advance mehcanism
Time advance mehcanism
 
Buffering.pptx
Buffering.pptxBuffering.pptx
Buffering.pptx
 
Client Centric Consistency Model
Client Centric Consistency ModelClient Centric Consistency Model
Client Centric Consistency Model
 
C# Framework class library
C# Framework class libraryC# Framework class library
C# Framework class library
 
Vision of cloud computing
Vision of cloud computingVision of cloud computing
Vision of cloud computing
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
 
File organization 1
File organization 1File organization 1
File organization 1
 
Dynamic storage allocation techniques
Dynamic storage allocation techniquesDynamic storage allocation techniques
Dynamic storage allocation techniques
 
Query processing
Query processingQuery processing
Query processing
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
 
Real time and distributed design
Real time and distributed designReal time and distributed design
Real time and distributed design
 
08 virtual memory
08 virtual memory08 virtual memory
08 virtual memory
 

Similar to Buffer management --database buffering

DBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.pptDBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.ppt
HemakanisiriA3124
 
Recovery
RecoveryRecovery
Recovery
Ram Sekhar
 
Recovery & Atom city & Log based Recovery
Recovery & Atom city & Log based RecoveryRecovery & Atom city & Log based Recovery
Recovery & Atom city & Log based Recovery
Meghaj Mallick
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
Maham Huda
 
Transection management
Transection managementTransection management
Transection management
RahulGandhi110
 
19.TRANSACTIONs.ppt
19.TRANSACTIONs.ppt19.TRANSACTIONs.ppt
19.TRANSACTIONs.ppt
AkhilNameirakpam
 
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and LockingGeek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
IDERA Software
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
pusp220
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
khoahuy82
 
Recovery system
Recovery systemRecovery system
Recovery system
lalithambiga kamaraj
 
recovery system
recovery systemrecovery system
recovery system
shreeuva
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
Ravimuthurajan
 
Data base recovery
Data base recoveryData base recovery
Data base recovery
Visakh V
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
AdemeCheklie
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Ceph Community
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Patrick McGarry
 
Toku DB by Aswin
Toku DB by AswinToku DB by Aswin
Toku DB by Aswin
Agate Studio
 

Similar to Buffer management --database buffering (20)

DBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.pptDBMS UNIT 5 CHAPTER 3.ppt
DBMS UNIT 5 CHAPTER 3.ppt
 
Recovery
RecoveryRecovery
Recovery
 
Recovery & Atom city & Log based Recovery
Recovery & Atom city & Log based RecoveryRecovery & Atom city & Log based Recovery
Recovery & Atom city & Log based Recovery
 
Backing Up and Recovery
Backing Up and RecoveryBacking Up and Recovery
Backing Up and Recovery
 
Unit 07 dbms
Unit 07 dbmsUnit 07 dbms
Unit 07 dbms
 
Transection management
Transection managementTransection management
Transection management
 
19.TRANSACTIONs.ppt
19.TRANSACTIONs.ppt19.TRANSACTIONs.ppt
19.TRANSACTIONs.ppt
 
ch-5 advanced db.pdf
ch-5 advanced db.pdfch-5 advanced db.pdf
ch-5 advanced db.pdf
 
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and LockingGeek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
Geek Sync | How to Detect, Analyze, and Minimize SQL Server Blocking and Locking
 
Database recovery techniques
Database recovery techniquesDatabase recovery techniques
Database recovery techniques
 
7. transaction mang
7. transaction mang7. transaction mang
7. transaction mang
 
Recovery system
Recovery systemRecovery system
Recovery system
 
recovery system
recovery systemrecovery system
recovery system
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
Data base recovery
Data base recoveryData base recovery
Data base recovery
 
ch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.pptch 5 Daatabase Recovery.ppt
ch 5 Daatabase Recovery.ppt
 
Unit 06 dbms
Unit 06 dbmsUnit 06 dbms
Unit 06 dbms
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
 
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack CloudJourney to Stability: Petabyte Ceph Cluster in OpenStack Cloud
Journey to Stability: Petabyte Ceph Cluster in OpenStack Cloud
 
Toku DB by Aswin
Toku DB by AswinToku DB by Aswin
Toku DB by Aswin
 

Recently uploaded

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 

Recently uploaded (20)

Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 

Buffer management --database buffering

  • 1. BUFFER MANAGEMENT- DATABASE BUFFERING Submitted by Balasara Kshiar MCA 4th Sem
  • 3. Database Buffering contd.. • Advantages of no-force policy: Faster commit of transaction. Reduce the number of output operations to disk.
  • 4. Database Buffering contd.. • No-Steal policy: – Blocks modified by a transaction that is still active should not be written to disk. • Steal-policy: Modified blocks written to disk even if transaction has not committed.
  • 5. Database Buffering contd.. • Disadvantage of no-steal policy: Buffer may be full of updated pages which cannot be written to disk.
  • 6. Database Buffering contd.. Steal policy needs to implement write-ahead logging(WAL) rule. • Ti enters commit state after <Ti commit> log record has been o/p to stable storage • Before <Ti commit> log record can be o/p to stable storage, all log records pertaining to transaction Ti must have been o/p to stable storage • Before a block of data in main memory can be o/p to database, all log records pertaining to data in that block must have been o/p to stable storage
  • 7. Database Buffering contd.. Example showing the need for WAL rule: Let To be a transaction that transfers Rs.50 from account A to B To : read(A); A:=A-50; Write(A); read(B); B:=B+50; write(B);
  • 8. Database Buffering contd.. • Log record: <T0 start> <T0, A, 1000,950> <T0, B, 2000,2050> <T0 commit>
  • 9. Database Buffering contd.. • Suppose state of the log is: <T0 start> <T0, A, 1000,950> To issues a read(B). B is not in memory and memory is full. A is output to disk and system crash. A-950,B-2000 -->inconsistent. But using WAL rule it will not be inconsistent.
  • 10. Database Buffering contd.. • No write to the block when the block is being output to disk. Lock the block when a write operation is in process. Then released when done. • When a block is output,no write operation is performed. These are ensured by special means of locking. – Lock the block. – log records to stable storage. – Output block to disk. – Release the lock.
  • 11. Database Buffering contd.. • Latches: Locks that are held for short duration. • Locks are also needed when checkpoint is in progress.