this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix end_key for inner pages

garrison de5933d6 ecf2cff8

+13 -6
+12 -6
lib/btree/page.ex
··· 38 38 body2::binary, 39 39 >> = body 40 40 41 - << 42 - key_size::integer-16, 43 - _value_size::integer-16, 44 - end_key1::binary-size(key_size), 45 - _rest::binary, 46 - >> = body2 41 + end_key1 = 42 + case type_byte do 43 + 0x00 -> 44 + # For an inner page, the end_key is equal to the last key in the page (which is itself the end_key of the child page) 45 + offset = List.last(offsets1) 46 + <<_::binary-size(offset), key_size::integer-16, _vs::integer-16, end_key1::binary-size(key_size), _::binary>> = body1 47 + end_key1 48 + 0x01 -> 49 + # For a leaf page, the end_key is an exclusive separator key, so we choose the first key of the next page 50 + <<key_size::integer-16, _vs::integer-16, end_key1::binary-size(key_size), _::binary>> = body2 51 + end_key1 52 + end 47 53 end_key2 = end_key 48 54 49 55 pair_count1 = midpoint_i
+1
lib/btree/writer.ex
··· 77 77 end 78 78 79 79 new_encoded_pages = Page.encode_page_from_pairs(page_type, btree.opts.page_size, pairs, page_ek) 80 + assert elem(List.last(new_encoded_pages), 0) == page_ek 80 81 new_indices = FreeList.reserve_pages(btree.free_list, length(new_encoded_pages)) 81 82 82 83 Enum.zip(new_encoded_pages, new_indices)