From 0332dc7b89ee374ccb787de91ef82be9f217920d Mon Sep 17 00:00:00 2001 From: marko <> Date: Wed, 15 Oct 2008 10:18:28 +0000 Subject: [PATCH] branches/innodb+: btr_cur_search_to_nth_level(): Add a TODO comment that when encountering an empty leaf page, we should advance to the right siblings until a non-empty page is found. Move the initialization of cursor->ibuf_cnt to a better place. --- btr/btr0cur.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/btr/btr0cur.c b/btr/btr0cur.c index 77310eed5bd..547dedd659a 100644 --- a/btr/btr0cur.c +++ b/btr/btr0cur.c @@ -658,6 +658,9 @@ retry_page_get: page_mode = mode; } + /* TO DO: if the page is empty, advance to the next page. + There may be a match on the first nonempty right sibling. */ + page_cur_search_with_match( block, index, tuple, page_mode, &up_match, &up_bytes, &low_match, &low_bytes, page_cursor); @@ -692,19 +695,14 @@ retry_page_get: node_ptr = page_cur_get_rec(page_cursor); - offsets = rec_get_offsets( - node_ptr, cursor->index, offsets, ULINT_UNDEFINED, &heap); - - /* Go to the child node */ - page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets); - - if (dict_index_is_ibuf(index) && height == level) { + if (height == 0 && dict_index_is_ibuf(index)) { /* We're doing a search on an ibuf tree and we're one level - above the leaf page. (Assuming level == 0, which it should - be.) */ + above the leaf page. */ ulint is_min_rec; + ut_ad(level == 0); + is_min_rec = rec_get_info_bits(node_ptr, 0) & REC_INFO_MIN_REC_FLAG; @@ -716,6 +714,12 @@ retry_page_get: } } + offsets = rec_get_offsets( + node_ptr, index, offsets, ULINT_UNDEFINED, &heap); + + /* Go to the child node */ + page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets); + goto search_loop; loop_end: