You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.4 KiB

  1. /*****************************************************************************
  2. Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free Software
  5. Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along with
  10. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  11. Place, Suite 330, Boston, MA 02111-1307 USA
  12. *****************************************************************************/
  13. /********************************************************************//**
  14. @file include/btr0sea.ic
  15. The index tree adaptive search
  16. Created 2/17/1996 Heikki Tuuri
  17. *************************************************************************/
  18. #include "dict0mem.h"
  19. #include "btr0cur.h"
  20. #include "buf0buf.h"
  21. /*********************************************************************//**
  22. Updates the search info. */
  23. UNIV_INTERN
  24. void
  25. btr_search_info_update_slow(
  26. /*========================*/
  27. btr_search_t* info, /*!< in/out: search info */
  28. btr_cur_t* cursor);/*!< in: cursor which was just positioned */
  29. /********************************************************************//**
  30. Returns search info for an index.
  31. @return search info; search mutex reserved */
  32. UNIV_INLINE
  33. btr_search_t*
  34. btr_search_get_info(
  35. /*================*/
  36. dict_index_t* index) /*!< in: index */
  37. {
  38. ut_ad(index);
  39. return(index->search_info);
  40. }
  41. /*********************************************************************//**
  42. Updates the search info. */
  43. UNIV_INLINE
  44. void
  45. btr_search_info_update(
  46. /*===================*/
  47. dict_index_t* index, /*!< in: index of the cursor */
  48. btr_cur_t* cursor) /*!< in: cursor which was just positioned */
  49. {
  50. btr_search_t* info;
  51. #ifdef UNIV_SYNC_DEBUG
  52. ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
  53. ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
  54. #endif /* UNIV_SYNC_DEBUG */
  55. info = btr_search_get_info(index);
  56. info->hash_analysis++;
  57. if (info->hash_analysis < BTR_SEARCH_HASH_ANALYSIS) {
  58. /* Do nothing */
  59. return;
  60. }
  61. ut_ad(cursor->flag != BTR_CUR_HASH);
  62. btr_search_info_update_slow(info, cursor);
  63. }