1/***************************************************************************** 2 3Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. 4 5This program is free software; you can redistribute it and/or modify 6it under the terms of the GNU General Public License, version 2.0, 7as published by the Free Software Foundation. 8 9This program is also distributed with certain software (including 10but not limited to OpenSSL) that is licensed under separate terms, 11as designated in a particular file or component or in included license 12documentation. The authors of MySQL hereby grant you an additional 13permission to link the program and your derivative works with the 14separately licensed software that they have included with MySQL. 15 16This program is distributed in the hope that it will be useful, 17but WITHOUT ANY WARRANTY; without even the implied warranty of 18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19GNU General Public License, version 2.0, for more details. 20 21You should have received a copy of the GNU General Public License along with 22this program; if not, write to the Free Software Foundation, Inc., 2351 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25*****************************************************************************/ 26 27/********************************************************************//** 28@file include/btr0sea.ic 29The index tree adaptive search 30 31Created 2/17/1996 Heikki Tuuri 32*************************************************************************/ 33 34#include "dict0mem.h" 35#include "btr0cur.h" 36#include "buf0buf.h" 37 38/*********************************************************************//** 39Updates the search info. */ 40UNIV_INTERN 41void 42btr_search_info_update_slow( 43/*========================*/ 44 btr_search_t* info, /*!< in/out: search info */ 45 btr_cur_t* cursor);/*!< in: cursor which was just positioned */ 46 47/********************************************************************//** 48Returns search info for an index. 49@return search info; search mutex reserved */ 50UNIV_INLINE 51btr_search_t* 52btr_search_get_info( 53/*================*/ 54 dict_index_t* index) /*!< in: index */ 55{ 56 return(index->search_info); 57} 58 59/*********************************************************************//** 60Updates the search info. */ 61UNIV_INLINE 62void 63btr_search_info_update( 64/*===================*/ 65 dict_index_t* index, /*!< in: index of the cursor */ 66 btr_cur_t* cursor) /*!< in: cursor which was just positioned */ 67{ 68 btr_search_t* info; 69 70#ifdef UNIV_SYNC_DEBUG 71 ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); 72 ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); 73#endif /* UNIV_SYNC_DEBUG */ 74 75 info = btr_search_get_info(index); 76 77 info->hash_analysis++; 78 79 if (info->hash_analysis < BTR_SEARCH_HASH_ANALYSIS) { 80 81 /* Do nothing */ 82 83 return; 84 85 } 86 87 ut_ad(cursor->flag != BTR_CUR_HASH); 88 89 btr_search_info_update_slow(info, cursor); 90} 91