tailieunhanh - Bài giảng Thiết kế và quản trị cơ sở dữ liệu - Chương 6: Crash Recovery
Chương này trình bày những nội dung chính như: Transaction, how can constraints be violated? failures, transaction log, checkpoint, undo-logging rules, undo logging recovery rules, undo-logging & checkpoint,.và một số nội dung khác, . | Crash Recovery Vu Tuyet Trinh trinhvt@ Department of Information Systems, Faculty of Information Technology Hanoi University of Technology Transaction collection of action that preserve consistency Consistent DB T Consistent DB’ with assumption IF THEN T starts with consistent state + T executes in isolation T leaves consistent state 1 How can constraints be violated? Transaction bug DBMS bug Hardware failure ., disk crash Data sharing ., T1 and T2 in parallel Failures Events Desired Undesired Expected Unexpected processor CPU memory disk M D 2 Recovery Maintaining the consistency of DB by ROLLBACK to the last consistency state. Ensuring 2 properties Atomic Durability Using LOG Transaction Log A sequence of log record keeping trace of actions executed by DBMS Log the beginning of the transaction execution transaction is already finished Transaction is calcel Transaction makes an update actio, before update X=v, after update x = w 3 Transaction Log Handled in main memory and put to external memory (disk) when possible A = 8 16 B = 8 16 Actions Data Log Log Disk Memory Checkpoint Definition: Objective moment where intermediate results and a log record are saved to disk. being initiated at specified intervals minimize the amount of time and effort wasted when restart the process can be restarted from the latest checkpoint rather than from the beginning. Log record or 4 Undo-logging Step Action t Mem A 8 8 16 16 Mem B Disk A Disk B 8 8 8 8 8 8 8 8 8 1 5 Read(B,t) 8 16 16 8 6 t:=t*2 16 16 8 8 8 7 16 16 16 8 8 8 Write(B,t) Flush log 9 Output(A) 16 16 16 16 8 10 Output(B) 16 16 16 16 16 2 3 4 Read(A,t) t:=t*2 Write(A,t) 11 12 Mem Log Flush log Undo-Logging Rules (1) For every action generate undo log record (containing old value) (2) Before X is modified on disk, log records pertaining to X must be on .
đang nạp các trang xem trước