15 721
play

15-721 DATABASE SYSTEMS Lecture #08 Latch-free OLTP Indexes - PowerPoint PPT Presentation

15-721 DATABASE SYSTEMS Lecture #08 Latch-free OLTP Indexes (Part II) Andy Pavlo / / Carnegie Mellon University / / Spring 2016 @Andy_Pavlo // Carnegie Mellon University // Spring 2017 2 TODAYS AGENDA Bw-Tree Index ART Index


  1. 15-721 DATABASE SYSTEMS Lecture #08 – Latch-free OLTP Indexes (Part II) Andy Pavlo / / Carnegie Mellon University / / Spring 2016 @Andy_Pavlo // Carnegie Mellon University // Spring 2017

  2. 2 TODAY’S AGENDA Bw-Tree Index ART Index Profiling in Peloton CMU 15-721 (Spring 2017)

  3. 3 OBSERVATION We cannot have reverse pointers in a latch-free concurrent Skip List because CaS can only update a single address at a time. CMU 15-721 (Spring 2017)

  4. 4 BW-TREE Latch-free B+Tree index → Threads never need to set latches or block. Key Idea #1: Deltas → No updates in place → Reduces cache invalidation. Key Idea #2: Mapping Table → Allows for CAS of physical locations of pages. THE BW-TREE: A B-TREE FOR NEW HARDWARE ICDE 2013 CMU 15-721 (Spring 2017)

  5. 5 BW-TREE: MAPPING TABLE Mapping Table Index Page PID Addr 101 101 102 103 102 104 104 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  6. 5 BW-TREE: MAPPING TABLE Mapping Table Index Page PID Addr 102 104 101 102 103 102 104 104 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  7. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page produces a new delta. PID Addr 101 102 103 104 Page 102 Logical Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  8. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page produces a new delta. PID Addr 101 102 ▲ Insert 50 103 104 Page 102 Logical Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  9. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page produces a new delta. PID Addr 101 Delta physically points to 102 base page. ▲ Insert 50 103 104 Page 102 Logical Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  10. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page produces a new delta. PID Addr 101 Delta physically points to 102 base page. ▲ Insert 50 103 Install delta address in 104 physical address slot of Page 102 Logical mapping table using CAS. Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  11. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page produces a new delta. PID Addr 101 Delta physically points to 102 base page. ▲ Insert 50 103 Install delta address in 104 physical address slot of Page 102 Logical mapping table using CAS. Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  12. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page ▲ Delete 48 produces a new delta. PID Addr 101 Delta physically points to 102 base page. ▲ Insert 50 103 Install delta address in 104 physical address slot of Page 102 Logical mapping table using CAS. Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  13. 6 BW-TREE: DELTA UPDATES Mapping Table Each update to a page ▲ Delete 48 produces a new delta. PID Addr 101 Delta physically points to 102 base page. ▲ Insert 50 103 Install delta address in 104 physical address slot of Page 102 Logical mapping table using CAS. Pointer Physical Pointer Source: Justin Levandoski CMU 15-721 (Spring 2017)

  14. 7 BW-TREE: SEARCH Mapping Table Traverse tree like a regular ▲ Delete 48 B+tree. PID Addr 101 102 ▲ Insert 50 103 104 Page 102 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  15. 7 BW-TREE: SEARCH Mapping Table Traverse tree like a regular ▲ Delete 48 B+tree. PID Addr 101 If mapping table points to 102 delta chain, stop at first ▲ Insert 50 103 occurrence of search key. 104 Page 102 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  16. 7 BW-TREE: SEARCH Mapping Table Traverse tree like a regular ▲ Delete 48 B+tree. PID Addr 101 If mapping table points to 102 delta chain, stop at first ▲ Insert 50 103 occurrence of search key. 104 Otherwise, perform binary Page 102 Logical search on base page. Pointer Physical Pointer CMU 15-721 (Spring 2017)

  17. 8 BW-TREE: CONTENTION UPDATES Mapping Table PID Addr 101 Threads may try to install 102 ▲ Insert 50 updates to same state of the 103 page. 104 Page 102 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  18. 8 BW-TREE: CONTENTION UPDATES Mapping Table ▲ Delete 48 ▲ Insert 16 PID Addr 101 Threads may try to install 102 ▲ Insert 50 updates to same state of the 103 page. 104 Page 102 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  19. 8 BW-TREE: CONTENTION UPDATES Mapping Table ▲ Delete 48 ▲ Insert 16 PID Addr 101 Threads may try to install 102 ▲ Insert 50 updates to same state of the 103 page. 104 Winner succeeds, any Page 102 Logical losers must retry or abort Pointer Physical Pointer CMU 15-721 (Spring 2017)

  20. 8 BW-TREE: CONTENTION UPDATES Mapping Table ▲ Delete 48 ▲ Insert 16 PID Addr 101 Threads may try to install 102 ▲ Insert 50 updates to same state of the 103 page. 104 Winner succeeds, any Page 102 Logical losers must retry or abort Pointer Physical Pointer CMU 15-721 (Spring 2017)

  21. 8 BW-TREE: CONTENTION UPDATES X Mapping Table ▲ Delete 48 ▲ Insert 16 PID Addr 101 Threads may try to install 102 ▲ Insert 50 updates to same state of the 103 page. 104 Winner succeeds, any Page 102 Logical losers must retry or abort Pointer Physical Pointer CMU 15-721 (Spring 2017)

  22. 9 BW-TREE: DELTA TYPES Record Update Deltas → Insert/Delete/Update of record on a page Structure Modification Deltas → Split/Merge information CMU 15-721 (Spring 2017)

  23. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 102 103 ▲ Insert 50 104 Page 102 Logical Pointer Physical Pointer CMU 15-721 (Spring 2017)

  24. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 102 103 ▲ Insert 50 104 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  25. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 102 103 ▲ Insert 50 104 Page 102 Logical Pointer Physical ▲ Insert 50 New 102 Pointer CMU 15-721 (Spring 2017)

  26. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 CAS-ing the mapping table 102 address ensures no deltas 103 ▲ Insert 50 are missed. 104 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  27. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 CAS-ing the mapping table 102 address ensures no deltas 103 ▲ Insert 50 are missed. 104 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  28. 10 BW-TREE: CONSOLIDATION Mapping Table ▲ Insert 55 Consolidate updates by creating new page with PID Addr deltas applied. 101 ▲ Delete 48 CAS-ing the mapping table 102 address ensures no deltas 103 ▲ Insert 50 are missed. 104 Old page + deltas are Page 102 Logical marked as garbage. Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  29. 11 BW-TREE: GARBAGE COLLECTION Operations are tagged with an epoch → Each epoch tracks the threads that are part of it and the objects that can be reclaimed. → Thread joins an epoch prior to each operation and post objects that can be reclaimed for the current epoch (not necessarily the one it joined) Garbage for an epoch reclaimed only when all threads have exited the epoch. CMU 15-721 (Spring 2017)

  30. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table ▲ Insert 55 PID Addr 101 ▲ Delete 48 CPU1 102 103 ▲ Insert 50 104 CPU1 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  31. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table ▲ Insert 55 PID Addr 101 ▲ Delete 48 CPU1 CPU2 102 103 ▲ Insert 50 104 CPU1 Page 102 Logical Pointer Physical New 102 Pointer CPU2 CMU 15-721 (Spring 2017)

  32. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table ▲ Insert 55 PID Addr 101 ▲ Delete 48 CPU1 CPU2 102 103 ▲ Insert 50 104 CPU1 Page 102 Logical Pointer Physical New 102 Pointer CPU2 CMU 15-721 (Spring 2017)

  33. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table ▲ Insert 55 PID Addr 101 ▲ Delete 48 CPU1 102 103 ▲ Insert 50 104 CPU1 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  34. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table ▲ Insert 55 PID Addr 101 ▲ Delete 48 102 103 ▲ Insert 50 104 Page 102 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

  35. 12 BW-TREE: GARBAGE COLLECTION Mapping Table Epoch Table PID Addr 101 102 103 104 Logical Pointer Physical New 102 Pointer CMU 15-721 (Spring 2017)

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