1 / 9

Hw5: B+ Tree

Hw5: B+ Tree. Instructors: Winston Hsu, Hao-Hua Chu Fall 2010. B+ Tree Page Level Classes. HFPage: the base class (which you have implemented) SortedPage maintain records on a HFPage in a sorted order BTIndexPage records of the type [key, pageNo] BTLeafPage

joanlee
Download Presentation

Hw5: B+ Tree

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. Hw5: B+ Tree Instructors: Winston Hsu, Hao-Hua Chu Fall 2010

  2. B+ Tree Page Level Classes • HFPage: • the base class (which you have implemented) • SortedPage • maintain records on a HFPage in a sorted order • BTIndexPage • records of the type [key, pageNo] • BTLeafPage • records of the type [key, dataRid]

  3. BTIndexPage & BTLeafPage • BTIndexPage • BTLeafPage

  4. BTIndexPage & BTLeafPage

  5. Instruction • btfile.h • Defines the structure of header page of Btrees • btfile.C (The function you need to implement) • insert, _insert • Follow the tips in README • new_scan, findRunStart • See the following page

  6. new_scan, findRunStart • new_scan • create a scan from lo_key to hi_key, but what you have to do is find the lo_key in leafPages. It will call scan->get_next() after calling this. • Set up: • store the leafPage where the record with lo_key located in scan->leafp • store the RID of record with lo_key in scan->curRid • store the hi_key in scan->endkey • findRunStart • Find the RID and leafPage of the record with lo_key

  7. findRunStart • Here are three blank space you need to fill in. It’s ok if you want to rewrite the whole function. while (ppagei->get_type() == INDEX) { // find left-most occurrence of `lo_key', going all the way left if *lo_key is NULL. // That is, find the leafPage ppagei that contains the record with lo_key } while (st == NOMORERECS) { // If ppage you just found before has no records, you should find the next // page until it has records } while (keyCompare(&curkey, lo_key, key_type) < 0) { // find the RID of record matched lo_key, and store in metaRid }

  8. APIs • bt.h • Defines the structure of the record in btindex_page and btleaf_page  KeyDataEntry • There are two structures defined in KeyDataEntry  Keytype and Datatype • btindex_page.h, btleaf_page.h • Check this two files first!! • init(….) • insertKey(….), insertRec(….) • get_first(….), get_next(….)

  9. APIs • buf.h • MINIBASE_BM->newPage(….) • MINIBASE_BM->pinPage(….) // load a page into buffer pool when using • MINIBASE_BM->unpinPage(….) // unload a page from buffer pool when not using • key.C (defined in bt.h) • keyCompare(….) • get_key_data(….) • get_key_data_length(….) • make_entry(….)

More Related