}
}
-@@ -2059,7 +2059,7 @@
+@@ -2060,7 +2060,7 @@
btr_search_update_hash_on_delete(cursor);
}
}
if (!(flags & BTR_KEEP_SYS_FLAG)) {
-@@ -2073,7 +2073,7 @@
+@@ -2074,7 +2074,7 @@
row_upd_rec_in_place(rec, index, offsets, update, page_zip);
if (block->is_hashed) {
}
if (page_zip && !dict_index_is_clust(index)
-@@ -2857,7 +2857,7 @@
- block = btr_cur_get_block(cursor);
+@@ -2852,7 +2852,7 @@
+ }
if (block->is_hashed) {
- rw_lock_x_lock(&btr_search_latch);
}
page_zip = buf_block_get_page_zip(block);
-@@ -2872,7 +2872,7 @@
+@@ -2867,7 +2867,7 @@
}
if (block->is_hashed) {
}
btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
-@@ -3003,13 +3003,13 @@
+@@ -2994,13 +2994,13 @@
== dict_table_is_comp(cursor->index->table));
if (block->is_hashed) {
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
mem_free(folds);
-@@ -1215,10 +1281,10 @@
- mem_heap_t* heap = NULL;
+@@ -1216,9 +1282,9 @@
ulint* offsets;
+ ibool released_search_latch;
-- rw_lock_x_lock(&btr_search_latch);
-+ rw_lock_x_lock(btr_search_get_latch(index->id));
- //buf_pool_mutex_enter_all();
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
- table = btr_search_sys->hash_index;
+ table = btr_search_get_hash_index(index->id);
for (j = 0; j < srv_buf_pool_instances; j++) {
buf_pool_t* buf_pool;
-@@ -1291,6 +1357,7 @@
+@@ -1252,7 +1318,7 @@
- block->is_hashed = FALSE;
- block->index = NULL;
-+ block->btr_search_latch = NULL;
-
+
+ /* keeping latch order */
+- rw_lock_s_unlock(&btr_search_latch);
++ rw_lock_s_unlock(btr_search_get_latch(index->id));
+ released_search_latch = TRUE;
+ rw_lock_x_lock(&block->lock);
+
+@@ -1304,7 +1370,7 @@
+ mem_heap_empty(heap);
+ }
+
+- rw_lock_x_lock(&btr_search_latch);
++ rw_lock_x_lock(btr_search_get_latch(index->id));
+
+ if (UNIV_UNLIKELY(!block->is_hashed)) {
+ goto cleanup;
+@@ -1314,12 +1380,12 @@
+
+ if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
+ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
+- rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
+
+ mem_free(folds);
+
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
+ goto retry;
+ }
+
+@@ -1333,6 +1399,7 @@
+
+ block->is_hashed = FALSE;
+ block->index = NULL;
++ block->btr_search_latch = NULL;
+
+ cleanup:
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
- if (UNIV_UNLIKELY(block->n_pointers)) {
-@@ -1313,7 +1380,7 @@
+@@ -1345,18 +1412,18 @@
+ index->name, (ulong) block->n_pointers);
+ }
+ #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
+- rw_lock_x_unlock(&btr_search_latch);
++ rw_lock_x_unlock(btr_search_get_latch(index->id));
+ rw_lock_x_unlock(&block->lock);
+
+ mem_free(folds);
+
+- rw_lock_s_lock(&btr_search_latch);
++ rw_lock_s_lock(btr_search_get_latch(index->id));
+ }
+ }
+ } while (released_search_latch);
}
- //buf_pool_mutex_exit_all();
-- rw_lock_x_unlock(&btr_search_latch);
-+ rw_lock_x_unlock(btr_search_get_latch(index->id));
+- rw_lock_s_unlock(&btr_search_latch);
++ rw_lock_s_unlock(btr_search_get_latch(index->id));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
-@@ -1360,7 +1427,7 @@
+@@ -1403,7 +1470,7 @@
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
}
mtr_commit(&mtr);
-@@ -1402,26 +1469,26 @@
+@@ -1445,26 +1512,26 @@
ut_ad(index);
ut_a(!dict_index_is_ibuf(index));
}
n_recs = page_get_n_recs(page);
-@@ -1515,9 +1582,9 @@
+@@ -1558,9 +1625,9 @@
fold = next_fold;
}
if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
goto exit_func;
-@@ -1545,6 +1612,7 @@
+@@ -1588,6 +1655,7 @@
block->curr_n_bytes = n_bytes;
block->curr_left_side = left_side;
block->index = index;
for (i = 0; i < n_cached; i++) {
-@@ -1552,7 +1620,7 @@
+@@ -1595,7 +1663,7 @@
}
exit_func:
mem_free(folds);
mem_free(recs);
-@@ -1591,13 +1659,13 @@
+@@ -1634,13 +1702,13 @@
ut_a(!(new_block->is_hashed || block->is_hashed)
|| !dict_index_is_ibuf(index));
return;
}
-@@ -1612,7 +1680,7 @@
+@@ -1655,7 +1723,7 @@
new_block->n_bytes = block->curr_n_bytes;
new_block->left_side = left_side;
ut_a(n_fields + n_bytes > 0);
-@@ -1624,7 +1692,7 @@
+@@ -1667,7 +1735,7 @@
return;
}
}
/********************************************************************//**
-@@ -1663,7 +1731,7 @@
+@@ -1706,7 +1774,7 @@
ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
ut_a(!dict_index_is_ibuf(cursor->index));
index_id = cursor->index->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
-@@ -1672,11 +1740,11 @@
+@@ -1715,11 +1783,11 @@
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
}
/********************************************************************//**
-@@ -1710,21 +1778,21 @@
+@@ -1753,21 +1821,21 @@
ut_a(block->index == cursor->index);
ut_a(!dict_index_is_ibuf(cursor->index));
btr_search_update_hash_on_insert(cursor);
}
-@@ -1759,9 +1827,9 @@
+@@ -1802,9 +1870,9 @@
ulint* offsets = offsets_;
rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor);
-@@ -1806,7 +1874,7 @@
+@@ -1849,7 +1917,7 @@
} else {
if (left_side) {
locked = TRUE;
-@@ -1820,7 +1888,7 @@
+@@ -1863,7 +1931,7 @@
if (!locked) {
locked = TRUE;
}
-@@ -1838,7 +1906,7 @@
+@@ -1881,7 +1949,7 @@
if (!left_side) {
if (!locked) {
locked = TRUE;
}
-@@ -1853,7 +1921,7 @@
+@@ -1896,7 +1964,7 @@
if (!locked) {
locked = TRUE;
}
-@@ -1876,7 +1944,7 @@
+@@ -1919,7 +1987,7 @@
mem_heap_free(heap);
}
if (locked) {
}
}
-@@ -1892,7 +1960,7 @@
+@@ -1935,7 +2003,7 @@
ha_node_t* node;
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint cell_count;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
-@@ -1904,23 +1972,25 @@
+@@ -1947,23 +2015,25 @@
rec_offs_init(offsets_);
for (; node != NULL; node = node->next) {
const buf_block_t* block
-@@ -2029,19 +2099,21 @@
+@@ -2072,19 +2142,21 @@
give other queries a chance to run. */
if (i != 0) {
buf_pool_page_hash_x_unlock_all();
diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
--- a/storage/innobase/dict/dict0dict.c 2010-12-04 15:52:23.398513916 +0900
+++ b/storage/innobase/dict/dict0dict.c 2010-12-04 16:12:48.662550715 +0900
-@@ -1802,7 +1802,7 @@
+@@ -1806,7 +1806,7 @@
zero. */
for (;;) {
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
--- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:20.185850734 +0900
+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 16:12:48.674552412 +0900
-@@ -11611,6 +11611,11 @@
+@@ -11617,6 +11617,11 @@
"Disable with --skip-innodb-adaptive-hash-index.",
NULL, innodb_adaptive_hash_index_update, TRUE);
static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
PLUGIN_VAR_RQCMDARG,
"Replication thread delay (ms) on the slave server if "
-@@ -11963,6 +11968,7 @@
+@@ -11964,6 +11969,7 @@
MYSQL_SYSVAR(use_sys_stats_table),
MYSQL_SYSVAR(stats_sample_pages),
MYSQL_SYSVAR(adaptive_hash_index),
diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
--- a/storage/innobase/include/buf0buf.h 2010-12-15 19:00:07.713604580 +0900
+++ b/storage/innobase/include/buf0buf.h 2010-12-15 20:58:03.546839883 +0900
-@@ -1473,7 +1473,7 @@
+@@ -1544,7 +1544,7 @@
pointers in the adaptive hash index
pointing to this frame */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
already been built on this
page; note that it does not
guarantee that the index is
-@@ -1487,6 +1487,7 @@
+@@ -1558,6 +1558,7 @@
unsigned curr_left_side:1;/*!< TRUE or FALSE in hash indexing */
dict_index_t* index; /*!< Index for which the adaptive
hash index has been created. */
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
--- a/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:20.231484679 +0900
+++ b/storage/innobase/srv/srv0srv.c 2010-12-04 16:12:48.726551018 +0900
-@@ -2008,7 +2008,9 @@
+@@ -2042,7 +2042,9 @@
"-------------------------------------\n", file);
ibuf_print(file);
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
-@@ -2033,14 +2035,15 @@
+@@ -2067,14 +2069,15 @@
ut_total_allocated_memory,
mem_pool_get_reserved(mem_comm_pool));
/* Calcurate reserved memories */
lock_sys_subtotal = 0;
if (trx_sys) {
-@@ -2067,10 +2070,10 @@
+@@ -2101,10 +2104,10 @@
" Threads %lu \t(%lu + %lu)\n",
(ulong) (btr_search_sys