46 #ifdef UNIV_SYNC_DEBUG
54 #ifndef UNIV_HOTBACKUP
59 table = hash_create(n);
61 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
62 # ifndef UNIV_HOTBACKUP
63 table->adaptive = TRUE;
71 ut_min(4096, MEM_MAX_ALLOC_IN_BUF));
77 #ifndef UNIV_HOTBACKUP
78 hash_create_mutexes(table, n_mutexes, mutex_level);
82 for (i = 0; i < n_mutexes; i++) {
103 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
104 #ifdef UNIV_SYNC_DEBUG
108 #ifndef UNIV_HOTBACKUP
110 n = table->n_mutexes;
112 for (i = 0; i < n; i++) {
120 for (i = 0; i < n; i++) {
133 ha_insert_for_fold_func(
140 #
if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
152 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
153 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
164 while (prev_node != NULL) {
165 if (prev_node->
fold == fold) {
166 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
167 # ifndef UNIV_HOTBACKUP
168 if (table->adaptive) {
172 ut_a(prev_block->n_pointers > 0);
173 prev_block->n_pointers--;
176 ut_ad(!btr_search_fully_disabled);
179 prev_node->block = block;
181 prev_node->
data = data;
186 prev_node = prev_node->
next;
191 if (!btr_search_enabled) {
192 ut_ad(!btr_search_fully_disabled);
209 ha_node_set_data(node, block, data);
211 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
212 # ifndef UNIV_HOTBACKUP
213 if (table->adaptive) {
225 if (prev_node == NULL) {
232 while (prev_node->
next != NULL) {
234 prev_node = prev_node->
next;
237 prev_node->
next = node;
252 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
253 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
254 # ifndef UNIV_HOTBACKUP
255 if (table->adaptive) {
257 ut_a(del_node->block->n_pointers > 0);
258 del_node->block->n_pointers--;
271 ha_search_and_update_if_found_func(
276 #
if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
284 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
286 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
290 node = ha_search_with_data(table, fold, data);
293 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
294 # ifndef UNIV_HOTBACKUP
295 if (table->adaptive) {
296 ut_a(node->block->n_pointers > 0);
297 node->block->n_pointers--;
298 new_block->n_pointers++;
302 node->block = new_block;
304 node->
data = new_data;
308 #ifndef UNIV_HOTBACKUP
314 ha_remove_all_nodes_to_page(
323 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
326 node = ha_chain_get_first(table, fold);
329 if (
page_align(ha_node_get_data(node)) == page) {
333 ha_delete_hash_node(table, node);
339 node = ha_chain_get_first(table, fold);
341 node = ha_chain_get_next(node);
347 node = ha_chain_get_first(table, fold);
352 node = ha_chain_get_next(node);
357 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
375 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
376 ut_a(start_index <= end_index);
380 for (i = start_index; i <= end_index; i++) {
390 "InnoDB: Error: hash table node"
391 " fold value %lu does not\n"
392 "InnoDB: match the cell number %lu.\n",
393 (ulong) node->
fold, (ulong) i);
416 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
420 #define PRINT_USED_CELLS
423 #ifdef PRINT_USED_CELLS
430 #ifdef PRINT_USED_CELLS
442 fprintf(file,
"Hash table size %lu",
445 #ifdef PRINT_USED_CELLS
446 fprintf(file,
", used cells %lu", (ulong) cells);
449 if (table->
heaps == NULL && table->heap != NULL) {
456 if (table->heap->free_block) {
460 fprintf(file,
", node heap has %lu buffer(s)\n",