summaryrefslogtreecommitdiff
path: root/innobase/btr
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-12-08 14:34:58 +0200
committerunknown <marko@hundin.mysql.fi>2004-12-08 14:34:58 +0200
commit746799fb23aaef1705e9ee66de6a2cb77a8af2c8 (patch)
tree3e0b72bbe9244185a212519738dcdc9fedfad6fa /innobase/btr
parentff2c115ba8f048a117f9b3d03bd16b5883087826 (diff)
downloadmariadb-git-746799fb23aaef1705e9ee66de6a2cb77a8af2c8.tar.gz
Cset exclude: heikki@hundin.mysql.fi|ChangeSet|20041027124510|04970
innobase/btr/btr0sea.c: Exclude innobase/buf/buf0buf.c: Exclude innobase/buf/buf0lru.c: Exclude innobase/ha/ha0ha.c: Exclude innobase/include/buf0buf.h: Exclude innobase/include/ha0ha.h: Exclude innobase/include/hash0hash.h: Exclude
Diffstat (limited to 'innobase/btr')
-rw-r--r--innobase/btr/btr0sea.c74
1 files changed, 70 insertions, 4 deletions
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index 468c5efd24d..f2f5d09fa0e 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -439,8 +439,8 @@ btr_search_update_hash_ref(
ha_insert_for_fold(btr_search_sys->hash_index, fold, rec);
}
-}
-
+}
+
/*************************************************************************
Updates the search info. */
@@ -926,6 +926,17 @@ btr_search_drop_page_hash_index(
{
hash_table_t* table;
buf_block_t* block;
+ ulint n_fields;
+ ulint n_bytes;
+ rec_t* rec;
+ rec_t* sup;
+ ulint fold;
+ ulint prev_fold;
+ dulint tree_id;
+ ulint n_cached;
+ ulint n_recs;
+ ulint* folds;
+ ulint i;
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
@@ -951,18 +962,73 @@ btr_search_drop_page_hash_index(
|| (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */
- ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
+ n_fields = block->curr_n_fields;
+ n_bytes = block->curr_n_bytes;
+
+ ut_a(n_fields + n_bytes > 0);
rw_lock_s_unlock(&btr_search_latch);
+ n_recs = page_get_n_recs(page);
+
+ /* Calculate and cache fold values into an array for fast deletion
+ from the hash index */
+
+ folds = mem_alloc(n_recs * sizeof(ulint));
+
+ n_cached = 0;
+
+ sup = page_get_supremum_rec(page);
+
+ rec = page_get_infimum_rec(page);
+ rec = page_rec_get_next(rec);
+
+ if (rec != sup) {
+ ut_a(n_fields <= rec_get_n_fields(rec));
+
+ if (n_bytes > 0) {
+ ut_a(n_fields < rec_get_n_fields(rec));
+ }
+ }
+
+ tree_id = btr_page_get_index_id(page);
+
+ prev_fold = 0;
+
+ while (rec != sup) {
+ /* FIXME: in a mixed tree, not all records may have enough
+ ordering fields: */
+
+ fold = rec_fold(rec, n_fields, n_bytes, tree_id);
+
+ if (fold == prev_fold && prev_fold != 0) {
+
+ goto next_rec;
+ }
+
+ /* Remove all hash nodes pointing to this page from the
+ hash chain */
+
+ folds[n_cached] = fold;
+ n_cached++;
+next_rec:
+ rec = page_rec_get_next(rec);
+ prev_fold = fold;
+ }
+
rw_lock_x_lock(&btr_search_latch);
- ha_remove_all_nodes_to_page(table, page);
+ for (i = 0; i < n_cached; i++) {
+
+ ha_remove_all_nodes_to_page(table, folds[i], page);
+ }
block->is_hashed = FALSE;
block->index = NULL;
rw_lock_x_unlock(&btr_search_latch);
+
+ mem_free(folds);
}
/************************************************************************