Flamme
Flamme

Reputation: 359

Difference between Steal/No-Steal and Force/No-Force policies in database recovery

It is said that No-Steal policy means that transaction's updated buffer block is not written to the disk before the transaction commits and No-Force policy has a similar definition.

What's the difference between them?

Upvotes: 32

Views: 24441

Answers (3)

Peyman Mohamadpour
Peyman Mohamadpour

Reputation: 17964

They may look similar, but they are not the same.

Look at this diagram:

Steal & No-Steal and Force & No-Force

Transaction's buffer blocks ...

  • Steal: can be moved into the disk, as soon as it starts.
  • No-Steal: cannot be moved into the disk, until it commits.
  • Force: should be moved into the disk no later than when it commits.
  • No-Force: can be moved into the disk, even after it commits.

Key points:

  • Steal / Force is used in Immediate Database Modification (IDM) method
  • Steal / No-Force is widely used in most systems (It is used in IDM too).
  • No-Steal / Force has the worst performance.
  • No-Steal / No-Force is used in Deferred Database Modification (DDM) method.

Upvotes: 3

urgentx
urgentx

Reputation: 3931

Suppose a transaction T1 wants to read a data object X, but the working memory is full with all the other transactions' work. So T1 needs to clear some memory, which it does by kicking some other page in working memory to stable storage. This can be dangerous, because we can't be sure that what T1 is pushing to stable storage has been committed yet. This is known as stealing.

Forcing means that every time a transaction commits, all the affected pages will be pushed to stable storage. This is inefficient, because each page may be written by many transactions and will slow the system down.

Most crash recovery uses a steal/no-force approach, accepting the risks of writing possibly uncommitted data to memory to gain the speed of not forcing all commit effects to memory.

Upvotes: 70

user5516470
user5516470

Reputation:

In no-force approach, the updated page is not written to disk even after the transaction is committed. It is done to reduce I/O overhead.

Upvotes: -2

Related Questions