Commit 5e5a3f3f authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

row0mysql.c:

  Remove parameter from call to btr_search_validate().
buf0buf.c:
  Initialize member "index" of buf_block_t.
buf0buf.h:
  Add member "index" to buf_block_t.
btr0sea.h:
  Remove parameter of btr_search_validate()
btr0sea.c:
  Make use of the added member "index" of buf_block_t.
parent f90caa58
...@@ -411,6 +411,9 @@ btr_search_update_hash_ref( ...@@ -411,6 +411,9 @@ btr_search_update_hash_ref(
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED) ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|| rw_lock_own(&(block->lock), RW_LOCK_EX)); || rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_block_align(btr_cur_get_rec(cursor)) == block);
ut_a(!block->is_hashed || block->index == cursor->index);
if (block->is_hashed if (block->is_hashed
&& (info->n_hash_potential > 0) && (info->n_hash_potential > 0)
&& (block->curr_n_fields == info->n_fields) && (block->curr_n_fields == info->n_fields)
...@@ -957,6 +960,7 @@ btr_search_drop_page_hash_index( ...@@ -957,6 +960,7 @@ btr_search_drop_page_hash_index(
ha_remove_all_nodes_to_page(table, page); ha_remove_all_nodes_to_page(table, page);
block->is_hashed = FALSE; block->is_hashed = FALSE;
block->index = NULL;
rw_lock_x_unlock(&btr_search_latch); rw_lock_x_unlock(&btr_search_latch);
} }
...@@ -1170,6 +1174,7 @@ btr_search_build_page_hash_index( ...@@ -1170,6 +1174,7 @@ btr_search_build_page_hash_index(
block->curr_n_fields = n_fields; block->curr_n_fields = n_fields;
block->curr_n_bytes = n_bytes; block->curr_n_bytes = n_bytes;
block->curr_side = side; block->curr_side = side;
block->index = index;
for (i = 0; i < n_cached; i++) { for (i = 0; i < n_cached; i++) {
...@@ -1215,6 +1220,8 @@ btr_search_move_or_delete_hash_entries( ...@@ -1215,6 +1220,8 @@ btr_search_move_or_delete_hash_entries(
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX)); ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX)); ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_a(!new_block->is_hashed || new_block->index == index);
ut_a(!block->is_hashed || block->index == index);
rw_lock_s_lock(&btr_search_latch); rw_lock_s_lock(&btr_search_latch);
...@@ -1284,6 +1291,7 @@ btr_search_update_hash_on_delete( ...@@ -1284,6 +1291,7 @@ btr_search_update_hash_on_delete(
return; return;
} }
ut_a(block->index == cursor->index);
ut_a(block->curr_n_fields + block->curr_n_bytes > 0); ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
table = btr_search_sys->hash_index; table = btr_search_sys->hash_index;
...@@ -1329,6 +1337,8 @@ btr_search_update_hash_node_on_insert( ...@@ -1329,6 +1337,8 @@ btr_search_update_hash_node_on_insert(
return; return;
} }
ut_a(block->index == cursor->index);
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
if ((cursor->flag == BTR_CUR_HASH) if ((cursor->flag == BTR_CUR_HASH)
...@@ -1394,6 +1404,8 @@ btr_search_update_hash_on_insert( ...@@ -1394,6 +1404,8 @@ btr_search_update_hash_on_insert(
return; return;
} }
ut_a(block->index == cursor->index);
tree_id = ((cursor->index)->tree)->id; tree_id = ((cursor->index)->tree)->id;
n_fields = block->curr_n_fields; n_fields = block->curr_n_fields;
...@@ -1499,10 +1511,9 @@ function_exit: ...@@ -1499,10 +1511,9 @@ function_exit:
Validates the search system. */ Validates the search system. */
ibool ibool
btr_search_validate( btr_search_validate(void)
/*================*/ /*=====================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_index_t* index) /* in: record descriptor */
{ {
buf_block_t* block; buf_block_t* block;
page_t* page; page_t* page;
...@@ -1521,8 +1532,9 @@ btr_search_validate( ...@@ -1521,8 +1532,9 @@ btr_search_validate(
while (node != NULL) { while (node != NULL) {
block = buf_block_align(node->data); block = buf_block_align(node->data);
page = buf_frame_align(node->data); page = buf_frame_align(node->data);
offsets = rec_reget_offsets((rec_t*) node->data, index, offsets = rec_reget_offsets((rec_t*) node->data,
offsets, block->curr_n_fields block->index, offsets,
block->curr_n_fields
+ (block->curr_n_bytes > 0), heap); + (block->curr_n_bytes > 0), heap);
if (!block->is_hashed if (!block->is_hashed
......
...@@ -460,6 +460,7 @@ buf_block_init( ...@@ -460,6 +460,7 @@ buf_block_init(
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
block->check_index_page_at_flush = FALSE; block->check_index_page_at_flush = FALSE;
block->index = NULL;
block->in_free_list = FALSE; block->in_free_list = FALSE;
block->in_LRU_list = FALSE; block->in_LRU_list = FALSE;
...@@ -1536,6 +1537,7 @@ buf_page_init( ...@@ -1536,6 +1537,7 @@ buf_page_init(
block->offset = offset; block->offset = offset;
block->check_index_page_at_flush = FALSE; block->check_index_page_at_flush = FALSE;
block->index = NULL;
block->lock_hash_val = lock_rec_hash(space, offset); block->lock_hash_val = lock_rec_hash(space, offset);
block->lock_mutex = NULL; block->lock_mutex = NULL;
......
...@@ -130,10 +130,9 @@ btr_search_update_hash_on_delete( ...@@ -130,10 +130,9 @@ btr_search_update_hash_on_delete(
Validates the search system. */ Validates the search system. */
ibool ibool
btr_search_validate( btr_search_validate(void);
/*================*/ /*======================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_index_t* index); /* in: record descriptor */
/* Search info directions */ /* Search info directions */
#define BTR_SEA_NO_DIRECTION 1 #define BTR_SEA_NO_DIRECTION 1
......
...@@ -740,6 +740,8 @@ struct buf_block_struct{ ...@@ -740,6 +740,8 @@ struct buf_block_struct{
buffer pool which are index pages, buffer pool which are index pages,
but this flag is not set because but this flag is not set because
we do not keep track of all pages */ we do not keep track of all pages */
dict_index_t* index; /* index for which the adaptive
hash index has been created */
/* 2. Page flushing fields */ /* 2. Page flushing fields */
UT_LIST_NODE_T(buf_block_t) flush_list; UT_LIST_NODE_T(buf_block_t) flush_list;
......
...@@ -3398,7 +3398,7 @@ row_check_table_for_mysql( ...@@ -3398,7 +3398,7 @@ row_check_table_for_mysql(
/* We validate also the whole adaptive hash index for all tables /* We validate also the whole adaptive hash index for all tables
at every CHECK TABLE */ at every CHECK TABLE */
if (!btr_search_validate(index)) { if (!btr_search_validate()) {
ret = DB_ERROR; ret = DB_ERROR;
} }
......
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