InnoDB Plugin
1.0
|
#include "univ.i"
#include "rem0rec.h"
#include "dict0dict.h"
#include "btr0types.h"
#include "mtr0mtr.h"
#include "ha0ha.h"
#include "btr0sea.ic"
Go to the source code of this file.
Data Structures | |
struct | btr_search_t |
struct | btr_search_sys_t |
Macros | |
#define | BTR_SEARCH_MAGIC_N 1112765 |
#define | BTR_SEARCH_HASH_ANALYSIS 17 |
#define | BTR_SEARCH_ON_PATTERN_LIMIT 3 |
#define | BTR_SEARCH_ON_HASH_LIMIT 3 |
#define | BTR_SEA_TIMEOUT 10000 |
Variables | |
btr_search_sys_t * | btr_search_sys |
The index tree adaptive search
Created 2/17/1996 Heikki Tuuri
#define BTR_SEA_TIMEOUT 10000 |
We do this many searches before trying to keep the search latch
over calls from MySQL. If we notice someone waiting for the latch, we again set this much timeout. This is to reduce contention.
#define BTR_SEARCH_HASH_ANALYSIS 17 |
After change in n_fields or n_bytes in info, this many rounds are waited
before starting the hash analysis again: this is to save CPU time when there is no hope in building a hash index.
#define BTR_SEARCH_MAGIC_N 1112765 |
value of btr_search_t::magic_n, used in assertions
#define BTR_SEARCH_ON_HASH_LIMIT 3 |
Limit of consecutive searches for trying a search shortcut using
the hash index
#define BTR_SEARCH_ON_PATTERN_LIMIT 3 |
Limit of consecutive searches for trying a search shortcut on the search
pattern
UNIV_INTERN void btr_search_disable | ( | void | ) |
Disable the adaptive hash search system and empty the index.
UNIV_INTERN void btr_search_drop_page_hash_index | ( | buf_block_t * | block | ) |
Drops a page hash index. in: block containing index page, s- or x-latched, or an index page for which we know that block->buf_fix_count == 0
UNIV_INTERN void btr_search_drop_page_hash_when_freed | ( | ulint | space, |
ulint | zip_size, | ||
ulint | page_no | ||
) |
Drops a possible page hash index when a page is evicted from the buffer pool or freed in a file segment. in: page number
space | in: space id |
zip_size | in: compressed page size in bytes or 0 for uncompressed pages |
UNIV_INTERN void btr_search_enable | ( | void | ) |
Enable the adaptive hash search system.
UNIV_INLINE btr_search_t* btr_search_get_info | ( | dict_index_t * | index | ) |
Returns search info for an index.
index | in: index |
UNIV_INTERN ibool btr_search_guess_on_hash | ( | dict_index_t * | index, |
btr_search_t * | info, | ||
const dtuple_t * | tuple, | ||
ulint | mode, | ||
ulint | latch_mode, | ||
btr_cur_t * | cursor, | ||
ulint | has_search_latch, | ||
mtr_t * | mtr | ||
) |
Tries to guess the right search position based on the hash search info of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts, and the function returns TRUE, then cursor->up_match and cursor->low_match both have sensible values.
index | in: index |
info | in: index search info |
tuple | in: logical record |
mode | in: PAGE_CUR_L, ... |
latch_mode | in: BTR_SEARCH_LEAF, ... |
cursor | out: tree cursor |
has_search_latch | in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, RW_X_LATCH, or 0 |
UNIV_INTERN btr_search_t* btr_search_info_create | ( | mem_heap_t * | heap | ) |
Creates and initializes a search info struct.
UNIV_INTERN ulint btr_search_info_get_ref_count | ( | btr_search_t * | info | ) |
Returns the value of ref_count. The value is protected by btr_search_latch.
UNIV_INLINE void btr_search_info_update | ( | dict_index_t * | index, |
btr_cur_t * | cursor | ||
) |
Updates the search info. in: cursor which was just positioned
Updates the search info.
index | in: index of the cursor |
cursor | in: cursor which was just positioned |
UNIV_INTERN void btr_search_move_or_delete_hash_entries | ( | buf_block_t * | new_block, |
buf_block_t * | block, | ||
dict_index_t * | index | ||
) |
Moves or deletes hash entries for moved records. If new_page is already hashed, then the hash index for page, if any, is dropped. If new_page is not hashed, and page is hashed, then a new hash index is built to new_page with the same parameters as page (this often happens when a page is split). in: record descriptor
new_block | in: records are copied to this page |
block | in: index page from which records were copied, and the copied records will be deleted from this page |
UNIV_INTERN void btr_search_sys_create | ( | ulint | hash_size | ) |
Creates and initializes the adaptive search system at a database start. in: hash index hash table size
UNIV_INTERN void btr_search_sys_free | ( | void | ) |
Frees the adaptive search system at a database shutdown.
UNIV_INTERN void btr_search_update_hash_node_on_insert | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is inserted on a page. in: cursor which was positioned to the place to insert using btr_cur_search_..., and the new record has been inserted next to the cursor
UNIV_INTERN void btr_search_update_hash_on_delete | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is deleted from a page. in: cursor which was positioned on the record to delete using btr_cur_search_..., the record is not yet deleted
UNIV_INTERN void btr_search_update_hash_on_insert | ( | btr_cur_t * | cursor | ) |
Updates the page hash index when a single record is inserted on a page. in: cursor which was positioned to the place to insert using btr_cur_search_..., and the new record has been inserted next to the cursor
UNIV_INTERN ibool btr_search_validate | ( | void | ) |
Validates the search system.
btr_search_sys_t* btr_search_sys |
The adaptive hash index