31 #ifndef UNIV_HOTBACKUP
47 #ifdef UNIV_SYNC_DEBUG
63 ut_a(type == MEM_HEAP_FOR_BTR_SEARCH
64 || type == MEM_HEAP_FOR_PAGE_HASH);
67 table = hash_create(n);
72 if (n_sync_obj == 0) {
74 ut_min(4096, MEM_MAX_ALLOC_IN_BUF), type);
80 if (type == MEM_HEAP_FOR_PAGE_HASH) {
84 n_sync_obj, sync_level);
87 n_sync_obj, sync_level);
91 mem_alloc(n_sync_obj *
sizeof(
void*)));
93 for (i = 0; i < n_sync_obj; i++) {
113 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
114 #ifdef UNIV_SYNC_DEBUG
115 ut_ad(!table->adaptive
120 n = table->n_sync_obj;
122 for (i = 0; i <
n; i++) {
130 switch (table->type) {
133 table->sync_obj.mutexes = NULL;
138 table->sync_obj.rw_locks = NULL;
146 table->n_sync_obj = 0;
153 for (i = 0; i <
n; i++) {
173 #
if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
185 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
186 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
189 hash_assert_can_modify(table, fold);
198 while (prev_node != NULL) {
199 if (prev_node->
fold == fold) {
200 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
201 if (table->adaptive) {
205 ut_a(prev_block->n_pointers > 0);
206 prev_block->n_pointers--;
210 prev_node->block =
block;
212 prev_node->
data = data;
217 prev_node = prev_node->
next;
234 ha_node_set_data(node, block, data);
236 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
237 if (table->adaptive) {
248 if (prev_node == NULL) {
255 while (prev_node->
next != NULL) {
257 prev_node = prev_node->
next;
260 prev_node->
next = node;
275 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
276 #ifdef UNIV_SYNC_DEBUG
280 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
281 if (table->adaptive) {
283 ut_a(del_node->block->n_pointers > 0);
284 del_node->block->n_pointers--;
302 #
if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
305 const rec_t* new_data)
310 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
311 hash_assert_can_modify(table, fold);
312 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
315 #ifdef UNIV_SYNC_DEBUG
323 node = ha_search_with_data(table, fold, data);
326 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
327 if (table->adaptive) {
328 ut_a(node->block->n_pointers > 0);
329 node->block->n_pointers--;
330 new_block->n_pointers++;
333 node->block = new_block;
335 node->
data = new_data;
357 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
358 hash_assert_can_modify(table, fold);
361 node = ha_chain_get_first(table, fold);
364 if (
page_align(ha_node_get_data(node)) == page) {
374 node = ha_chain_get_first(table, fold);
376 node = ha_chain_get_next(node);
382 node = ha_chain_get_first(table, fold);
387 node = ha_chain_get_next(node);
392 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
408 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
409 ut_a(start_index <= end_index);
413 for (i = start_index; i <= end_index; i++) {
419 for (node = static_cast<ha_node_t*>(cell->
node);
426 "InnoDB: Error: hash table node"
427 " fold value %lu does not\n"
428 "InnoDB: match the cell number %lu.\n",
429 (ulong) node->
fold, (ulong) i);
452 #define PRINT_USED_CELLS
455 #ifdef PRINT_USED_CELLS
463 ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
464 #ifdef PRINT_USED_CELLS
476 fprintf(file,
"Hash table size %lu",
479 #ifdef PRINT_USED_CELLS
480 fprintf(file,
", used cells %lu", (ulong) cells);
483 if (table->
heaps == NULL && table->heap != NULL) {
490 if (table->heap->free_block) {
494 fprintf(file,
", node heap has %lu buffer(s)\n",