1 / 9

Database System Principles 18.7 Tree Locking Protocol

Database System Principles 18.7 Tree Locking Protocol. CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115. Index. Motivation B-Tree Protocol Why it works Example Precedence graph Proof. Motivation. Data elements are not hierarchically stored by containment but rather they are DISJOINT.

zytka
Télécharger la présentation

Database System Principles 18.7 Tree Locking Protocol

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database System Principles18.7 Tree Locking Protocol CS257 Section 1 Spring 2012 Dhruv Jalota ID: 115

  2. Index • Motivation • B-Tree • Protocol • Why it works • Example • Precedence graph • Proof

  3. Motivation • Data elements are not hierarchically stored by containment but rather they are DISJOINT. • A B-TREE is the ideal data structure to represent such a database since traversal to reach any data element would require beginning at the root. • Two-phase locking in such a situation makes concurrent use of DB by transactions impossible

  4. B-TREE details • Basic DS: - Keeps records in sorted order - Uses partially full blocks to speed up insertion and deletion Locking structure: - Granularity is at node level. Smaller is not beneficial and entire tree is infeasible!

  5. Tree protocol • Transaction’s first lock can be any node • Subsequent locks only if currently locked parent • Nodes unlocked any time • Cannot relock if released node, even if parent is still held • (As we can see – NOT 2PL)

  6. Why it works • Implies a serial order on transactions in schedule • Define Ti < S Tj (order of precedence) • In schedule S, Ti and Tj lock common nodes, but Ti locks first

  7. Example • Figure 18.30 from text book. • And figure 18.31

  8. Precedence graph • Figure 18.32 from text book. • T1 < S T2 • T3 < S T2 • Acyclic graph means any topological order is an equivalent serial schedule • Thus, (T1, T3, T2) = (T3, T1, T2) • This is because nodes are touched in same order.

  9. Proof for acyclic precedence graph giving equivalent schedules • If two transactions lock several elements in common, then they are all locked in the same order • Figure 18.33

More Related