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));
78 hash_create_mutexes(table, n_mutexes, mutex_level);
80 table->heaps =
static_cast<mem_block_info_t **
>(mem_alloc(n_mutexes *
sizeof(mem_block_info_t *)));
82 for (i = 0; i < n_mutexes; i++) {
84 ut_a(table->heaps[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++) {
133ha_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--;
271ha_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
314ha_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",
struct buf_block_struct buf_block_t
struct ha_node_struct ha_node_t
#define ASSERT_HASH_MUTEX_OWN(table, fold)
UNIV_INLINE hash_cell_t * hash_get_nth_cell(hash_table_t *table, ulint n)
UNIV_INLINE ulint hash_get_n_cells(hash_table_t *table)
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)
UNIV_INLINE mem_heap_t * hash_get_heap(hash_table_t *table, ulint fold)
UNIV_INLINE ulint hash_calc_hash(ulint fold, hash_table_t *table)
#define mem_heap_create_in_btr_search(N)
UNIV_INLINE void * mem_heap_alloc(mem_heap_t *heap, ulint n)
#define mem_heap_free(heap)
UNIV_INLINE page_t * page_align(const void *ptr) __attribute__((const))
#define UT_LIST_GET_LEN(BASE)
UNIV_INLINE ulint ut_min(ulint n1, ulint n2)
UNIV_INTERN void ut_print_timestamp(FILE *file)