110 likes | 230 Views
HTPR*-Tree Detail Design. IIS Lab ( 이병기 교수님 ) 컴공 19981234 김승준. Contents. Insert Algorithm Choose path Algorithm Node Insert Algorithm Key Split and Version Split Delete Algorithm Class Diagram. Insert(Entry e). let R be the associated with current timestamp
E N D
HTPR*-Tree Detail Design IIS Lab (이병기 교수님) 컴공 19981234 김승준
Contents • Insert Algorithm • Choose path Algorithm • Node Insert Algorithm • Key Split and Version Split • Delete Algorithm • Class Diagram
Insert(Entry e) • let R be the associated with current timestamp • re-inserted_i = false for all levels 1<=i<=h-1 (h is tree height) • invoke choose path (R, e) to find leaf node N to insert e • invoke node insert (N, e) • for each entry e’ in the L_reinserted • invoke choose path to find the leaf node N to insert e’ • Invoke node insert (N, e)
Choose path • example
Choose path (Node N, Entry e) • if N is a leaf, return N • initialize QP (priority queue) • let S = { all the live entries in N } • calculate cost degradation of all entries of S to QP • explore smallest cost degradation until the leaf level • when reached the leaf level , save smallest cost degradation entry to x and node to X • if x.t_start < current timestamp and x.MBR or x.VBR has changed, • insert a copy x’ of x into node N where x belongs and set x.t_end to the current time (if x.t_start == x.t_end then delete x) • set x as parent of x and go to G • return X
Version split • example
Strong version overflow and Key split • example
Node insert(Node N, Entry e) • if N is a leaf node • enter the information of e • If N overflows • If all entries in N were inserted at the current timestamp • If re-inserted_0 = false // no re-insertion at leaf level yet • Invoke pick worst to select a set S_worst of entries • Remove entries in S_worst from N; add them to L_reinsert • re-inserted_0=true • Else • Invoke key split to split N into itself and N’ • Else // version split • create a new node N_1 • For each live entry e in N • Duplicate e to e’ and enter e’ into N_1 • If e was inserted at the current timestamp • Delete e physically • Else • Modify the end time of e and the start time of e’ to the current time • If N_1 strong version overflows • Invoke key split to split N into itself and N’ • Let P be the parent of N • Node insert(P, null) or node insert(P, N’) if N has been split • Else // if N is a non-leaf node • Similar to line B-T except that (i) the MBR/VBR of the affected child node is adjusted, and (ii) in line E, H replace re-inserted_0 with re-inserted_i where I is the level of N
Delete • example
Delete(Entry e) • Invoke find leaf with adjustment to locate the node N the contains e • Delete e from N and invoke treat underflow if N underflow • Ascend to the root and for each node N_i in the path • If N_i overflows invoke treat overflow • If N_i is not the root and underflows, invoke treat underflow • If the root has only one entry but not a data page • Make the child of the entry the new root • Update the most recent entry in the root table • If the root incurs a version split • Insert a new entry in the root table (make new root)