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
This commit is contained in:
unknown 2004-12-08 14:34:58 +02:00
commit 746799fb23
7 changed files with 114 additions and 131 deletions

View file

@ -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);
}
/************************************************************************