a block of operations on database objects
play

A block of operations on database - PDF document

A block of operations on database objects Foundation for concurrent execution and recovery from


  1. ����������� ��������������������� A block of operations on database objects ��������������� Foundation for concurrent execution and recovery from system failure Presenter ������������� Example Discussion Leader ������������ <begin transaction> Read(A) Oct 14, 2009 A=A050 Write(A) Read(B) B=B+50 Write(B) Adapted from slides from "Database Management System" by Ramakrishnan <end transaction> and Gehrke � ������������ ���������� ����������������������� � � ��������� Either all actions in the Xact occur, or none occur. � � ����������� If each Xact is consistent, and the DB starts in a consistent state, then the DB ends up being consistent. � � ��������� The execution of one Xact is isolated from that of other Xacts. � � ���������� If a Xact commits, then its effects persist. � � ��������������������������������� ��������������������� ������!�������"���# The goal of transaction recovery is to resurrect Simplicity 1. the db if this happens Operation Logging 2. Maintains atomicity and durability Flexible storage management 3. Job of recovery manager Partial rollbacks 4. Aries is one example of such a system Flexible buffer management 5. A key tenet of Aries in fine0granularity locking Recovery independence 6. for 4 reasons Logical undo 7. 1. OO systems make users think in small objects Parallelism and fast recovery 2. “Object0oriented system users may tend to have 8. many terminal interactions during ;” Minimal overhead 9. 3. More system use � more hotspots � require need Achieving them result in increased less tuning from DBA concurrency, reduced I/O dependence and 4. Metadata is accessed often; cannot all be locked at once efficient CPU and buffer usage � �

  2. �����$��� ���"������"�������������������� %��$���&�����'"��������� Transactions modify pages in memory buffers Considering the nine goals of Simplicity the system: Operation Logging Writing to disk is more permanent Which do you consider Flexible storage When should updated pages be written to disk? management most important? Force every write to disk? �������� ����� Partial rollbacks Are there any of these Flexible buffer Poor response time. goals that you would ����� ������� management But provides durability. remove? If so, why? Recovery Steal buffer0pool frames Are there any that you independence would add? from uncommitted Xacts? Logical undo ������� �������� What, if any, contradictions (resulting in write to disk) Parallelism and fast do you see between the recovery If not, poor throughput. goals? Minimal overhead If so, how can we ensure atomicity? '������$����(�&&��& �����)����$�(�&&��&� ��(# Record REDO and UNDO information, for every The Write0Ahead Logging Protocol: update, in a ���� � Must force log record for an update ������ Sequential writes to log (put it on a separate disk). the corresponding data page gets to disk. Minimal info (diff) written to log, so multiple updates fit � Must write all log records for a Xact ������ in a single log page. ������ . Log: An ordered list of REDO/UNDO actions #1 guarantees Atomicity. Log record contains: <XID, pageID, offset, length, old data, new data> #2 guarantees Durability. and additional control info (which we’ll see soon). Size of log is much smaller than the size of the pages affected by the updates being recorded by the log Log is maintained as a sequential file and results in sequential write to the stable storage ��(�*� (�&������$� �� ��� ����(�& ���� �������� ���������� Each log record has a unique Log ������ Possible log record types: Sequence Number (LSN). ������ ����������������� ����������� LSNs always increasing. ������ ��������������� prevLSN Each ��������� contains a pageLSN. transID ����� The LSN of the most recent �������������������������������������������� type ���� (signifies end of for an update to that page. pageID commit or abort) length ������ System keeps track of flushedLSN. offset ��������������� � ������� The max LSN flushed so far. ������� ���������� ���� before0image !�������"��!�# ������ WAL: ������ a page is written, after0image for UNDO actions pageLSN ≤ flushedLSN ������ before and after image are the data before and after the update. ��

  3. �������&�(�&�+������ ,�����(�&)������$����"��"��� ��������� Transaction manager also maintains the following tables Inserted when modifying a page. ������������������ Contains all the fields. Maintained by transaction manager pageLSN of that page is set to the LSN of the record. Has one entry per active Xact �������� Contains �������������� (running/committed/aborted), and When Xact commits a record is written in the log and is forcibly ����� ! (LSN of most recent log record for it) written to stable storage. Xact removed from table when end record is inserted in the log �������� ������"���������� created when Xact is aborted Maintained by buffer manager ����� Has one entry per dirty page in buffer pool created when Xact has completed all ‘clean up’ work (after commit or abort) Contains ���� ! 00 LSN of action which #���� made the page dirty ��������������������������������� Entry is removed when page is written to the disk Inserted before undoing an action described by an update log record Both tables must be reconstructed during recovery. It happens during aborting or recovery. Contains $���������� field: LSN of next log record to be undone. �� �� ����.������ ����'�&�����"���������-�������$������ Periodically �$��%����� , to minimize recovery time in system crash. Write to log: ��� ��� �����&�$��%����� record: when checkpoint began �� ���&�$��%����� record: current ����������� and ������ ���������� . �� !������ %��������� Aries uses a ‘ #�''���$��%����� ’: prevLSN ������� �� lastLSN transID Xacts continue to run; so these tables are accurate each status type only as of time of begin_checkpoint with a pageID Dirty pages are ��� forced to disk; pageLSN ������&� ������� length Store LSN of checkpoint record in a safe place ( ������ recLSN offset ������������� record). before0image When system starts after a crash: after0image Locate the most recent checkpoint Restore Xact table and dirty page table from there. �� �� ����������������'�&�����"�� ����"���������/"00������.����� ������ ��� Do you think that fuzzy checkpoints are a ����������� good idea? Would you use them? Why or �������� ���!� � ������������������������������� ����"���������� why not? Does it depend on the ����������������! circumstances? �#������� � "�����������#���������$ ���������� One alternative is a “full” checkpoint: all % &����������'�����(����� ����$������ ��%��������� ��������������������������)� updates block while checkpoint runs, all ����$��� '���������������������! pages are flushed to disk % �*�� ��� ������� � ���������������! ���������� % +��� ������������������(���� &���' � � + ������ �� ��

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend