LightMySky
به انگلیسی

Crash Recovery and Write-Ahead Logging

Durability is achieved by writing the intention to a log before touching the data pages. After a crash the system replays committed work and undoes the rest, which is how a commit can be trusted the moment it returns.

شروع یادگیری این موضوعبه حساب کاربری نیازی نیست. پیشرفت در همین مرورگر ذخیره می‌شود.

کارهایی که یادگیرنده بعد از این درس می‌تواند انجام دهد

  • Order the log write, the commit record and the page write, and say why
  • Walk through redo and undo for a log that ends mid-transaction
  • Explain what a checkpoint saves during recovery

۱ · بخوان

Durability is achieved by writing the intention to a log before a changed data page is written to disk. The order is strict: the log record first, then the page write, and the commit record only after every change of the transaction sits safely in the log. A commit can be trusted the moment it returns, because everything promised is already in the log.

Try it together

Picture a log with two transactions: one finished with a commit record, one cut off mid stream with none. Recovery replays the committed work step by step until the pages match what was promised, which is called redo. The unfinished work gets rolled back and its partial changes removed, which is called undo. When recovery ends, every committed transaction is present and no unfinished one left a trace.

The log goes first because pages can be lost in a crash while the log survives on safe storage. If the intention is in the log, the work can be rebuilt. If it is not in the log, the work never happened, and nothing is owed to anyone.

Replaying a huge log takes time, so the system takes checkpoints. At a checkpoint it writes all pending changes into the data pages and notes the spot in the log. Recovery then starts from the last checkpoint instead of from the beginning, replaying only what came after.

Write the log before the pages, redo the committed, undo the rest, and checkpoint so recovery starts late.

The rewritten reading was written for this dataset.

۲ · ببین

به انگلیسی

دور از صفحه‌نمایش

چاپ کاربرگکاغذ A4، با یک صفحهٔ جواب‌ها برای بزرگ‌ترها. بدون صفحه‌نمایش، بدون اینترنت.

جایگاه این موضوع

اول این‌ها را یاد بگیر

پیوندهای اختیاری

این موضوع راه این‌ها را باز می‌کند

سپس تمرین

۸ سؤال پشت این درس منتظرند، هر کدام با پاسخ توضیح‌داده‌شده. هر پاسخ آسمان را پر می‌کند: ستاره‌ها هنگام یادگیری روشن می‌شوند و وقتی زمان برگشتن است کمرنگ می‌شوند.

شروع یادگیری این موضوع