Commit e5eb6187 authored by marko's avatar marko

branches/zip: ha_delete_hash_node(): Do not call buf_block_align().

Instead, get buf_block_t* as a parameter.

Without this patch, buf_page_hash_get() would return NULL in
buf_block_align().  The function buf_LRU_search_and_free_block()
invokes buf_LRU_block_remove_hashed_page(), which removes the
hash mapping needed by buf_page_hash_get().
parent bac65733
......@@ -1021,7 +1021,7 @@ btr_search_drop_page_hash_index(
for (i = 0; i < n_cached; i++) {
ha_remove_all_nodes_to_page(table, folds[i], page);
ha_remove_all_nodes_to_page(table, folds[i], block, page);
}
block->is_hashed = FALSE;
......@@ -1380,7 +1380,7 @@ btr_search_update_hash_on_delete(
}
rw_lock_x_lock(&btr_search_latch);
found = ha_search_and_delete_if_found(table, fold, rec);
found = ha_search_and_delete_if_found(table, fold, block, rec);
rw_lock_x_unlock(&btr_search_latch);
}
......
......@@ -167,14 +167,13 @@ void
ha_delete_hash_node(
/*================*/
hash_table_t* table, /* in: hash table */
buf_block_t* block __attribute__((unused)),
/* in: buffer block, or NULL */
ha_node_t* del_node) /* in: node to be deleted */
{
#ifdef UNIV_DEBUG
if (table->adaptive) {
buf_block_t* block;
mutex_enter(&buf_pool->mutex);
block = buf_block_align(del_node->data);
mutex_exit(&buf_pool->mutex);
ut_a(block->frame = page_align(del_node->data));
ut_a(block->n_pointers > 0);
block->n_pointers--;
}
......@@ -190,6 +189,8 @@ ha_delete(
/*======*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of data */
buf_block_t* block __attribute__((unused)),
/* in: buffer block, or NULL */
void* data) /* in: data, must not be NULL and must exist
in the hash table */
{
......@@ -202,7 +203,7 @@ ha_delete(
ut_a(node);
ha_delete_hash_node(table, node);
ha_delete_hash_node(table, block, node);
}
/*************************************************************
......@@ -248,10 +249,12 @@ ha_remove_all_nodes_to_page(
/*========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
buf_block_t* block, /* in: buffer block */
const page_t* page) /* in: buffer page */
{
ha_node_t* node;
ut_ad(block->frame == page);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */
......@@ -262,7 +265,7 @@ ha_remove_all_nodes_to_page(
/* Remove the hash node */
ha_delete_hash_node(table, node);
ha_delete_hash_node(table, block, node);
/* Start again from the first node in the chain
because the deletion may compact the heap of
......
......@@ -13,6 +13,7 @@ Created 8/18/1994 Heikki Tuuri
#include "hash0hash.h"
#include "page0types.h"
#include "buf0types.h"
/*****************************************************************
Looks for an element in a hash table. */
......@@ -73,6 +74,7 @@ ha_delete(
/*======*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of data */
buf_block_t* block, /* in: buffer block, or NULL */
void* data); /* in: data, must not be NULL and must exist
in the hash table */
/*************************************************************
......@@ -85,6 +87,7 @@ ha_search_and_delete_if_found(
/* out: TRUE if found */
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */
buf_block_t* block, /* in: buffer block, or NULL */
void* data); /* in: pointer to the data */
/*********************************************************************
Removes from the chain determined by fold all nodes whose data pointer
......@@ -95,6 +98,7 @@ ha_remove_all_nodes_to_page(
/*========================*/
hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */
buf_block_t* block, /* in: buffer block */
const page_t* page); /* in: buffer page */
/*****************************************************************
Validates a given range of the cells in hash table. */
......
......@@ -16,6 +16,7 @@ void
ha_delete_hash_node(
/*================*/
hash_table_t* table, /* in: hash table */
buf_block_t* block, /* in: buffer block, or NULL */
ha_node_t* del_node); /* in: node to be deleted */
/**********************************************************************
......@@ -173,6 +174,7 @@ ha_search_and_delete_if_found(
/* out: TRUE if found */
hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */
buf_block_t* block, /* in: buffer block, or NULL */
void* data) /* in: pointer to the data */
{
ha_node_t* node;
......@@ -184,7 +186,7 @@ ha_search_and_delete_if_found(
node = ha_search_with_data(table, fold, data);
if (node) {
ha_delete_hash_node(table, node);
ha_delete_hash_node(table, block, node);
return(TRUE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment