00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #pragma once
00027 #ifndef ha0ha_h
00028 #define ha0ha_h
00029
00030 #include "univ.i"
00031
00032 #include "hash0hash.h"
00033 #include "page0types.h"
00034 #include "buf0types.h"
00035
00036
00040 UNIV_INLINE
00041 void*
00042 ha_search_and_get_data(
00043
00044 hash_table_t* table,
00045 ulint fold);
00046
00049 UNIV_INTERN
00050 void
00051 ha_search_and_update_if_found_func(
00052
00053 hash_table_t* table,
00054 ulint fold,
00055 void* data,
00056 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00057 buf_block_t* new_block,
00058 #endif
00059 void* new_data);
00061 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00062
00069 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
00070 ha_search_and_update_if_found_func(table,fold,data,new_block,new_data)
00071 #else
00072
00079 # define ha_search_and_update_if_found(table,fold,data,new_block,new_data) \
00080 ha_search_and_update_if_found_func(table,fold,data,new_data)
00081 #endif
00082
00086 UNIV_INTERN
00087 hash_table_t*
00088 ha_create_func(
00089
00090 ulint n,
00091 #ifdef UNIV_SYNC_DEBUG
00092 ulint mutex_level,
00094 #endif
00095 ulint n_mutexes);
00097 #ifdef UNIV_SYNC_DEBUG
00098
00105 # define ha_create(n_c,n_m,level) ha_create_func(n_c,level,n_m)
00106 #else
00107
00114 # define ha_create(n_c,n_m,level) ha_create_func(n_c,n_m)
00115 #endif
00116
00117
00119 UNIV_INTERN
00120 void
00121 ha_clear(
00122
00123 hash_table_t* table);
00125
00130 UNIV_INTERN
00131 ibool
00132 ha_insert_for_fold_func(
00133
00134 hash_table_t* table,
00135 ulint fold,
00139 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00140 buf_block_t* block,
00141 #endif
00142 void* data);
00144 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00145
00154 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,b,d)
00155 #else
00156
00165 # define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
00166 #endif
00167
00168
00172 UNIV_INLINE
00173 ibool
00174 ha_search_and_delete_if_found(
00175
00176 hash_table_t* table,
00177 ulint fold,
00178 void* data);
00179 #ifndef UNIV_HOTBACKUP
00180
00183 UNIV_INTERN
00184 void
00185 ha_remove_all_nodes_to_page(
00186
00187 hash_table_t* table,
00188 ulint fold,
00189 const page_t* page);
00190 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00191
00194 UNIV_INTERN
00195 ibool
00196 ha_validate(
00197
00198 hash_table_t* table,
00199 ulint start_index,
00200 ulint end_index);
00201 #endif
00202
00204 UNIV_INTERN
00205 void
00206 ha_print_info(
00207
00208 FILE* file,
00209 hash_table_t* table);
00210 #endif
00211
00213 typedef struct ha_node_struct ha_node_t;
00214
00216 struct ha_node_struct {
00217 ha_node_t* next;
00218 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
00219 buf_block_t* block;
00220 #endif
00221 void* data;
00222 ulint fold;
00223 };
00224
00225 #ifndef UNIV_HOTBACKUP
00226
00230 # define ASSERT_HASH_MUTEX_OWN(table, fold) \
00231 ut_ad(!(table)->mutexes || mutex_own(hash_get_mutex(table, fold)))
00232 #else
00233
00237 # define ASSERT_HASH_MUTEX_OWN(table, fold) ((void) 0)
00238 #endif
00239
00240 #ifndef UNIV_NONINL
00241 #include "ha0ha.ic"
00242 #endif
00243
00244 #endif