From 2e9f4cdc44cc560860b2b6c2a34a172df3dc9d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 19 May 2020 15:43:35 +0300 Subject: [PATCH] MDEV-21936 Assertion !btr_search_own... in btr_search_drop_page_hash_index This is a regression due to the cleanup commit 12f804acfa45dac5af04dd7da37670c50f4d8a90. row_sel_open_pcur(): Remove the unnecessary parameter. It suffices for us to acquire the adaptive hash index latch only when btr_search_guess_on_hash() is called by btr_cur_search_to_nth_level_func(), in btr_pcur_open_with_no_init(). This code seems to be a relic from the times when there was only one btr_search_latch, which was held in shared mode for longer periods of time. Another relic of that era was removed in commit e5980bf1b12f6dc4fa4ab44feb1b6a734dcc84d3. This clean-up was missed when the btr_search_latch was split in mysql/mysql-server/commit@ab17ab91ce18a47bb6c5c49e4dc0505ad488a448 (MySQL 5.7.8). --- storage/innobase/row/row0sel.cc | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index c53278b242d..c2f960e5846 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1288,10 +1288,6 @@ void row_sel_open_pcur( /*==============*/ plan_t* plan, /*!< in: table plan */ -#ifdef BTR_CUR_HASH_ADAPT - rw_lock_t* ahi_latch, - /*!< in: the adaptive hash index latch */ -#endif /* BTR_CUR_HASH_ADAPT */ mtr_t* mtr) /*!< in/out: mini-transaction */ { dict_index_t* index; @@ -1335,7 +1331,7 @@ row_sel_open_pcur( btr_pcur_open_with_no_init(index, plan->tuple, plan->mode, BTR_SEARCH_LEAF, &plan->pcur, - ahi_latch, mtr); + NULL, mtr); } else { /* Open the cursor to the start or the end of the index (FALSE: no init) */ @@ -1480,16 +1476,12 @@ row_sel_try_search_shortcut( ut_ad(plan->unique_search); ut_ad(!plan->must_get_clust); - rw_lock_t* ahi_latch = btr_get_search_latch(index); - rw_lock_s_lock(ahi_latch); - - row_sel_open_pcur(plan, ahi_latch, mtr); + row_sel_open_pcur(plan, mtr); const rec_t* rec = btr_pcur_get_rec(&(plan->pcur)); if (!page_rec_is_user_rec(rec) || rec_is_metadata(rec, index)) { retry: - rw_lock_s_unlock(ahi_latch); return(SEL_RETRY); } @@ -1501,7 +1493,6 @@ retry: if (btr_pcur_get_up_match(&(plan->pcur)) < plan->n_exact_match) { exhausted: - rw_lock_s_unlock(ahi_latch); return(SEL_EXHAUSTED); } @@ -1547,7 +1538,6 @@ exhausted: ut_ad(plan->pcur.latch_mode == BTR_SEARCH_LEAF); plan->n_rows_fetched++; - rw_lock_s_unlock(ahi_latch); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); @@ -1669,11 +1659,7 @@ table_loop: if (!plan->pcur_is_open) { /* Evaluate the expressions to build the search tuple and open the cursor */ - row_sel_open_pcur(plan, -#ifdef BTR_CUR_HASH_ADAPT - NULL, -#endif /* BTR_CUR_HASH_ADAPT */ - &mtr); + row_sel_open_pcur(plan, &mtr); cursor_just_opened = TRUE;