diff options
Diffstat (limited to 'storage/innobase/btr/btr0cur.c')
-rw-r--r-- | storage/innobase/btr/btr0cur.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 9fa8fc663c9..2aff65e0bf6 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -3264,9 +3264,14 @@ btr_estimate_n_rows_in_range_on_level( mtr_start(&mtr); - /* fetch the page */ - block = buf_page_get(space, zip_size, page_no, RW_S_LATCH, - &mtr); + /* Fetch the page. Because we are not holding the + index->lock, the tree may have changed and we may be + attempting to read a page that is no longer part of + the B-tree. We pass BUF_GET_POSSIBLY_FREED in order to + silence a debug assertion about this. */ + block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, + NULL, BUF_GET_POSSIBLY_FREED, + __FILE__, __LINE__, &mtr); page = buf_block_get_frame(block); @@ -3285,6 +3290,13 @@ btr_estimate_n_rows_in_range_on_level( goto inexact; } + /* It is possible but highly unlikely that the page was + originally written by an old version of InnoDB that did + not initialize FIL_PAGE_TYPE on other than B-tree pages. + For example, this could be an almost-empty BLOB page + that happens to contain the magic values in the fields + that we checked above. */ + n_pages_read++; if (page_no != slot1->page_no) { |