summaryrefslogtreecommitdiff
path: root/innobase/ha
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2003-10-13 11:20:19 +0300
committerunknown <heikki@hundin.mysql.fi>2003-10-13 11:20:19 +0300
commit423747b570b5f01b4d2dd06da991f6a8ce15101f (patch)
tree5d5b7191e57ae4eafdff3f6a259ba37729217404 /innobase/ha
parent963d7baba7a1c37bd2154f04303df8e469f15049 (diff)
downloadmariadb-git-423747b570b5f01b4d2dd06da991f6a8ce15101f.tar.gz
Many files:
ALTER TABLE ... DISCARD/IMPORT TABLESPACE Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x sql/ha_innodb.cc: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_class.cc: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_parse.cc: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_table.cc: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/ha_innodb.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/handler.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/lex.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/mysql_priv.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_class.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_lex.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE sql/sql_yacc.yy: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/ha/ha0ha.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/ha/hash0hash.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/buf/buf0buf.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/buf/buf0flu.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/buf/buf0lru.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/buf/buf0rea.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/btr/btr0btr.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/btr/btr0sea.c: Track crash in buf_LRU_block_remove_hashed_page + 1807 reported in MySQL-3.23.5x innobase/fil/fil0fil.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/buf0buf.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/ha0ha.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/hash0hash.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/row0mysql.h: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/buf0buf.ic: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/ha0ha.ic: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/include/ibuf0ibuf.ic: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/page/page0page.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/row/row0mysql.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/row/row0purge.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/row/row0uins.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE innobase/row/row0umod.c: ALTER TABLE ... DISCARD/IMPORT TABLESPACE
Diffstat (limited to 'innobase/ha')
-rw-r--r--innobase/ha/ha0ha.c69
-rw-r--r--innobase/ha/hash0hash.c1
2 files changed, 61 insertions, 9 deletions
diff --git a/innobase/ha/ha0ha.c b/innobase/ha/ha0ha.c
index c7e23d0be1e..87c32bf5dbd 100644
--- a/innobase/ha/ha0ha.c
+++ b/innobase/ha/ha0ha.c
@@ -34,6 +34,12 @@ ha_create(
table = hash_create(n);
+ if (in_btr_search) {
+ table->adaptive = TRUE;
+ } else {
+ table->adaptive = FALSE;
+ }
+
if (n_mutexes == 0) {
if (in_btr_search) {
table->heap = mem_heap_create_in_btr_search(4096);
@@ -106,6 +112,7 @@ ha_insert_for_fold(
hash_cell_t* cell;
ha_node_t* node;
ha_node_t* prev_node;
+ buf_block_t* prev_block;
ulint hash;
ut_ad(table && data);
@@ -119,6 +126,12 @@ ha_insert_for_fold(
while (prev_node != NULL) {
if (prev_node->fold == fold) {
+ if (table->adaptive) {
+ prev_block = buf_block_align(prev_node->data);
+ ut_a(prev_block->n_pointers > 0);
+ prev_block->n_pointers--;
+ buf_block_align(data)->n_pointers++;
+ }
prev_node->data = data;
@@ -142,6 +155,11 @@ ha_insert_for_fold(
}
ha_node_set_data(node, data);
+
+ if (table->adaptive) {
+ buf_block_align(data)->n_pointers++;
+ }
+
node->fold = fold;
node->next = NULL;
@@ -174,6 +192,11 @@ ha_delete_hash_node(
hash_table_t* table, /* in: hash table */
ha_node_t* del_node) /* in: node to be deleted */
{
+ if (table->adaptive) {
+ ut_a(buf_block_align(del_node->data)->n_pointers > 0);
+ buf_block_align(del_node->data)->n_pointers--;
+ }
+
HASH_DELETE_AND_COMPACT(ha_node_t, next, table, del_node);
}
@@ -199,6 +222,35 @@ ha_delete(
ha_delete_hash_node(table, node);
}
+/*************************************************************
+Looks for an element when we know the pointer to the data, and updates
+the pointer to data, if found. */
+
+void
+ha_search_and_update_if_found(
+/*==========================*/
+ hash_table_t* table, /* in: hash table */
+ ulint fold, /* in: folded value of the searched data */
+ void* data, /* in: pointer to the data */
+ void* new_data)/* in: new pointer to the data */
+{
+ ha_node_t* node;
+
+ ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
+
+ node = ha_search_with_data(table, fold, data);
+
+ if (node) {
+ if (table->adaptive) {
+ ut_a(buf_block_align(node->data)->n_pointers > 0);
+ buf_block_align(node->data)->n_pointers--;
+ buf_block_align(new_data)->n_pointers++;
+ }
+
+ node->data = new_data;
+ }
+}
+
/*********************************************************************
Removes from the chain determined by fold all nodes whose data pointer
points to the page given. */
@@ -229,10 +281,10 @@ ha_remove_all_nodes_to_page(
node = ha_chain_get_first(table, fold);
} else {
- node = ha_chain_get_next(table, node);
+ node = ha_chain_get_next(node);
}
}
-
+#ifdef UNIV_DEBUG
/* Check that all nodes really got deleted */
node = ha_chain_get_first(table, fold);
@@ -240,8 +292,9 @@ ha_remove_all_nodes_to_page(
while (node) {
ut_a(buf_frame_align(ha_node_get_data(node)) != page);
- node = ha_chain_get_next(table, node);
+ node = ha_chain_get_next(node);
}
+#endif
}
/*****************************************************************
@@ -293,12 +346,10 @@ ha_print_info(
hash_table_t* table) /* in: hash table */
{
hash_cell_t* cell;
-/*
- ha_node_t* node;
- ulint len = 0;
- ulint max_len = 0;
- ulint nodes = 0;
-*/
+/* ha_node_t* node;
+ ulint nodes = 0;
+ ulint len = 0;
+ ulint max_len = 0; */
ulint cells = 0;
ulint n_bufs;
ulint i;
diff --git a/innobase/ha/hash0hash.c b/innobase/ha/hash0hash.c
index 1f7edf9d7d2..facdea66198 100644
--- a/innobase/ha/hash0hash.c
+++ b/innobase/ha/hash0hash.c
@@ -91,6 +91,7 @@ hash_create(
array = ut_malloc(sizeof(hash_cell_t) * prime);
+ table->adaptive = FALSE;
table->array = array;
table->n_cells = prime;
table->n_mutexes = 0;