Drizzled Public API Documentation

btr0sea.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 
00003 Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify it under
00006 the terms of the GNU General Public License as published by the Free Software
00007 Foundation; version 2 of the License.
00008 
00009 This program is distributed in the hope that it will be useful, but WITHOUT
00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License along with
00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
00015 St, Fifth Floor, Boston, MA 02110-1301 USA
00016 
00017 *****************************************************************************/
00018 
00019 /********************************************************************/
00026 #pragma once
00027 #ifndef btr0sea_h
00028 #define btr0sea_h
00029 
00030 #include "univ.i"
00031 
00032 #include "rem0rec.h"
00033 #include "dict0dict.h"
00034 #include "btr0types.h"
00035 #include "mtr0mtr.h"
00036 #include "ha0ha.h"
00037 
00038 /*****************************************************************/
00040 UNIV_INTERN
00041 void
00042 btr_search_sys_create(
00043 /*==================*/
00044   ulint hash_size); 
00045 /*****************************************************************/
00047 UNIV_INTERN
00048 void
00049 btr_search_sys_free(void);
00050 /*=====================*/
00051 
00052 /********************************************************************/
00054 UNIV_INTERN
00055 void
00056 btr_search_disable(void);
00057 /*====================*/
00058 /********************************************************************/
00060 UNIV_INTERN
00061 void
00062 btr_search_enable(void);
00063 /*====================*/
00064 
00065 /********************************************************************/
00068 UNIV_INLINE
00069 btr_search_t*
00070 btr_search_get_info(
00071 /*================*/
00072   dict_index_t* index); 
00073 /*****************************************************************/
00076 UNIV_INTERN
00077 btr_search_t*
00078 btr_search_info_create(
00079 /*===================*/
00080   mem_heap_t* heap);  
00081 /*****************************************************************/
00085 UNIV_INTERN
00086 ulint
00087 btr_search_info_get_ref_count(
00088 /*==========================*/
00089   btr_search_t*   info);  
00090 /*********************************************************************/
00092 UNIV_INLINE
00093 void
00094 btr_search_info_update(
00095 /*===================*/
00096   dict_index_t* index,  
00097   btr_cur_t*  cursor);
00098 /******************************************************************/
00104 UNIV_INTERN
00105 ibool
00106 btr_search_guess_on_hash(
00107 /*=====================*/
00108   dict_index_t* index,    
00109   btr_search_t* info,   
00110   const dtuple_t* tuple,    
00111   ulint   mode,   
00112   ulint   latch_mode, 
00113   btr_cur_t*  cursor,   
00114   ulint   has_search_latch,
00117   mtr_t*    mtr);   
00118 /********************************************************************/
00123 UNIV_INTERN
00124 void
00125 btr_search_move_or_delete_hash_entries(
00126 /*===================================*/
00127   buf_block_t*  new_block,  
00129   buf_block_t*  block,    
00133   dict_index_t* index);   
00134 /********************************************************************/
00136 UNIV_INTERN
00137 void
00138 btr_search_drop_page_hash_index(
00139 /*============================*/
00140   buf_block_t*  block); 
00144 /********************************************************************/
00147 UNIV_INTERN
00148 void
00149 btr_search_drop_page_hash_when_freed(
00150 /*=================================*/
00151   ulint space,    
00152   ulint zip_size, 
00154   ulint page_no); 
00155 /********************************************************************/
00157 UNIV_INTERN
00158 void
00159 btr_search_update_hash_node_on_insert(
00160 /*==================================*/
00161   btr_cur_t*  cursor);
00165 /********************************************************************/
00167 UNIV_INTERN
00168 void
00169 btr_search_update_hash_on_insert(
00170 /*=============================*/
00171   btr_cur_t*  cursor);
00175 /********************************************************************/
00177 UNIV_INTERN
00178 void
00179 btr_search_update_hash_on_delete(
00180 /*=============================*/
00181   btr_cur_t*  cursor);
00184 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00185 /********************************************************************/
00188 UNIV_INTERN
00189 ibool
00190 btr_search_validate(void);
00191 /*======================*/
00192 #else
00193 # define btr_search_validate()  TRUE
00194 #endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
00195 
00198 extern bool btr_search_enabled;
00199 
00204 extern ibool  btr_search_fully_disabled;
00205 
00207 struct btr_search_struct{
00208   ulint ref_count;  
00215   /* @{ The following fields are not protected by any latch.
00216   Unfortunately, this means that they must be aligned to
00217   the machine word, i.e., they cannot be turned into bit-fields. */
00218   buf_block_t* root_guess;
00220   ulint hash_analysis;  
00224   ibool last_hash_succ; 
00229   ulint n_hash_potential;
00234   /* @} */
00235   /*---------------------- @{ */
00236   ulint n_fields; 
00238   ulint n_bytes;  
00241   ibool left_side;  
00245   /*---------------------- @} */
00246 #ifdef UNIV_SEARCH_PERF_STAT
00247   ulint n_hash_succ;  
00249   ulint n_hash_fail;  
00250   ulint n_patt_succ;  
00252   ulint n_searches; 
00253 #endif /* UNIV_SEARCH_PERF_STAT */
00254 #ifdef UNIV_DEBUG
00255   ulint magic_n;  
00257 # define BTR_SEARCH_MAGIC_N 1112765
00258 #endif /* UNIV_DEBUG */
00259 };
00260 
00262 typedef struct btr_search_sys_struct  btr_search_sys_t;
00263 
00265 struct btr_search_sys_struct{
00266   hash_table_t* hash_index; 
00269 };
00270 
00272 extern btr_search_sys_t*  btr_search_sys;
00273 
00287 extern rw_lock_t* btr_search_latch_temp;
00288 
00290 #define btr_search_latch  (*btr_search_latch_temp)
00291 
00292 #ifdef UNIV_SEARCH_PERF_STAT
00293 
00294 extern ulint  btr_search_n_succ;
00296 extern ulint  btr_search_n_hash_fail;
00297 #endif /* UNIV_SEARCH_PERF_STAT */
00298 
00302 #define BTR_SEARCH_HASH_ANALYSIS  17
00303 
00306 #define BTR_SEARCH_ON_PATTERN_LIMIT 3
00307 
00310 #define BTR_SEARCH_ON_HASH_LIMIT  3
00311 
00315 #define BTR_SEA_TIMEOUT     10000
00316 
00317 #ifndef UNIV_NONINL
00318 #include "btr0sea.ic"
00319 #endif
00320 
00321 #endif