260 likes | 385 Vues
High-Concurrency Locking in R-Trees. Marcel Kornacker Universität Hamburg. Douglas Banks University of California at Berkeley. VLDB 1995. Presented by: Robertas Kerpys. November 11, 2010. Motivation. Query. p16. p10. p15. p14. p4. p5. p6. p7. p8. p9. p13. p11. p1. p2.
E N D
High-Concurrency Locking inR-Trees Marcel KornackerUniversität Hamburg Douglas Banks University of California at Berkeley VLDB 1995 Presented by: Robertas Kerpys November 11, 2010
Motivation Query p16 p10 p15 p14 p4 p5 p6 p7 p8 p9 p13 p11 p1 p2 p3 p12 R2 p16 R1 R6 R5 R3 R7 R4 Database Specialization Course
Motivation Query p16 p10 p15 p14 p4 p5 p6 p7 p8 p9 p13 p11 p1 p2 p3 p12 R2 p16 R1 R6 R5 R3 R7 R4 Database Specialization Course
Motivation Query p16 p10 p15 p14 p13 p4 p5 p6 p7 p8 p9 p11 p1 p2 p3 p12 R2 R1 R6 R5 R3 R8 R7 R4 Database Specialization Course
Motivation • Concurrency requires special handling of the index structure to ensure consistency • Many of the methods which offers concurrent tree traversal employ top-down lock-coupling • Main goal is to enable queries and updates execute concurrently while ensuring the correctness of the results Database Specialization Course
Overview • Motivation • B-link tree • R-link tree • Algorithms (Search, Insert, Delete) • Empirical study • Conclusion • Critique Database Specialization Course
Blink - tree Database Specialization Course
Obstacles p10 p13 p8 p7 p6 p5 p9 p4 p11 p1 p2 p3 p12 • The main difficulty is that R-tree does not have a linear ordering • Keys cannot conclusively tell us when a node has split R2 R1 R6 R5 R3 Database Specialization Course R7 R4
How to adapt links on an R-tree? • System of sequence numbers is introduced to determine when and how to traverse sibling links Database Specialization Course
Structure of an R-link tree p1 p2 z w y x 4 2 5 1 c1 c2 c3 c4 c5 5 6 4 2 1 Database Specialization Course
Search Stack x y w z Qualifyingentries: y z w x 1 2 4 5 p1 p2 c3 c5 c2 c1 c2 c3 c4 c5 5 6 4 2 1 Database Specialization Course
Insertion insert(Rect r): stack = findLeaf(root, r, root-lsn) leaf = pop(stack) insert r on leaf if leaf was split extendParent(leaf, leaf.MBR, leaf.LSN, right_sibling, right_sibling.MBR, right_sibling.LSN, stack) else if bounding-rect of leaf changed updateParent(leaf, leaf.MBR, stack) else w-unlock(leaf) Database Specialization Course
Insertion. Find Leaf findLeaf(root, r, root-lsn) - exclusive lock - shared lock Stack: N N N1 N1 N2 N3 N4 N4 N5 N6 N7 Database Specialization Course
Insertion. Extend Parent extendParent - exclusive lock - shared lock Stack: N N1 N N1 N2 R8 N3 N8 N4 N5 N6 N7 Database Specialization Course
Deletion • A combination of the search and insert algorithms • Nodes are removed as soon as they become empty • In order to not employ the lock-coupling when descending the tree we have to take care of invalid pointers when removing nodes • A tree-global generation counter (TGC) is introduced Database Specialization Course
Deletion TGC N N1 N2 R8 N3 N4 N5 N6 N7 p1 p2 p3 p4 N = 9 N4 = 10 N4 = 9 N1 = 9 N5 = 9 10 9 N2 = 9 N6 = 9 N3 = 9 N7 = 9 Database Specialization Course
Overview • Motivation • B-link tree • R-link tree • Algorithms (Search, Insert, Delete) • Empirical study • Conclusion • Critique Database Specialization Course
Experimental Setup • R-tree implementation employs a variation of Bayer-Schkolnick-style lock-coupling for concurrent insertions • Three different workloads: • The low-contention workload consists of a varying number of searchers and a single inserter • The moderate-contention workload of inserters only • The high-contention workload of an equal number of searchers and inserters • The index was pre-loaded with 30600 2-dimensional non-overlapping rectangles Database Specialization Course
Empirical Evaluation Database Specialization Course
Empirical Evaluation (cont.) Database Specialization Course
Related Work • Blink – tree “Efficient Locking for Concurrent Operations on B-trees” by Philip L. Lehman, S. Bing Yao • Applied on B-trees • All ideas are drawn from this paper Database Specialization Course
Conclusion • R-link trees look and work similar to B-link trees • Holds only a few locks at one time • Descending an R-link tree to a leaf requires no lock-coupling Database Specialization Course
Critique. Advantages • Recovery is addressed • R-link tree was implemented for commercial database • Examples were good and where needed Database Specialization Course
Critique. Disadvantages • Workload is to small (30600 rectangles which does not even overlap) • Authors review only papers for concurrency in B-trees • They did not implemented everything they talked about • The notation in pseudo-code is not introduced in the text thus it was not obvious right away e.g. r-lock Database Specialization Course
Thank you! Database Specialization Course
Questions?Spørgsmål?Întrebare? Klausimai? Database Specialization Course