Commit 8e8719da authored by marko's avatar marko

branches/zip: Correct a bug introduced in r1014: Always assign node->block

when assigning node->data.

ha_delete(), ha_search_and_delete_if_found(), ha_remove_all_nodes_to_page():
Remove the parameter buf_block_t* block, now that it is stored within the
hash data structure in debug builds.
parent 51fbf760
...@@ -1039,7 +1039,7 @@ btr_search_drop_page_hash_index( ...@@ -1039,7 +1039,7 @@ btr_search_drop_page_hash_index(
for (i = 0; i < n_cached; i++) { for (i = 0; i < n_cached; i++) {
ha_remove_all_nodes_to_page(table, folds[i], block, page); ha_remove_all_nodes_to_page(table, folds[i], page);
} }
block->is_hashed = FALSE; block->is_hashed = FALSE;
...@@ -1398,7 +1398,7 @@ btr_search_update_hash_on_delete( ...@@ -1398,7 +1398,7 @@ btr_search_update_hash_on_delete(
} }
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
found = ha_search_and_delete_if_found(table, fold, block, rec); found = ha_search_and_delete_if_found(table, fold, rec);
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
} }
......
...@@ -101,10 +101,14 @@ ha_insert_for_fold_func( ...@@ -101,10 +101,14 @@ ha_insert_for_fold_func(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (table->adaptive) { if (table->adaptive) {
buf_block_t* prev_block = prev_node->block; buf_block_t* prev_block = prev_node->block;
ut_a(prev_block->frame
== page_align(prev_node->data));
ut_a(prev_block->n_pointers > 0); ut_a(prev_block->n_pointers > 0);
prev_block->n_pointers--; prev_block->n_pointers--;
block->n_pointers++; block->n_pointers++;
} }
prev_node->block = block;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
prev_node->data = data; prev_node->data = data;
...@@ -168,15 +172,13 @@ void ...@@ -168,15 +172,13 @@ void
ha_delete_hash_node( ha_delete_hash_node(
/*================*/ /*================*/
hash_table_t* table, /* in: hash table */ 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 */ ha_node_t* del_node) /* in: node to be deleted */
{ {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (table->adaptive) { if (table->adaptive) {
ut_a(block->frame = page_align(del_node->data)); ut_a(del_node->block->frame = page_align(del_node->data));
ut_a(block->n_pointers > 0); ut_a(del_node->block->n_pointers > 0);
block->n_pointers--; del_node->block->n_pointers--;
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node); HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
...@@ -190,8 +192,6 @@ ha_delete( ...@@ -190,8 +192,6 @@ ha_delete(
/*======*/ /*======*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of data */ 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 void* data) /* in: data, must not be NULL and must exist
in the hash table */ in the hash table */
{ {
...@@ -204,7 +204,7 @@ ha_delete( ...@@ -204,7 +204,7 @@ ha_delete(
ut_a(node); ut_a(node);
ha_delete_hash_node(table, block, node); ha_delete_hash_node(table, node);
} }
/************************************************************* /*************************************************************
...@@ -238,6 +238,8 @@ ha_search_and_update_if_found_func( ...@@ -238,6 +238,8 @@ ha_search_and_update_if_found_func(
node->block->n_pointers--; node->block->n_pointers--;
new_block->n_pointers++; new_block->n_pointers++;
} }
node->block = new_block;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
node->data = new_data; node->data = new_data;
} }
...@@ -252,12 +254,10 @@ ha_remove_all_nodes_to_page( ...@@ -252,12 +254,10 @@ ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */ ulint fold, /* in: fold value */
buf_block_t* block, /* in: buffer block */
const page_t* page) /* in: buffer page */ const page_t* page) /* in: buffer page */
{ {
ha_node_t* node; ha_node_t* node;
ut_ad(block->frame == page);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold))); ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
...@@ -268,7 +268,7 @@ ha_remove_all_nodes_to_page( ...@@ -268,7 +268,7 @@ ha_remove_all_nodes_to_page(
/* Remove the hash node */ /* Remove the hash node */
ha_delete_hash_node(table, block, node); ha_delete_hash_node(table, node);
/* Start again from the first node in the chain /* Start again from the first node in the chain
because the deletion may compact the heap of because the deletion may compact the heap of
......
...@@ -95,7 +95,6 @@ ha_delete( ...@@ -95,7 +95,6 @@ ha_delete(
/*======*/ /*======*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of data */ 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 void* data); /* in: data, must not be NULL and must exist
in the hash table */ in the hash table */
/************************************************************* /*************************************************************
...@@ -108,7 +107,6 @@ ha_search_and_delete_if_found( ...@@ -108,7 +107,6 @@ ha_search_and_delete_if_found(
/* out: TRUE if found */ /* out: TRUE if found */
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */ 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 */ void* data); /* in: pointer to the data */
/********************************************************************* /*********************************************************************
Removes from the chain determined by fold all nodes whose data pointer Removes from the chain determined by fold all nodes whose data pointer
...@@ -119,7 +117,6 @@ ha_remove_all_nodes_to_page( ...@@ -119,7 +117,6 @@ ha_remove_all_nodes_to_page(
/*========================*/ /*========================*/
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: fold value */ ulint fold, /* in: fold value */
buf_block_t* block, /* in: buffer block */
const page_t* page); /* in: buffer page */ const page_t* page); /* in: buffer page */
/***************************************************************** /*****************************************************************
Validates a given range of the cells in hash table. */ Validates a given range of the cells in hash table. */
......
...@@ -16,7 +16,6 @@ void ...@@ -16,7 +16,6 @@ void
ha_delete_hash_node( ha_delete_hash_node(
/*================*/ /*================*/
hash_table_t* table, /* in: hash table */ 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 */ ha_node_t* del_node); /* in: node to be deleted */
/********************************************************************** /**********************************************************************
...@@ -180,7 +179,6 @@ ha_search_and_delete_if_found( ...@@ -180,7 +179,6 @@ ha_search_and_delete_if_found(
/* out: TRUE if found */ /* out: TRUE if found */
hash_table_t* table, /* in: hash table */ hash_table_t* table, /* in: hash table */
ulint fold, /* in: folded value of the searched data */ 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 */ void* data) /* in: pointer to the data */
{ {
ha_node_t* node; ha_node_t* node;
...@@ -192,7 +190,7 @@ ha_search_and_delete_if_found( ...@@ -192,7 +190,7 @@ ha_search_and_delete_if_found(
node = ha_search_with_data(table, fold, data); node = ha_search_with_data(table, fold, data);
if (node) { if (node) {
ha_delete_hash_node(table, block, node); ha_delete_hash_node(table, node);
return(TRUE); 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